Restricted existing prices to those that are active (#15195)

Without this check, an inactive price in our database will just be
reactivated each time it is required. This can cause issues when
prices have been deleted.

By adding this constraint to the query, we will create a new price in
Stripe and our database when attempting to use an inactive price, this
is particularly useful when trying to fix problems caused by Stripe
prices being deleted.
This commit is contained in:
Fabien 'egg' O'Carroll 2022-08-08 16:18:07 +01:00 committed by GitHub
parent 67aa8d5956
commit 453f828aa7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -421,7 +421,8 @@ class ProductRepository {
amount: data.monthly_price.amount,
currency: data.monthly_price.currency,
type: 'recurring',
interval: 'month'
interval: 'month',
active: true
}, options);
let priceModel;
if (existingPrice) {
@ -468,7 +469,8 @@ class ProductRepository {
amount: data.yearly_price.amount,
currency: data.yearly_price.currency,
type: 'recurring',
interval: 'year'
interval: 'year',
active: true
}, options);
let priceModel;