-
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
Add feature flag check to early WooPay session request #7459
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: +53 B (0%) Total Size: 1.43 MB
ℹ️ View Unchanged
|
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 and tests well.
- ✅ If an adapted extension is enabled, the express checkout button opens the OTP modal and I see no calls to
?wc-ajax=wcpay_get_woopay_session
. - ✅ If no adapted extensions are enabled, the express checkout button redirects to the first party auth, I see a call to
?wc-ajax=wcpay_get_woopay_session
.
Testing the plugins still in compatiblity:
- ✅ Tests well for https://github.com/Automattic/woopay/pull/1954
- ✅ Tests well for https://github.com/Automattic/woopay/pull/1950
Cannot create order from empty cart.
. Checking the merchant store, the cart was still there.
After a few tries I was able to place an order and could no longer reproduce the above error. I suspect this is not related to this PR, but it might be something worth noting.
Changes proposed in this Pull Request
This PR is a follow up to #7455. In that PR we disable WooPay's first party authentication feature flag (
_wcpay_feature_woopay_first_party_auth
) when incompatible plugins are enabled. This prevented the first party flow from firing successfully and used the OTP modal instead. Unfortunately, it didn't fix the primary issue which was to allow WooPay compatible extensions to pass their data on to WooPay due to the changes in #6831.This PR fixes that issue by wrapping the changes from #6831 in a check against the feature flag as well, so that that feature flag will determine whether we send any early session data to WooPay or not. The key piece to avoid when working with compatible extensions (adapted extensions) is that we must have the shopper's email address before we initialize the session, something we can only do in most cases after the shopper has authenticated on WooPay.
Testing instructions
For testing these changes specifically:
Monitor the wp_options table for the option name _wcpay_feature_woopay_first_party_auth.
Remove the option if it is present.
Disable any adapted extensions (tested with Gift Cards and Points and Rewards).
Confirm that the option is now set to 1.
Enable either/all of the extensions listed.
Confirm that the option is now set to 0.
Add a product to the Cart
Click any of the WooPay express checkout buttons
Confirm that there was no call to
?wc-ajax=wcpay_get_woopay_session
Confirm that the OTP modal popped up instead of redirecting to WooPay right away
Disable all the adapted extensions.
Confirm that the option is now set to 1.
Add a product to the Cart
Click any of the WooPay express checkout buttons
Confirm that there was a call to
?wc-ajax=wcpay_get_woopay_session
Confirm that you were redirected directly to WooPay and there was no WooPay modal.
Testing the plugins still in compatiblity.
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