-
Notifications
You must be signed in to change notification settings - Fork 207
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
Fix legacy method names in order meta #2934
Fix legacy method names in order meta #2934
Conversation
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.
Thanks for these changes, @Mayisha! Glad we caught this!
Here's the summary from a a partial round of testing.
I was able to replicate the issue in develop
and successfully tested these flows:
- Payment gateway name in order details. The APM’s name is displayed in the order details, not its gateway ID
- Reordering the payment methods in WooCommerce > Payments. All of the payment methods from Stripe are displayed together. This group is ordered as expected in relationship with the payment methods introduced by WooCommerce and other extensions, like PayPal Payments, on the checkout pages.
- Reordering the Stripe Payment methods. They are ordered as expected in relationship with each other on the classic checkout page.
- SEPA and Cards are displayed on the Add new payment method page when UPE is disabled.
🔴 I also noticed the following unexpected behavior. There’s a fatal error when visiting the Add new payment method page with UPE enabled.
Undefined variable: gateway in /var/www/html/wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php on line 196
Uncaught Error: Call to a member function supports() on null in /var/www/html/wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php:196
Stack trace:
#0 /var/www/html/wp-includes/class-wp-hook.php(324): WC_Stripe_UPE_Payment_Gateway->get_available_payment_gateways(Array)
#1 /var/www/html/wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
#2 /var/www/html/wp-content/plugins/woocommerce/includes/class-wc-payment-gateways.php(333): apply_filters('woocommerce_ava...', Array)
#3 /var/www/html/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Assets/SmartButton.php(535): WC_Payment_Gateways->get_available_payment_gateways()
#4 /var/www/html/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/Assets/SmartButton.php(279): WooCommerce\PayPalCommerce\Button\Assets\SmartButton->render_button_wrapper_registrar()
#5 /var/www/html/wp-content/plugins/woocommerce-paypal-payments/modules/ppcp-button/src/ButtonModule. in /var/www/html/wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-upe-payment-gateway.php on line 196
I'll check out this error, check other flows, and review the code next.
So, the error I mentioned before should have been fixed by 4f01c4b. I updated the branch this PR points to from |
includes/payment-methods/class-wc-stripe-upe-payment-gateway.php
Outdated
Show resolved
Hide resolved
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.
Things tests well, thanks @Mayisha 🙂
I've pushed an update and will proceed to merge it so GlobalStep can include these changes in their test round on Monday. Please feel free to review those when you're back!
I think it'd be good to revisit it, since hiding the gateways from the Payment Methods page with CSS seems a bit fragile. I'd be curious if there's a more robust approach but I couldn't dive there. I wonder if WooPayments needed to handle a similar scenario.
Approving and proceeding to merge.
Nice PR @Mayisha! These changes also fixed refunding via Multibanco 🎉 Previously if you purchased an order with Multibanco, there was no "Refund $$ via Multibanco" button on the Edit Order page, only manual refunds were supported. The required change to fix this is to add Multibanco to our
@a-danae @Mayisha James added a new function recently to hide payment methods on the WooCommerce payment methods list page here: woocommerce-gateway-stripe/includes/admin/class-wc-stripe-settings-controller.php Line 144 in 8f0db94
We should be able to replace the CSS approach in this PR by adding Multibanco and any other non-UPE classes to the |
Fixes #2932
Changes proposed in this Pull Request:
trunk
I found that trunk has the same behavior for Multibanco in UPE and all other methods when UPE is disabled. In short, the existing behavior in the latest releases are, when you have a subscription product in cart, the non-UPE methods using Sources API is available as an option to checkout but the subscription will be created as a manually renewed subscription.add_gateways
method which was called bywoocommerce_payment_gateways
so that they don't appear on the WooCommerce > Settings > Payments page. As a resultWC()->payment_gateways->payment_gateways()
does not have these Stripe methods listed. As a result, here the order can not find the stripe payment method object (just has the id) and finally just renders the id here. This is the reason behind the order meta payment method name issue in New settings page issue #2932. (There could be other places implicated byWC()->payment_gateways->payment_gateways()
not having the stripe payment methods, though I have not found others yet)Testing instructions
Reproduce the bug
develop
branch.New checkout experience
from the Stripe settings page.card
.stripe_xyz
instead of the method title.Test the fix
fix/2932-non-upe-method-in-order-and-checkout
branch (this branch).New checkout experience
from the Stripe settings page.card
.Payment method order in checkout page
fix/2932-non-upe-method-in-order-and-checkout
branch (this branch).New checkout experience
from the Stripe settings page.Add payment method page