From f3d265ad6232daee8351a7e7adff0eefddf3b4d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Dlouh=C3=BD?= Date: Sat, 20 Nov 2021 07:53:04 +0100 Subject: [PATCH] fixes of WhyNotHugo's remarks --- payments/core.py | 9 +++++++-- payments/models.py | 12 +++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/payments/core.py b/payments/core.py index b61343f3b..8848fd3bf 100644 --- a/payments/core.py +++ b/payments/core.py @@ -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() diff --git a/payments/models.py b/payments/models.py index 3330ff2f8..3b32846fe 100644 --- a/payments/models.py +++ b/payments/models.py @@ -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 @@ -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)