From bfe3bea8fb0b975cc9198844a30f481d6a4b56d3 Mon Sep 17 00:00:00 2001 From: julianajlk Date: Wed, 8 May 2024 09:14:18 -0400 Subject: [PATCH] fix: Add logs after PI confirmation --- .../extensions/payment/processors/stripe.py | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/ecommerce/extensions/payment/processors/stripe.py b/ecommerce/extensions/payment/processors/stripe.py index 771c56a374c..507ed8383b9 100644 --- a/ecommerce/extensions/payment/processors/stripe.py +++ b/ecommerce/extensions/payment/processors/stripe.py @@ -301,25 +301,33 @@ def handle_processor_response(self, response, basket=None): logger.exception('Card Error for basket [%d]: %s}', basket.id, err) raise + logger.info( + 'Confirmed Stripe payment intent [%s] for basket [%d] and order number [%s],' + 'with dynamic_payment_methods_enabled [%s].', + payment_intent_id, + basket.id, + basket.order_number, + dynamic_payment_methods_enabled + ) + # If the payment has another status other than 'succeeded', we want to return to the MFE something it can handle - if dynamic_payment_methods_enabled: - if confirm_api_response['status'] == 'requires_action': - return InProgressProcessorResponse( - basket_id=basket.id, - order_number=basket.order_number, - status=confirm_api_response['status'], - confirmation_client_secret=confirm_api_response['client_secret'], - transaction_id=confirm_api_response['id'], - payment_method=confirm_api_response['payment_method'], - total=confirm_api_response['amount'], - ) + if confirm_api_response['status'] == 'requires_action': + return InProgressProcessorResponse( + basket_id=basket.id, + order_number=basket.order_number, + status=confirm_api_response['status'], + confirmation_client_secret=confirm_api_response['client_secret'], + transaction_id=confirm_api_response['id'], + payment_method=confirm_api_response['payment_method'], + total=confirm_api_response['amount'], + ) # proceed only if payment went through assert confirm_api_response['status'] == "succeeded" self.record_processor_response(confirm_api_response, transaction_id=payment_intent_id, basket=basket) logger.info( - 'Successfully confirmed Stripe payment intent [%s] for basket [%d] and order number [%s].', + 'Confirmed Stripe payment intent with succeeded status [%s] for basket [%d] and order number [%s].', payment_intent_id, basket.id, basket.order_number,