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 Nov 20, 2021
1 parent 307bd40 commit f3d265a
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 @@ -122,9 +122,14 @@ def get_return_url(self, payment, extra_data=None):
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 @@ -61,9 +61,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 @@ -220,9 +217,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 230 in payments/models.py

View check run for this annotation

Codecov / codecov/patch

payments/models.py#L229-L230

Added lines #L229 - L230 were not covered by tests
Expand Down

0 comments on commit f3d265a

Please sign in to comment.