-
Notifications
You must be signed in to change notification settings - Fork 69
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
WooPay compatibility with deferred intent creation UPE #6656
Conversation
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Size Change: +4 kB (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
…heckout service tests
if ( ! empty( $upe_payment_method ) && 'woocommerce_payments' !== $upe_payment_method ) { | ||
$payment_methods = [ str_replace( 'woocommerce_payments_', '', $upe_payment_method ) ]; | ||
} elseif ( WC_Payments_Features::is_upe_split_enabled() || WC_Payments_Features::is_upe_deferred_intent_enabled() ) { | ||
$payment_methods = [ 'card' ]; | ||
} else { | ||
$payment_methods = WC_Payments::get_gateway()->get_payment_method_ids_enabled_at_checkout( null, true ); | ||
} |
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.
It always confuses me how this conditional logic here works...but I'm pretty sure it does and I suppose that's what's important lol. 😂
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.
Yes, I see what you mean. In this PR, I just moved this logic from the process_payment_for_order
method without any modification. I did so to be able to re-use it properly. Overall, this method needs a re-visit, most probably during split-upe/legacy-upe cleanup.
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!
Finally managed to test this properly: ran it through both the shortcode and blocks checkouts using as many permutations of regular product, subscription, and free-trial subscriptions using multiple accounts with regular payment methods and 3DS payment methods requiring additional authentication and I could not get this implementation to either bend nor break. Nice one! Tip top tidy job.
@FangedParakeet Thanks for your review! Today I've added one more commit (3af7500), which ensures that payment methods addition under My account page works appropriately for the deferred intent UPE. I'd appreciate it if you could take a look at this commit - if everything's alright, please approve the PR once more - this will signal me that we're ready to merge. Thanks! |
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.
Nice catch! It looks like we're now supplying all the valid parameters whenever that Payment Information is required. LGTM.
Spent a bit of time testing pre-existing split-UPE checkout flows, just for my own sanity, and everything appears to be running as expected. Double-checking the code, I don't believe there's anything in here that would conflict with any existing flows in any other gateways, so I think we're good to go now! 🚢
Closes #6291
Changes proposed in this Pull Request
Currently, split UPE with the deferred intent creation on the server is implemented in all flows, including shortcode & Blocks checkout and My account subpages, such as Payment methods, Subscriptions, Pay for order. The time has come for the WooPay to be compatible with this UPE type as well, thus this PR ensures that WooPay's functionality previously used only in pair with the legacy card gateway, is now entirely usable with the deferred intent creation UPE as well.
Testing instructions
1️⃣
https://dashboard.stripe.com/test/customers
), confirm that the user is also listed.Now, since you have the user registered in WooPay, check the following:
2️⃣
000000
make sure you're redirected successfully to the checkout page with all the cart details.http://host.docker.internal:8090/account/orders
and confirm that the order placed is listed there.Place an order with WooPay in the incognito window.
On the cart page, use the WooPay express checkout button and provide the email in the WooPay to checkout using WooPay. Confirm that the checkout went successfully.
On the product page (e.g. a Beanie) use the express checkout button to test new user registration flow and checking out using the existing email address.
Perform testing instructions from 1️⃣ and 2️⃣ on the Blocks checkout page.
class-checkout-service.php
was extended a bit. Below are the changes and how to test them (and changes inclass-payment-information
as well):create_intention_request
method is used for all the legacy card payments and card payments within the deferred intent creation. This means, that you will probably have this method tested after all the above steps but if still unsure - just enable legacy gateway (non-UPE) or deferred intent UPE and purchase any product with a card.create_and_confirm_setup_intention_request
was slightly modified as well. To test it out, enable legacy gateway (non-UPE) or deferred intent creation UPE, and purchase a free trial subscription. Ensure that the payment was processed successfully.npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge