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:
parent
25a1f7d0b4
commit
c612b4d194
1 changed files with 12 additions and 4 deletions
|
@ -59,10 +59,18 @@ module.exports = class StripeMigrations {
|
||||||
|
|
||||||
let stripePlans = [];
|
let stripePlans = [];
|
||||||
for (const plan of uniquePlans) {
|
for (const plan of uniquePlans) {
|
||||||
const stripePlan = await this._StripeAPIService.getPlan(plan, {
|
try {
|
||||||
expand: ['product']
|
const stripePlan = await this._StripeAPIService.getPlan(plan, {
|
||||||
});
|
expand: ['product']
|
||||||
stripePlans.push(stripePlan);
|
});
|
||||||
|
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`);
|
this._logging.info(`Adding ${stripePlans.length} plans from Stripe`);
|
||||||
for (const stripePlan of stripePlans) {
|
for (const stripePlan of stripePlans) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue