Stripe in Blender Studio #93018
@ -147,6 +147,9 @@ class CheckoutExistingOrderView(LoginRequiredMixin, ExpectReadableIPAddressMixin
|
||||
# should be passed from the app, this url name is defined in example_app
|
||||
cancel_url = 'settings_home'
|
||||
|
||||
def get_cancel_url(self):
|
||||
return reverse(self.cancel_url)
|
||||
|
||||
def get_object(self, queryset=None) -> models.Order:
|
||||
order_id: int = self.kwargs['order_id']
|
||||
order_q = models.Order.objects.filter(customer=self.request.user.customer)
|
||||
@ -171,7 +174,7 @@ class CheckoutExistingOrderView(LoginRequiredMixin, ExpectReadableIPAddressMixin
|
||||
# we have to do it to avoid uri-encoding of curly braces,
|
||||
# otherwise stripe doesn't do the template substitution
|
||||
success_url = success_url.replace('CHECKOUT_SESSION_ID', '{CHECKOUT_SESSION_ID}', 1)
|
||||
cancel_url = self.request.build_absolute_uri(reverse(self.cancel_url))
|
||||
cancel_url = self.request.build_absolute_uri(self.get_cancel_url())
|
||||
session = stripe_utils.create_stripe_checkout_session_for_order(
|
||||
order,
|
||||
success_url,
|
||||
|
@ -102,7 +102,10 @@ class PaymentMethodChangeView(LoginRequiredMixin, View):
|
||||
log = log.getChild('PaymentMethodChangeView')
|
||||
subscription: models.Subscription
|
||||
success_url = '/'
|
||||
cancel_url = '/'
|
||||
cancel_url = 'settings_home'
|
||||
|
||||
def get_cancel_url(self):
|
||||
return reverse(self.cancel_url)
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
self.subscription = get_object_or_404(
|
||||
@ -120,7 +123,7 @@ class PaymentMethodChangeView(LoginRequiredMixin, View):
|
||||
# we have to do it to avoid uri-encoding of curly braces,
|
||||
# otherwise stripe doesn't do the template substitution
|
||||
success_url = success_url.replace('CHECKOUT_SESSION_ID', '{CHECKOUT_SESSION_ID}', 1)
|
||||
cancel_url = self.request.build_absolute_uri(reverse(self.cancel_url))
|
||||
cancel_url = self.request.build_absolute_uri(self.get_cancel_url())
|
||||
session = stripe_utils.setup_stripe_payment_method(
|
||||
self.subscription.currency.lower(),
|
||||
request.user.customer,
|
||||
|
Loading…
Reference in New Issue
Block a user