From 97ba417b0a00599d645c8e13010e8d1c8f3f7a7b 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 0e496cdac..922001605 100644 --- a/payments/core.py +++ b/payments/core.py @@ -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() diff --git a/payments/models.py b/payments/models.py index 852da7c82..ba07160bd 100644 --- a/payments/models.py +++ b/payments/models.py @@ -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 @@ -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)