mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Added past_due
and unpaid
subscriptions for members (#1740)
refs https://github.com/TryGhost/Ghost/issues/12256, https://github.com/TryGhost/Ghost/issues/12255 Currently when listing subscriptions for Members in both the Admin and the Theme, we only show the subscriptions which have a status of trialing or active. Based on discussion, the `unpaid` and `past_due` states on Stripe also represent owner's intention of considering a subscription as active instead of `cancelled`, so we allow any subscriptions under these 2 states to be also listed for a member and consider them as `paid`. This updates Admin to consider those subscriptions as active as well. - Subscriptions will go into a past_due state if the payment is missed, this should be considered a grace period where the member still has access. - After this the subscriptions will either go to the unpaid or the cancelled state - this can be configured on an account by account basis in the Stripe dashboard. `unpaid` is considered as an intention to keep the subscription to allow for re-activation later.
This commit is contained in:
parent
38fa62001a
commit
2edb7226e1
3 changed files with 4 additions and 2 deletions
|
@ -168,7 +168,7 @@
|
||||||
{{#if subscription.cancelAtPeriodEnd}}
|
{{#if subscription.cancelAtPeriodEnd}}
|
||||||
<span class="gh-member-cancels-on-label">Cancels on {{subscription.validUntil}}</span>
|
<span class="gh-member-cancels-on-label">Cancels on {{subscription.validUntil}}</span>
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="gh-member-stripe-status">{{subscription.status}}</span>
|
<span class="gh-member-stripe-status">{{subscription.statusLabel}}</span>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -33,12 +33,14 @@ export default Component.extend({
|
||||||
let subscriptions = this.member.get('stripe');
|
let subscriptions = this.member.get('stripe');
|
||||||
if (subscriptions && subscriptions.length > 0) {
|
if (subscriptions && subscriptions.length > 0) {
|
||||||
return subscriptions.map((subscription) => {
|
return subscriptions.map((subscription) => {
|
||||||
|
const statusLabel = subscription.status === 'past_due' ? 'Past due' : subscription.status;
|
||||||
return {
|
return {
|
||||||
id: subscription.id,
|
id: subscription.id,
|
||||||
customer: subscription.customer,
|
customer: subscription.customer,
|
||||||
name: subscription.name || '',
|
name: subscription.name || '',
|
||||||
email: subscription.email || '',
|
email: subscription.email || '',
|
||||||
status: subscription.status,
|
status: subscription.status,
|
||||||
|
statusLabel: statusLabel,
|
||||||
startDate: subscription.start_date ? moment(subscription.start_date).format('D MMM YYYY') : '-',
|
startDate: subscription.start_date ? moment(subscription.start_date).format('D MMM YYYY') : '-',
|
||||||
plan: subscription.plan,
|
plan: subscription.plan,
|
||||||
amount: parseInt(subscription.plan.amount) ? (subscription.plan.amount / 100) : 0,
|
amount: parseInt(subscription.plan.amount) ? (subscription.plan.amount / 100) : 0,
|
||||||
|
|
|
@ -25,7 +25,7 @@ export default ModalComponent.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
let firstActiveStripeSubscription = subscriptions.find((subscription) => {
|
let firstActiveStripeSubscription = subscriptions.find((subscription) => {
|
||||||
return subscription.status === 'active' || subscription.status === 'trialing';
|
return ['active', 'trialing', 'unpaid', 'past_due'].includes(subscription.status);
|
||||||
});
|
});
|
||||||
|
|
||||||
return firstActiveStripeSubscription !== undefined;
|
return firstActiveStripeSubscription !== undefined;
|
||||||
|
|
Loading…
Add table
Reference in a new issue