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

Add validation to the set_payment_method_title_for_email method #6951

Closed
mdmoore opened this issue Aug 8, 2023 · 0 comments · Fixed by #7108
Closed

Add validation to the set_payment_method_title_for_email method #6951

mdmoore opened this issue Aug 8, 2023 · 0 comments · Fixed by #7108
Assignees
Labels
category: core WC Payments core related issues, where it’s obvious. component: checkout Issues related to Checkout component: upe good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: bug The issue is a confirmed bug.

Comments

@mdmoore
Copy link
Member

mdmoore commented Aug 8, 2023

Describe the bug

The set_payment_method_title_for_email function lacks proper validation, potentially leading to unexpected behavior or fatal errors when setting payment methods for email notifications. We should ensure that the function gracefully handles invalid or missing data and returns WooPayments as a fallback.

Additional context

Stack trace of one error that occurred during a pre-orders purchase and release

CRITICAL Uncaught WCPay\Exceptions\API_Exception: Error: Server error. Please try again. in /wp-content/plugins/woocommerce-payments/includes/wc-payment-api/class-wc-payments-api-client.php:2009
Stack trace:
#0 /wp-content/plugins/woocommerce-payments/includes/wc-payment-api/class-wc-payments-api-client.php(1835): WC_Payments_API_Client->check_response_for_errors(Array)
#1 /wp-content/plugins/woocommerce-payments/includes/wc-payment-api/class-wc-payments-api-client.php(1265): WC_Payments_API_Client->request(Array, 'payment_methods...', 'GET')
#2 /wp-content/plugins/woocommerce-payments/includes/payment-methods/class-upe-payment-gateway.php(1121): WC_Payments_API_Client->get_payment_method('')
#3 /wp-includes/class-wp-hook.php(310): WCPay\Payment_Methods\UPE_Payment_Gateway->set_payment_method_title_for_email(Object(WC_Order), false, false)
#4 /wp-content/plugins/woocommerce-payments/includes/wc-payment-api/class-wc-payments-api-client.php on line 2009

p1691513753212109-slack-CGGCLBN58

@mdmoore mdmoore added type: bug The issue is a confirmed bug. good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. component: upe labels Aug 8, 2023
@RadoslavGeorgiev RadoslavGeorgiev added component: checkout Issues related to Checkout category: core WC Payments core related issues, where it’s obvious. labels Aug 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: core WC Payments core related issues, where it’s obvious. component: checkout Issues related to Checkout component: upe good first issue The issue is a good candidate for the first community contribution/for a newcomer to the team. priority: high The issue/PR is high priority—it affects lots of customers substantially, but not critically. type: bug The issue is a confirmed bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants