Replace billing plans with per-runtime usage pricing catalog.
Store explicit hourly/monthly/yearly rates in pricing_rates and addon_rates, compute deploy costs without cycle conversion, and simplify admin UI and wallet payment to cycle-only. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -57,7 +57,6 @@ export class AppLifecycleService implements OnModuleInit, OnModuleDestroy {
|
||||
async activateApp(
|
||||
appId: string,
|
||||
billingCycle: BillingCycle,
|
||||
planId: string,
|
||||
planExpiresAt?: Date,
|
||||
): Promise<Application> {
|
||||
const app = await this.appRepo.findOne({ where: { id: appId } });
|
||||
@@ -68,7 +67,6 @@ export class AppLifecycleService implements OnModuleInit, OnModuleDestroy {
|
||||
? planExpiresAt
|
||||
: this.calculateExpiry(now, billingCycle);
|
||||
|
||||
app.planId = planId;
|
||||
app.billingCycle = billingCycle;
|
||||
app.lifecycleStatus = AppLifecycleStatus.ACTIVE;
|
||||
app.planExpiresAt = expiresAt;
|
||||
@@ -225,7 +223,7 @@ export class AppLifecycleService implements OnModuleInit, OnModuleDestroy {
|
||||
// ─── Auto-renew for hourly plans ──────────────────────────────────
|
||||
|
||||
private async tryAutoRenew(app: Application): Promise<boolean> {
|
||||
if (!app.planId) return false;
|
||||
if (!app.billingCycle) return false;
|
||||
|
||||
try {
|
||||
const cost = await this.billingService.calculateCostForApp(app);
|
||||
|
||||
Reference in New Issue
Block a user