-
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
Supply correct payment method instance to process_redirect_payment #6170
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: 0 B Total Size: 1.1 MB ℹ️ View Unchanged
|
…ub.com/Automattic/woocommerce-payments into fix/5854-use-correct-payment-method-id
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.
Tested with a few different LPMs and all the metadata appears to be lining up now: transaction details look correct, with the correct order details and payment method details, and I was unable to produce the well-known and dreaded "application_fee_amount" error message.
Changes LGTM. It's worth noting that for now, the parent function UPE_Payment_Gateway::set_payment_method_title_for_order
is still required for some payment flows with the split-UPE, but when the deferred intent UPE reaches fully operational parity, we will need to remove it.
But that'll be a story for another day. For today, let's .
Unfortunately your order cannot be processed as the originating bank/merchant has declined your transaction. Please attempt your purchase again. Quickteller Business Payment Gateway |
Fixes #5854, Fixes #5781
Changes proposed in this Pull Request
The crux of the the problem here is an early return in
process_redirect_payment
. It's this early return that prevents the UPE payment intent from being removed from the session, causing the issue described in #5781.UPE_Split_Payment_Gateway
extendsUPE_Payment_Gateway
and overridesget_selected_payment_method
to redefine the logic with a simple check against$this->stripe_id
. The problem is that$this->stripe_id
is alwayscard
due to hooks in the parent class resetting the stripe id for it's own uses. So redirect payment methods such asgiropay
are always compared tocard
and we returnfalse
. That's fine as that's whatUPE_Payment_Gateway
needs andUPE_Split_Payment_Gateway
doesn't need thestripe_id
at this point in the execution. We really only need an instance of the payment method which we can get from theupe_payment_method_map
viaWC_Payments::get_payment_method_by_id()
.Testing
The goal is to test that
process_redirect_payment
fully completes. This would mean thatremove_upe_intent_from_session()
runs as well, which covers testing for both #5854 and #5781. Testing with Xdebug breakpoints has been problematic because the hooks that initiate this process fire multiple times, making it confusing as to whats actually occurring. I've found it best to just useLogger::log()
to ensure the process completes.Logger::log( 'process_redirect_payment has completed' )
wp_woocommerce_sessions table
. This will ensure noupe_payment_intent
is present yet.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