From 8e4b3ce96b0667be8e3e83d617ddea7d044774de Mon Sep 17 00:00:00 2001 From: PCoder Date: Thu, 31 Dec 2020 16:39:25 +0530 Subject: [PATCH] Store charge id from payement intent result --- webhook/views.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/webhook/views.py b/webhook/views.py index 3c5adfef..bdcf1654 100644 --- a/webhook/views.py +++ b/webhook/views.py @@ -259,15 +259,6 @@ def handle_webhook(request): logger.debug(template) logger.debug("6*******") logger.debug(billing_address_data) - do_provisioning_generic( - request=request, - stripe_api_cus_id=incomplete_pm.stripe_api_cus_id, - card_details_response=card_details_response, - stripe_subscription_id=None, - stripe_charge_id=soc, - gp_details=gp_details, - billing_address_data=billing_address_data - ) incomplete_pm.completed_at = datetime.datetime.now() charges = "" if len(payment_intent_obj.charges.data) > 0: @@ -276,7 +267,17 @@ def handle_webhook(request): charges = "%s" % d.id else: charges = "%s,%s" % (charges, d.id) + logger.debug("Charge ids = %s" % charges) incomplete_pm.stripe_charge_id=charges + do_provisioning_generic( + request=request, + stripe_api_cus_id=incomplete_pm.stripe_api_cus_id, + card_details_response=card_details_response, + stripe_subscription_id=None, + stripe_charge_id=charges, + gp_details=gp_details, + billing_address_data=billing_address_data + ) incomplete_pm.save() except (IncompletePaymentIntents.DoesNotExist, IncompletePaymentIntents.MultipleObjectsReturned) as ex: