mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Fixed incomplete subscription flow (#341)
refs https://github.com/TryGhost/Team/issues/1156 Because we were only attempting to add the product to the members if the subscription was new AND active - we would not add it for incomplete subscriptions transitioning to active. Instead we always attempt to add the product to a member for an active subscription - it doesn't matter if it's a new one. We later have logic to filter out duplicate products if the member already has access to the product.
This commit is contained in:
parent
47ad10629e
commit
9e3136cdbc
1 changed files with 5 additions and 7 deletions
|
@ -625,15 +625,13 @@ module.exports = class MemberRepository {
|
||||||
} else {
|
} else {
|
||||||
status = 'paid';
|
status = 'paid';
|
||||||
}
|
}
|
||||||
if (!model) {
|
// This is an active subscription! Add the product
|
||||||
// This is a new subscription! Add the product
|
if (ghostProduct) {
|
||||||
if (ghostProduct) {
|
memberProducts.push(ghostProduct.toJSON());
|
||||||
memberProducts.push(ghostProduct.toJSON());
|
}
|
||||||
}
|
if (model) {
|
||||||
} else {
|
|
||||||
if (model.get('stripe_price_id') !== subscriptionData.stripe_price_id) {
|
if (model.get('stripe_price_id') !== subscriptionData.stripe_price_id) {
|
||||||
// The subscription has changed plan - we may need to update the products
|
// The subscription has changed plan - we may need to update the products
|
||||||
memberProducts.push(ghostProduct.toJSON());
|
|
||||||
|
|
||||||
const subscriptions = await member.related('stripeSubscriptions').fetch(options);
|
const subscriptions = await member.related('stripeSubscriptions').fetch(options);
|
||||||
const changedProduct = await this._productRepository.get({
|
const changedProduct = await this._productRepository.get({
|
||||||
|
|
Loading…
Add table
Reference in a new issue