Skip to content

Commit

Permalink
fixes of WhyNotHugo's remarks
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrDlouhy committed Apr 17, 2024
1 parent c8a78d1 commit 97ba417
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
9 changes: 7 additions & 2 deletions payments/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,14 @@ def get_return_url(
def autocomplete_with_subscription(self, payment):
"""
Complete the payment with subscription
Used by providers, that use server initiated subscription workflow
Throws RedirectNeeded if there is problem with the payment that needs to be solved by user
If the provider uses workflow such that the payments are initiated from
implementer's side.
The users of django-payments will create a payment and call
Payment.autocomplete_with_subscription() right before the subscription end.
Throws RedirectNeeded if there is problem with the payment
that needs to be solved by user.
"""
raise NotImplementedError()

Expand Down
12 changes: 7 additions & 5 deletions payments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ class TimeUnit(enum.Enum):
month = "month"
day = "day"

def get_token(self) -> str:
return self.token

def set_recurrence(self, token: str, **kwargs):
"""
Sets token and other values associated with subscription recurrence
Expand Down Expand Up @@ -262,9 +259,14 @@ def is_recurring(self) -> bool:
def autocomplete_with_subscription(self):
"""
Complete the payment with subscription
Used by providers, that use server initiated subscription workflow
Throws RedirectNeeded if there is problem with the payment that needs to be solved by user
If the provider uses workflow such that the payments are initiated from
implementer's side.
Call this function right before the subscription end to
make a new subscription payment.
Throws RedirectNeeded if there is problem with the payment
that needs to be solved by user
"""
provider = provider_factory(self.variant)
provider.autocomplete_with_subscription(self)

Check warning on line 272 in payments/models.py

View check run for this annotation

Codecov / codecov/patch

payments/models.py#L271-L272

Added lines #L271 - L272 were not covered by tests
Expand Down

0 comments on commit 97ba417

Please sign in to comment.