-
Notifications
You must be signed in to change notification settings - Fork 202
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 manual renewal subscriptions that use SEPA when disabling the Legacy experience #3139
Conversation
…pdated SEPA tokens
includes/migrations/class-wc-stripe-subscriptions-legacy-sepa-tokens-migrator.php
Outdated
Show resolved
Hide resolved
With this change, the subscription meta for flagging that the migration took place won't skip the migration. Also, we're including the check for whether the Updated checkout experience is enabled into the method that would trigger an exception when the migration is skipped, so the reason gets logged.
@james-allan , |
* | ||
* This class extends the WCS_Background_Repairer for scheduling and running the individual migration actions. | ||
*/ | ||
class WC_Stripe_Subscriptions_Legacy_SEPA_Token_Update { |
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.
I'm separating the logic for updating the token from the background repairer class to be reused in the woocommerce_scheduled_subscription_payment
action. Planning to do that in a separate PR.
Nah, not a blocker.
Yeah that sounds like a good idea, this PR is tough to test so it would be good to move those additional things off to separate PRs. |
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.
The changes tested well again today. I left a minor comment but I'm approving this PR as it's not blocking and it would be good to progress this further.
includes/compat/class-wc-stripe-subscriptions-legacy-sepa-token-update.php
Outdated
Show resolved
Hide resolved
@a-danae I also wanted to flag that after the payment method is migrated, I tried to renew the subscription, however I got this error from Stripe. What I think is causing that is we're using the payment intents API to try collect a payment with a src payment method. But I'm not 100% sure. Just wanted to flag so you were aware. |
It could also have something to do with the fact that my |
…n-update.php Co-authored-by: James Allan <james.allan@automattic.com>
Summarizing here the pending items mentioned in the review that will be addressed separately:
|
Are there any you want some help with @a-danae? |
I'm a little scared to try it actually. Is there a way to launch the migrator on 4 ou 5 subscriptions and see if it's working on production before launching it globally ? |
That'd be great! I'm creating issues for these points now so we can distribute them. Big thanks @james-allan !
@agenceKanvas sure, it makes sense to test with a few of them first. We don't have a way to control them right now, but adding a filter when retrieving the items to repair would do the trick; it'd allow merchants to control this if needed and it would be an easy addition. @james-allan happy to go differently if you disagree! Thinking of adding a filter to the return value of get_items_to_update() |
We'd need to be careful not to set the option that then prevented it from running for the remaining subscriptions or I guess we could just include a note that after running you're test you need to delete the option to trigger it to run for the remaining ones. |
@a-danae , I've tried the testing scenario on my staging site and the wc_stripe_schedule_subscriptions_legacy_sepa_token_repairs did not appear (v8.5.0-test). |
@agenceKanvas if you have access to run code directly, something like this will kick it off. $logger = wc_get_logger();
$updater = new WC_Stripe_Subscriptions_Repairer_Legacy_SEPA_Tokens( $logger );
$updater->schedule_repair(); Important Once you run it, you will want to remove this code because you don't want multiple instances of the |
Hey @agenceKanvas, just a heads up that Stripe 8.5.1 is out and contains this fix, so you can use that instead of the test release in GH. |
Hi @a-danae !
|
Hi there @agenceKanvas ! Glad to hear the meta was updated as expected Not sure if you got this sorted, but just in case...
The date wouldn't be updated as we only change the payment-related meta for the migration. Have you encountered any issues with payment renewal dates having passed? We also hook the migration on renewals, so if it's on Manual renewal and the renewal date comes, the payment will go through and the payment method will be updated for upcoming renewals. |
Fixes #3133
Changes proposed in this Pull Request:
stripe_sepa
gateway ID) to be migratedThis isn't needed to fix the problem, but doing it for consistency for the shoppers. Assuming it could be strange for shoppers to see an active subscription but no tokens.
stripe_sepa_debit
gateway ID.This is what fixes the actual problem
Testing instructions
ℹ️ Since 8.2.0, legacy SEPA payment methods aren't attached to the customer for some reason. Check out 8.1.0 to add legacy SEPA payment methods if you want to test processing renewals. I'll create an issue to check this out.
Setup
wp-admin/admin.php?page=wc-settings&tab=checkout§ion=stripe&panel=methods
Create subscriptions with the Legacy SEPA gateway
/my-account/add-payment-method/
Find test IBAN numbers here.
AT611904300234573201
,DE89370400440532013000
,EE382200221020145685
You'll need to use the shortcode checkout. Legacy SEPA doesn't show up in Blocks
/wp-admin/admin.php?page=wc-orders--shop_subscription&action=edit&id=< sub ID >
At this point:
stripe_sepa
under thepayment_method
columnstripe_sepa
gateway IDSee the issue
At this point:
stripe_sepa
) is disabledstripe_sepa_debit
) is enabled insteadConfirm the right subscriptions are queued to be updated - actually testing the fix now
wc_stripe_schedule_subscriptions_legacy_sepa_token_repairs
This action will schedule a new action for each subscription that needs to be updated
wc_stripe_schedule_subscriptions_legacy_sepa_token_repairs
doesn't get scheduled for laterwc_stripe_subscriptions_legacy_sepa_token_repair
Confirm the subscriptions' payment method gets updated
wc_stripe_subscriptions_legacy_sepa_token_repair
wp-admin/admin.php?page=wc-status&tab=logs
, confirm that there are entries for each subscription that was updatedWhat we're doing for each subscription:
stripe_sepa_debit
tokens for the user that owns the subscription.WC_Payment_Tokens::get_customer_tokens()
, we create tokens using the Updated SEPA gateway (stripe_sepa_debit
) from the Legacy tokens (stripe_sepa
), over herepayment_method
of the subscription, fromstripe_sepa
tostripe_sepa_debit
, which matches the gateway ID of the Updated SEPA gatewayUnhappy paths
changelog.txt
andreadme.txt
(or does not apply)Post merge