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:
keyhan
2026-05-15 18:10:54 +03:30
parent 5239e8aa94
commit 35235fe0fc
15 changed files with 1293 additions and 716 deletions
+20 -16
View File
@@ -375,25 +375,17 @@ export type BillingCycle = 'hourly' | 'monthly' | 'yearly';
export type PricingResourceType = 'base_fee' | 'cpu_per_core' | 'memory_per_gb' | 'storage_per_gb' | 'database_addon' | 'redis_addon' | 'rabbitmq_addon' | 'elasticsearch_addon' | 'custom_domain_addon';
export type TransactionType = 'charge' | 'deduction' | 'refund';
export interface PricingRule {
id: string;
export interface PricingRateRow {
resourceType: PricingResourceType;
unitPrice: number;
description?: string;
planId: string;
createdAt: string;
hourlyPrice: number;
monthlyPrice: number;
yearlyPrice: number;
isActive?: boolean;
}
export interface ServicePlan {
id: string;
name: string;
runtime: 'nodejs' | 'laravel' | 'wordpress';
description?: string;
billingCycle: BillingCycle;
isActive: boolean;
pricingRules: PricingRule[];
createdAt: string;
updatedAt: string;
export interface PricingCatalog {
runtimes: Record<'nodejs' | 'laravel' | 'wordpress', PricingRateRow[]>;
addons: PricingRateRow[];
}
export interface WalletBalance {
@@ -411,6 +403,18 @@ export interface WalletTransaction {
createdAt: string;
}
export interface OptionalServiceCyclePrices {
hourly: number;
monthly: number;
yearly: number;
}
export interface OptionalServicesPricing {
redis: OptionalServiceCyclePrices;
rabbitmq: OptionalServiceCyclePrices;
elasticsearch: OptionalServiceCyclePrices;
}
export interface CostBreakdown {
hourly: number;
monthly: number;