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 errors when using OXXO or Boleto #2947

Conversation

james-allan
Copy link
Contributor

Fixes #2942

Changes proposed in this Pull Request:

While testing our Split PE with deferred intent changes, Global Step found there are errors when processing payments via Boleto or Oxxo on the checkout.

PHP Warning:  Undefined array key "" in /public/wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php on line 2359
PHP Warning:  Attempt to read property "id" on null in /public/wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php on line 2359

This error occurs because when we attempt to set the order's payment method ID, we fetch the UPE payment method's retrievable type. This aims to fetch the payment method to store on the order/subscription. Eg Bancontact > SEPA. Because Boleto and OXXO don't have a retrievable type and isn't reusable it returns null. In this case, we should return the payment the Boleto payment ID.

This PR fixes this issue.

get_upe_gateway_id_for_order() now handles 3 cases:

  • cardstripe
  • If the gateway has a different retrievable type it will return the retreviable type ID. ie bancontactsepa_debit, idealsepa_debit etc.
  • If none of the above, it will be the UPE's method ID. boletoboleto

Testing instructions


  • 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

@james-allan
Copy link
Contributor Author

Closing in favour of #2948

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

Successfully merging this pull request may close these issues.

1 participant