-
Notifications
You must be signed in to change notification settings - Fork 33
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
Remove delayed change payment meta on new change payment requests #709
Remove delayed change payment meta on new change payment requests #709
Conversation
Possibly a separate issue and for another PR, but I found a flow where User has two subscriptions A and B:
My concern is that it looks like I don't have Paypal set up in my local, but I do see it using that function here. |
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.
Described a related issue in the comments, but I think this is good to ship as it fixes the issue described. 🚢
Thanks for the very thorough review @annemirasol!
Good catch! My initial thoughts were that I'm wasn't too concerned with other subscriptions retaining the The PayPal Reference transactions code calling While I didn't see any issues with the stale To test these latest changes I ran through the following steps:
|
@@ -434,6 +438,9 @@ public static function update_all_payment_methods_from_subscription( $subscripti | |||
continue; | |||
} | |||
|
|||
// Clear any stale _delayed_update_payment_method_all meta existing on the users other subscriptions if it exists. | |||
$user_subscription->delete_meta_data( '_delayed_update_payment_method_all' ); |
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.
Subscription will be saved in the follow up update_payment_method()
call or if not there, down further on line 447. No need to call save here.
Because I've made a small change since your last approval, would you mind giving it a quick look over again? 😄 Thanks @annemirasol ! |
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 the detailed explanation of the behavior, and for adding the meta cleanup!
Changes LGTM, and everything tests out well
@@ -434,6 +438,9 @@ public static function update_all_payment_methods_from_subscription( $subscripti | |||
continue; | |||
} | |||
|
|||
// Clear any stale _delayed_update_payment_method_all meta existing on the users other subscriptions if it exists. | |||
$user_subscription->delete_meta_data( '_delayed_update_payment_method_all' ); | |||
|
|||
self::update_payment_method( $user_subscription, $new_payment_method, $payment_meta_table ); |
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.
Routing Num:041215663
Account Num: 547128355559
Related: woocommerce/woocommerce-gateway-stripe#3539 (comment)
Description
While addressing Stripe deferred intent support for the Subscriptions Change Payment feature (Stripe PR#3539), we identified an issue where abandoned Change Payment requests would leave the '_delayed_update_payment_method_all' meta on the subscription. This causes subsequent Change Payment requests where the user has opted to update all of their subscriptions to be ignored.
For instance, if you have 2 subscriptions with 4242 card and then initiate a request to change payment all subscriptions to Cash App, but never complete it, all future requests to update all subscriptions to another card
5555555555554444
will not update all of your subscriptions.This PR fixes this issue by ensuring the '_delayed_update_payment_method_all' meta is deleted at the start of each new Change Payment request. This prevents stale meta from interfering with future requests.
How to test this PR
trunk
of subscriptions-core, purchase two separate subscriptions using a standard 4242 card (if you don't already have multiple subscriptions)5555555555554444
and again, make sure the "use this for all my subscriptions" checkbox is checked5555555555554444
after first attempting to update to Cash AppProduct impact