diff --git a/api/src/billing/billing.service.ts b/api/src/billing/billing.service.ts index 68741b5..265b03f 100644 --- a/api/src/billing/billing.service.ts +++ b/api/src/billing/billing.service.ts @@ -51,15 +51,16 @@ export class BillingService { }) .populate('plan') - let plan = null - - if (!subscription) { - plan = await this.planModel.findOne({ name: 'free' }) - } else { - plan = await this.planModel.findById(subscription.plan) + if (subscription) { + return subscription } - return plan + const plan = await this.planModel.findOne({ name: 'free' }) + + return { + plan, + isActive: true, + } } async getCheckoutUrl({ diff --git a/web/app/(app)/dashboard/(components)/account-settings.tsx b/web/app/(app)/dashboard/(components)/account-settings.tsx index c802557..1166d50 100644 --- a/web/app/(app)/dashboard/(components)/account-settings.tsx +++ b/web/app/(app)/dashboard/(components)/account-settings.tsx @@ -270,7 +270,7 @@ export default function AccountSettings() {
Quota
- {currentSubscription?.quota} + {currentSubscription?.plan?.quota}
- {currentSubscription?.dailyLimit === -1
+ {currentSubscription?.plan?.dailyLimit === -1
? 'Unlimited'
- : currentSubscription?.dailyLimit}
- {currentSubscription?.dailyLimit === -1 && (
+ : currentSubscription?.plan?.dailyLimit}
+ {currentSubscription?.plan?.dailyLimit === -1 && (
- {currentSubscription?.monthlyLimit === -1
+ {currentSubscription?.plan?.monthlyLimit === -1
? 'Unlimited'
- : currentSubscription?.monthlyLimit.toLocaleString()}
- {currentSubscription?.monthlyLimit === -1 && (
+ : currentSubscription?.plan?.monthlyLimit?.toLocaleString()}
+ {currentSubscription?.plan?.monthlyLimit === -1 && (
Bulk
- {currentSubscription?.bulkSendLimit === -1
+ {currentSubscription?.plan?.bulkSendLimit === -1
? 'Unlimited'
- : currentSubscription?.bulkSendLimit}
- {currentSubscription?.bulkSendLimit === -1 && (
+ : currentSubscription?.plan?.bulkSendLimit}
+ {currentSubscription?.plan?.bulkSendLimit === -1 && (