feat: billing system — service plans, wallet, cost calculation
- Backend: billing module with ServicePlan, PricingRule, Wallet, WalletTransaction entities - Admin can CRUD service plans with hourly/monthly/yearly billing cycles - Each plan has flexible pricing rules (base_fee, cpu, memory, storage, db addon) - Wallet system: auto-created per user, charge, deduct, refund, transaction history - Cost calculation endpoint: cross-cycle conversion (hourly*720=monthly, monthly*12=yearly) - Frontend: admin billing management page (/dashboard/admin/billing) - Frontend: user wallet page with balance, quick-charge, transaction history - Deploy page: cost breakdown shown in Review step (hourly/monthly/yearly) - Navigation: Wallet link for users, Billing Plans link for admins
This commit is contained in:
@@ -60,3 +60,23 @@ export enum BuildStatus {
|
||||
SUCCESS = 'success',
|
||||
FAILED = 'failed',
|
||||
}
|
||||
|
||||
export enum BillingCycle {
|
||||
HOURLY = 'hourly',
|
||||
MONTHLY = 'monthly',
|
||||
YEARLY = 'yearly',
|
||||
}
|
||||
|
||||
export enum PricingResourceType {
|
||||
BASE_FEE = 'base_fee', // Base fee per runtime type
|
||||
CPU_PER_CORE = 'cpu_per_core', // Price per CPU core
|
||||
MEMORY_PER_GB = 'memory_per_gb', // Price per GB RAM
|
||||
STORAGE_PER_GB = 'storage_per_gb', // Price per GB disk
|
||||
DATABASE_ADDON = 'database_addon', // Price for database addon
|
||||
}
|
||||
|
||||
export enum TransactionType {
|
||||
CHARGE = 'charge', // Top-up / deposit
|
||||
DEDUCTION = 'deduction', // Payment for service
|
||||
REFUND = 'refund', // Refund
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user