Add invoice payment management.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
keyhan
2026-05-18 21:34:47 +03:30
parent 880521c576
commit 8b197e69bc
15 changed files with 1616 additions and 58 deletions
+46 -1
View File
@@ -387,7 +387,10 @@ export interface TicketStats {
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 type TransactionType = 'charge' | 'deduction' | 'refund' | 'gateway_payment';
export type InvoiceStatus = 'draft' | 'issued' | 'partially_paid' | 'paid' | 'void' | 'failed';
export type PaymentMethod = 'wallet' | 'gateway' | 'mixed';
export type InvoiceReason = 'deploy' | 'renewal' | 'upgrade' | 'wallet_topup' | 'manual';
export interface PricingRateRow {
resourceType: PricingResourceType;
@@ -456,10 +459,52 @@ export interface WalletTransaction {
balanceAfter: number;
description?: string;
applicationId?: string;
invoiceId?: string;
invoice?: Invoice;
gatewayTrackingCode?: string;
walletId: string;
createdAt: string;
}
export interface InvoiceLine {
id: string;
invoiceId: string;
label: string;
description?: string;
quantity: number;
unitAmount: number;
amount: number;
metadata?: Record<string, any>;
createdAt: string;
}
export interface Invoice {
id: string;
invoiceNumber: string;
userId: string;
user?: User;
applicationId?: string;
application?: Application;
reason: InvoiceReason;
status: InvoiceStatus;
paymentMethod?: PaymentMethod;
subtotal: number;
total: number;
paidAmount: number;
dueAmount: number;
dueDate?: string;
paidAt?: string;
gatewayTrackingCode?: string;
gatewayReference?: string;
adminNote?: string;
statusReason?: string;
metadata?: Record<string, any>;
lines?: InvoiceLine[];
transactions?: WalletTransaction[];
createdAt: string;
updatedAt: string;
}
export interface OptionalServiceCyclePrices {
hourly: number;
monthly: number;