0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Ignored missing plans on Stripe for update

refs https://github.com/TryGhost/Team/issues/591

It's possible to have sites which still have subscriptions in their DB from old Stripe accounts, most likely added when we allowed Stripe Direct, as those subscriptions were not cleaned up. While populating plans and products for existing subscriptions, we want to ignore these old subscriptions which are not part of current Stripe account.
This commit is contained in:
Rish 2021-04-22 11:49:08 +05:30
parent 25a1f7d0b4
commit c612b4d194

View file

@ -59,10 +59,18 @@ module.exports = class StripeMigrations {
let stripePlans = [];
for (const plan of uniquePlans) {
try {
const stripePlan = await this._StripeAPIService.getPlan(plan, {
expand: ['product']
});
stripePlans.push(stripePlan);
} catch (err) {
if (err && err.statusCode === 404) {
this._logging.warn(`Plan ${plan} not found on Stripe - ignoring`);
} else {
throw err;
}
}
}
this._logging.info(`Adding ${stripePlans.length} plans from Stripe`);
for (const stripePlan of stripePlans) {