Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
fix: Add logs after PI confirmation
Browse files Browse the repository at this point in the history
  • Loading branch information
julianajlk committed May 8, 2024
1 parent 03c04a7 commit bfe3bea
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions ecommerce/extensions/payment/processors/stripe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bfe3bea

Please sign in to comment.