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

Removed use of 'comped' status for Members

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

With the new system of Custom Products, the concept of Complimentary is
not longer a thing, and will instead be handled by explicitly creating
prices with no amount. This means that the 'comped' status for members
will be replaced with 'paid'.
This commit is contained in:
Fabien O'Carroll 2021-04-20 17:44:31 +01:00
parent 3beb1b21e7
commit 25d3d42427

View file

@ -41,10 +41,6 @@ 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({
@ -381,11 +377,7 @@ module.exports = class MemberRepository {
let status = 'free'; let status = 'free';
let memberProducts = []; let memberProducts = [];
if (this.isActiveSubscriptionStatus(subscription.status)) { if (this.isActiveSubscriptionStatus(subscription.status)) {
if (this.isComplimentarySubscription(subscription)) { status = 'paid';
status = 'comped';
} else {
status = 'paid';
}
try { try {
if (ghostProduct) { if (ghostProduct) {
memberProducts.push(ghostProduct.toJSON()); memberProducts.push(ghostProduct.toJSON());
@ -410,12 +402,7 @@ module.exports = class MemberRepository {
this._logging.error(`Failed to attach products to member - ${data.id}`); this._logging.error(`Failed to attach products to member - ${data.id}`);
this._logging.error(e); this._logging.error(e);
} }
const isComplimentary = subscription.get('plan_nickname') && subscription.get('plan_nickname').toLowerCase() === 'complimentary'; status = 'paid';
if (status === 'comped' || isComplimentary) {
status = 'comped';
} else {
status = 'paid';
}
} }
} }
} }