-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkout: Convert PurchaseModal to use composite checkout #48152
Checkout: Convert PurchaseModal to use composite checkout #48152
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~840 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~467 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
52f5971
to
2b0eefd
Compare
Ok, this seems to work now! Just need to clean up the PR. |
22b685d
to
59e6c1f
Compare
This is now ready to be tested, although it will need to be rebased when #48069 and #48283 are merged, as they are included in here. Until that time, it may be hard to review the code changes. To that end, I've made a cleaned-up version of this PR with the dependencies removed in #48284. You can test the behavior here and read the code changes there. |
59e6c1f
to
a525851
Compare
ac81a05
to
c02622f
Compare
fa5d99c
to
9340c45
Compare
Rebased after the dependencies were merged. This is ready for final review. |
Edit: this comment is describing expected behavior; never mind :) Just noting that I needed to manually put myself in the After completing checkout with a personal plan, I end up at what looks like a generic thank you page with no upsell: |
The following case works as expected:
I am redirected to the correct thank you page (scheduling a session). |
The upsell page is not shown if the card used is a 3DS card due to the fact that 3DS cards may display a pending page before displaying the thank-you page. I updated the testing instructions to specify not using a 3DS card. One interesting thing to note (and this is existing behavior) is that the upsell defaults to the most recently added card and not necessarily the card used for the purchase that triggered the upsell. |
Along with useCreatePaymentCompleteCallback and existingCardProcessor.
That will be handled by CheckoutProvider.
f510bb6
to
e43d60a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🚢
I rebased the PR since one my changes caused a merge conflict.
I tested the following scenarios:
- Purchased a Business plan -> saw the Quick Start offer -> one-click purchase completed successfully
- Purchase a Premium plan -> saw the Business bump offer -> one-click purchase completed successfully
- Assigned myself to the Premium bump A/B test treatment group -> Purchased a Personal plan -> saw the Premium bump offer -> one-click purchase completed successfully
- Tried purchase via Calypso /plans -> after one-click purchase, got redirected to the appropriate Thank You page.
- Tried paying for a plan with PayPal -> one click upsell did not show and that's the correct behaviour
- Clicking No on the offer took to Home page
* Fill in missing PropTypes for UpsellNudge * Replace CheckoutContainer with ShoppingCartProvider around UpsellNudge * Wrap UpsellNudge with withShoppingCart * Explicitly add isFetchingStoredCards, cards to UpsellNudge selectors * Refactor CheckoutProvider to be a named function * Make total and items optional props to CheckoutProvider * Convert useSubmitTransaction to use useProcessPayment * Update UpsellNudge to use shoppingCartManager * Remove handleCheckoutCompleteRedirect from UpsellNudge * Add CheckoutProvider to PurchaseModal Along with useCreatePaymentCompleteCallback and existingCardProcessor. * Remove onComplete from useSubmitTransaction That will be handled by CheckoutProvider. * Use withPaymentCompleteCallback on UpsellNudge * Use getThankYouPageUrl directly in UpsellNudge * Add QueryStoredCards to UpsellNudge * Move CheckoutProvider outside PurchaseModal by adding wrapper * Allow mounting UpsellNudge if products are still fetching * Pass siteId to PurchaseModal * Pass correct args to existingCardProcessor * Pass country/postalCode to existingCardProcessor * Set tax country code in UpsellNudge * Add StripeHookProvider to UpsellNudge * Set form to processing before submit in useSubmitTransaction * Remove declined support session when closing modal * Include receiptId in UpsellNudge getThankYouPageUrlArguments
Changes proposed in this Pull Request
The one-click upsell code is the only remaining place using the
TransactionFlow
object which is the way that old checkout submits its payments for processing.This PR modifies
PurchaseModal
to use the existing card payment processor that is part of composite checkout as follows:CheckoutContainer
wrapper aroundUpsellNudge
withCalypsoShoppingCartProvider
and some additional redux selectors.PurchaseModal
inCheckoutProvider
to get access to the transaction status manager.TransactionFlow.submit
withuseProcessPayment
.handleCheckoutCompleteRedirect
withuseCreatePaymentCompleteCallback
.Fixes #48132
Testing instructions