Don't dissociate card if transaction fails

This commit is contained in:
PCoder 2018-07-07 02:03:42 +02:00
parent 0f26917f35
commit 34ed51a643
2 changed files with 8 additions and 10 deletions

View file

@ -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')

View file

@ -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')