-
Notifications
You must be signed in to change notification settings - Fork 49
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: ensure migrated Stripe subs have next_payment scheduled #2434
Conversation
I could not confirm this. Running on |
Thanks for testing—that's interesting. In all cases when we ran the script in production without this change, every migrated subscription came in without a next payment date. Can you confirm that migrated subs still come in with a next payment date with this change? If so, I think we can safely merge. |
Yes, everything else worked fine |
## [1.114.1](v1.114.0...v1.114.1) (2023-05-10) ### Bug Fixes * ensure migrated Stripe subs have next_payment scheduled ([#2434](#2434)) ([b3b32f0](b3b32f0))
🎉 This PR is included in version 1.114.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
# [1.115.0-alpha.2](v1.115.0-alpha.1...v1.115.0-alpha.2) (2023-05-10) ### Bug Fixes * ensure migrated Stripe subs have next_payment scheduled ([#2434](#2434)) ([b3b32f0](b3b32f0))
🎉 This PR is included in version 1.115.0-alpha.2 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
Plugs a hole in the migration script for migrating Stripe subscriptions to WooCommerce. When programmatically creating subscriptions via code, Woo does not automatically schedule next payment dates—this must be done explicitly. This PR ensures this is done, and also implements a script to retroactively look up any previously migrated subscriptions and schedule next payment dates for any that are missing them.
Note that the scheduled next payment date won't always be in line with the start date of the subscription (e.g. if started April 3, the next payment would normally be May 3), but it should fall within 2 weeks of that date. This is because the calculate_date method is based on the current timetamp rather than the subscription's start date.We were able to get around this in d4978df by explicitly setting the scheduled date to the next payment date from Stripe.Also adds a
--force
flag to thesync-stripe-subscriptions-to-wc
script which will allow us to migrate Stripe subscriptions that were created via a migration from Pico.How to test the changes in this Pull Request:
master
orrelease
, set the Reader Revenue platform for your test site to "Stripe".wp newspack stripe sync-stripe-subscriptions-to-wc
via CLI to migrate the subscription to WooCommerce.wp newspack stripe set-next-payment-dates-for-migrated-subscriptions
.wp newspack stripe sync-stripe-subscriptions-to-wc
again and this time confirm that the migrated subscription is created with a scheduled next payment date.Other information: