From 34ed51a643a95b794f632768cd7a44a2946fabf6 Mon Sep 17 00:00:00 2001 From: PCoder Date: Sat, 7 Jul 2018 02:03:42 +0200 Subject: [PATCH] Don't dissociate card if transaction fails --- datacenterlight/views.py | 9 ++++----- hosting/views.py | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/datacenterlight/views.py b/datacenterlight/views.py index 649810d0..bf87d9b9 100644 --- a/datacenterlight/views.py +++ b/datacenterlight/views.py @@ -530,11 +530,10 @@ class OrderConfirmationView(DetailView): or stripe_subscription_obj.status != 'active'): # At this point, we have created a Stripe API card and # associated it with the customer; but the transaction failed - # due to some reason. We may want to dissociate this card. - # stripe_utils.dissociate_customer_card( - # stripe_api_cus_id, - # card_details_dict['card_id'] - # ) + # due to some reason. So, we would want to dissociate this card + # here. + # ... + msg = subscription_result.get('error') messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment') diff --git a/hosting/views.py b/hosting/views.py index f8bcbe14..6af1885b 100644 --- a/hosting/views.py +++ b/hosting/views.py @@ -1054,11 +1054,10 @@ class OrdersHostingDetailView(LoginRequiredMixin, DetailView): stripe_subscription_obj.status != 'active'): # At this point, we have created a Stripe API card and # associated it with the customer; but the transaction failed - # due to some reason. So, we dissociate this card. - stripe_utils.dissociate_customer_card( - request.user.stripecustomer.stripe_id, - card_details_dict['card_id'] - ) + # due to some reason. So, we would want to dissociate this card + # here. + # ... + msg = subscription_result.get('error') messages.add_message(self.request, messages.ERROR, msg, extra_tags='failed_payment')