Skip to content

Commit 6f1fdda

Browse files
committed
show retired plans for user who still have them
1 parent a280566 commit 6f1fdda

1 file changed

Lines changed: 32 additions & 1 deletion

File tree

OpenFlow/src/public/Controllers.ts

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3392,9 +3392,25 @@ export class PaymentCtrl extends entityCtrl<Billing> {
33923392
if (stripeplan.metadata.openflowuser == "true") {
33933393
this.openflowplans.push(stripeplan);
33943394
}
3395-
if (stripeplan.metadata.supportplan == "true") {
3395+
else if (stripeplan.metadata.supportplan == "true") {
33963396
this.supportplans.push(stripeplan);
33973397
}
3398+
else if (this.stripe_customer && this.stripe_customer.subscriptions && this.stripe_customer.subscriptions.data) {
3399+
3400+
const hasit = this.stripe_customer.subscriptions.data.filter(s => {
3401+
const arr = s.items.data.filter(y => y.plan.id == stripeplan.id);
3402+
if (arr.length == 1) {
3403+
if (arr[0].quantity > 0) {
3404+
return true;
3405+
}
3406+
}
3407+
return false;
3408+
});
3409+
3410+
if (hasit.length > 0) this.supportplans.push(stripeplan);
3411+
3412+
}
3413+
33983414
}
33993415
}
34003416
for (let y = 0; y < this.supportplans.length; y++) {
@@ -3405,6 +3421,21 @@ export class PaymentCtrl extends entityCtrl<Billing> {
34053421
this.supporthoursplans.push(stripeplan);
34063422
(supportplan as any).subplan = stripeplan;
34073423
}
3424+
else if (this.stripe_customer && this.stripe_customer.subscriptions && this.stripe_customer.subscriptions.data) {
3425+
const hasit = this.stripe_customer.subscriptions.data.filter(s => {
3426+
const arr = s.items.data.filter(y => y.plan.id == stripeplan.id);
3427+
if (arr.length == 1) {
3428+
if (arr[0].quantity > 0) {
3429+
return true;
3430+
}
3431+
}
3432+
return false;
3433+
});
3434+
3435+
if (hasit.length > 0) this.supporthoursplans.push(stripeplan);
3436+
3437+
}
3438+
34083439
}
34093440

34103441
}

0 commit comments

Comments
 (0)