Store charge id from payement intent result

This commit is contained in:
PCoder 2020-12-31 16:39:25 +05:30
parent 85757e01c9
commit 8e4b3ce96b

View file

@ -259,15 +259,6 @@ def handle_webhook(request):
logger.debug(template) logger.debug(template)
logger.debug("6*******") logger.debug("6*******")
logger.debug(billing_address_data) 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() incomplete_pm.completed_at = datetime.datetime.now()
charges = "" charges = ""
if len(payment_intent_obj.charges.data) > 0: if len(payment_intent_obj.charges.data) > 0:
@ -276,7 +267,17 @@ def handle_webhook(request):
charges = "%s" % d.id charges = "%s" % d.id
else: else:
charges = "%s,%s" % (charges, d.id) charges = "%s,%s" % (charges, d.id)
logger.debug("Charge ids = %s" % charges)
incomplete_pm.stripe_charge_id=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() incomplete_pm.save()
except (IncompletePaymentIntents.DoesNotExist, except (IncompletePaymentIntents.DoesNotExist,
IncompletePaymentIntents.MultipleObjectsReturned) as ex: IncompletePaymentIntents.MultipleObjectsReturned) as ex: