Add prepaid resource credits with prorated deploy billing.
When users delete an app before plan expiry, remaining resources become credits for a new deploy. The deploy calculator shows covered vs additional charges, prices optional services correctly, and prorates extras to days left on the credit. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -144,6 +144,25 @@ export type DeploymentStatus =
|
||||
|
||||
export type AppLifecycleStatus = 'active' | 'suspended' | 'pending_deletion' | 'deleted';
|
||||
|
||||
export interface ResourceCredit {
|
||||
id: string;
|
||||
sourceAppName?: string;
|
||||
runtime: string;
|
||||
databaseType: string;
|
||||
cpuLimit: string;
|
||||
memoryLimit: string;
|
||||
replicas: number;
|
||||
dbStorageSize?: string;
|
||||
appStorageSize?: string;
|
||||
enableRedis: boolean;
|
||||
enableRabbitmq: boolean;
|
||||
enableElasticsearch: boolean;
|
||||
billingCycle?: string;
|
||||
expiresAt: string;
|
||||
remainingMs: number;
|
||||
remainingLabel: string;
|
||||
}
|
||||
|
||||
export interface Cluster {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -399,6 +418,25 @@ export interface CostBreakdown {
|
||||
breakdown: { label: string; hourly: number; monthly: number; yearly: number }[];
|
||||
}
|
||||
|
||||
export interface DeployExtraChargeLine {
|
||||
label: string;
|
||||
amount: number;
|
||||
fullPeriodAmount?: number;
|
||||
}
|
||||
|
||||
export interface DeployCostPreview extends CostBreakdown {
|
||||
cycle: BillingCycle;
|
||||
fullAmount: number;
|
||||
amountDue: number;
|
||||
coveredAmount: number;
|
||||
waivedAmount: number;
|
||||
extrasBreakdown: DeployExtraChargeLine[];
|
||||
creditApplied: ResourceCredit | null;
|
||||
prepaidCreditUsed: boolean;
|
||||
prorateRemainingDays?: number;
|
||||
proratePeriodDays?: number;
|
||||
}
|
||||
|
||||
// ─── Snapshot / Rollback types ──────────────────────
|
||||
|
||||
export type SnapshotType = 'pre_deploy' | 'manual';
|
||||
|
||||
Reference in New Issue
Block a user