Skip to content
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

[Split PE] Fix purchasing with Alipay with our deferred intent changes #2948

Merged
merged 7 commits into from
Feb 28, 2024

Conversation

mattallan
Copy link
Contributor

Fixes #2939

Changes proposed in this Pull Request:

With the latest Split dPE changes, purchasing a product with Alipay resulted in the following checkout notice:
image

Stripe logs had the following error:

2024-02-27T03:30:55+00:00 DEBUG 
====Stripe Version: 8.0.0====
====Start Log====
Error: The information for creating and confirming the intent is missing the following data: payment_method.
====End Log====

This issue was caused by the stripe_alipay payment method not being handled in JS by our processPayments function. Fixed by 63922cf.

After fixing this, attempting to checkout with Alipay resulted in:
image

The issue here is caused by our process_payment_with_deferred_intent() returning a #wc-stripe-confirm-%s:%s:%s:%s redirect URL. 3f4aa0e fixes the issue by handling properly fetching the redirect URL to alipay from the intent object.

Important

There are a few smaller changes I added in this PR:

  1. 56b56c9 change the name/label used for Alipay on the checkout to just "Alipay" to be inline with our other UPE methods
  2. 0980e72 fixes Undefined array key "" and Attempt to read property "id" on null PHP warnings coming from the get_upe_gateway_id_for_order() function

Testing instructions

  1. Set your store to one of Alipay-supported currencies (i.e. 'EUR', 'AUD', 'CAD', 'USD')
  2. Make sure the connected Stripe account matches the supported currency as well
  3. Enable UPE and enable Alipay payment method
  4. Checkout the add/deferred-intent branch
  5. Add a simple product to your cart and visit the shortcode checkout
  6. Attempt to purchase with Alipay and notice the error on checkout
  7. Checkout this branch and attempt to pay with Alipay
  8. Confirm you're redirected off-site to the Alipay <> Stripe payment page
  9. Authorize/confirm the payment and confirm you are redirected to the order received page
  10. Test Alipay on the block checkout

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

@mattallan mattallan requested review from a team and a-danae and removed request for a team February 27, 2024 05:13
@james-allan
Copy link
Contributor

Noting that this PR also fixes #2942. When using Boleto or OXXO the get_upe_gateway_id_for_order() function no longer attempts to get an array element via a null return from get_retrievable_type().

@Mayisha
Copy link
Contributor

Mayisha commented Feb 27, 2024

Confirming that this PR fixes #2940 too. Giropay, EPS, P24 does not show the PHP fatal error on order received page anymore. get_retrievable_type returning the correct stripe id has fixed this issue.

Copy link
Contributor

@a-danae a-danae left a comment

Choose a reason for hiding this comment

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

Great work here @mattallan ! Looks good to me 🙂

✅ Placing an order with Alipay is successfully completed in both the shortcode and block checkout pages - The error isn't happening anymore.
✅ The code changes make sense to me.

Glad that this also covered the problems we were getting with other APMs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants