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

feat: Add Dynamic Payment Methods BNPL #4115

Merged
merged 11 commits into from
Apr 17, 2024

Conversation

julianajlk
Copy link
Contributor

@julianajlk julianajlk commented Feb 5, 2024

REV-3821.

Legacy uses Custom Actions Beta (CAB), which do not have automatic_payment_methods enabled by default in Stripe.
In preparation for the DPM experiment, we need to refactor our code in ecommerce and payment MFE to be able to handle a different payment flow.

A note on server/client side confirmation with DPM and redirect to receipt:
The docs for dynamic payment methods use client-side Payment Intent confirmation, and even though with CAB we can confirm the Payment Intent server-side, the "next action" is still handled from the client.
This means that on "Place Order" in the payment MFE, we make a POST request to ecommerce to confirm the Payment Intent (among other things), but this is not finalized until we're back in the MFE after a re-direct from the BNPL environment.
This means that it would skip order and billing address creation and order fulfillment in ecommerce, and the redirect to the receipt page would have to happen from the MFE to an order that doesn't exist yet --> we will use webhooks to make this happen async, included in this PR.

@julianajlk julianajlk requested a review from a team as a code owner February 5, 2024 20:35
@julianajlk julianajlk force-pushed the julianajlk/REV-3821/stripe-dpm branch 5 times, most recently from 5c892f0 to 438ba64 Compare February 9, 2024 16:39
@julianajlk julianajlk force-pushed the julianajlk/REV-3821/stripe-dpm branch 9 times, most recently from 54ecc61 to 292a76b Compare March 6, 2024 15:33
@julianajlk julianajlk force-pushed the julianajlk/REV-3821/stripe-dpm branch 3 times, most recently from f49b2ed to 49c6cf3 Compare March 27, 2024 18:06
@julianajlk julianajlk force-pushed the julianajlk/REV-3821/stripe-dpm branch 11 times, most recently from 949bee5 to 238675a Compare March 29, 2024 14:37
@julianajlk julianajlk force-pushed the julianajlk/REV-3821/stripe-dpm branch 4 times, most recently from b9e948b to 5f2afe8 Compare March 29, 2024 17:04
ecommerce/extensions/basket/utils.py Show resolved Hide resolved
ecommerce/extensions/checkout/mixins.py Show resolved Hide resolved
ecommerce/extensions/payment/processors/stripe.py Outdated Show resolved Hide resolved
)
except stripe.error.CardError as err:
self.record_processor_response(err.json_body, transaction_id=payment_intent_id, basket=basket)
logger.exception('Card Error for basket [%d]: %s}', basket.id, err)
raise

# 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':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible that the status would not be succeeded AND not be requires_action?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so at this point in the code in the POST request? But I will think about this

ecommerce/extensions/payment/views/stripe.py Outdated Show resolved Hide resolved
@julianajlk julianajlk force-pushed the julianajlk/REV-3821/stripe-dpm branch from 95fca20 to be962ab Compare April 16, 2024 18:25
@julianajlk julianajlk force-pushed the julianajlk/REV-3821/stripe-dpm branch from 6d279c8 to 9e69195 Compare April 16, 2024 19:57
@julianajlk julianajlk merged commit 5482fe2 into 2u/main Apr 17, 2024
8 checks passed
@julianajlk julianajlk deleted the julianajlk/REV-3821/stripe-dpm branch April 17, 2024 18:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants