mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-27 10:42:45 +03:00
Fixed comped members having a status of 'paid'
refs https://github.com/TryGhost/Team/issues/995 Since we reintroduced the comped status, we did not update the subscription handling to correctly set members to a status of comped when they were on a 'Complimentary' plan.
This commit is contained in:
parent
dbae9f3233
commit
b6e4eae272
@ -57,6 +57,10 @@ module.exports = class MemberRepository {
|
|||||||
return ['active', 'trialing', 'unpaid', 'past_due'].includes(status);
|
return ['active', 'trialing', 'unpaid', 'past_due'].includes(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isComplimentarySubscription(subscription) {
|
||||||
|
return subscription.plan.nickname && subscription.plan.nickname.toLowerCase() === 'complimentary';
|
||||||
|
}
|
||||||
|
|
||||||
async get(data, options) {
|
async get(data, options) {
|
||||||
if (data.customer_id) {
|
if (data.customer_id) {
|
||||||
const customer = await this._StripeCustomer.findOne({
|
const customer = await this._StripeCustomer.findOne({
|
||||||
@ -600,7 +604,11 @@ module.exports = class MemberRepository {
|
|||||||
const oldMemberProducts = member.related('products').toJSON();
|
const oldMemberProducts = member.related('products').toJSON();
|
||||||
let status = memberProducts.length === 0 ? 'free' : 'comped';
|
let status = memberProducts.length === 0 ? 'free' : 'comped';
|
||||||
if (this.isActiveSubscriptionStatus(subscription.status)) {
|
if (this.isActiveSubscriptionStatus(subscription.status)) {
|
||||||
|
if (this.isComplimentarySubscription(subscription)) {
|
||||||
|
status = 'comped';
|
||||||
|
} else {
|
||||||
status = 'paid';
|
status = 'paid';
|
||||||
|
}
|
||||||
if (!model) {
|
if (!model) {
|
||||||
// This is a new subscription! Add the product
|
// This is a new subscription! Add the product
|
||||||
if (ghostProduct) {
|
if (ghostProduct) {
|
||||||
|
Loading…
Reference in New Issue
Block a user