Assist_Design/packages/shared/src/subscription.ts
tema ac259ce902 Enhance SIM management service with payment processing and API integration
- Implemented WHMCS invoice creation and payment capture in SimManagementService for top-ups.
- Updated top-up logic to calculate costs based on GB input, with pricing set at 500 JPY per GB.
- Simplified the Top Up Modal interface, removing unnecessary fields and improving user experience.
- Added new methods in WhmcsService for invoice and payment operations.
- Enhanced error handling for payment failures and added transaction logging for audit purposes.
- Updated documentation to reflect changes in the SIM management flow and API interactions.
2025-09-06 13:57:18 +09:00

71 lines
1.4 KiB
TypeScript

// Subscription types from WHMCS
import type { SubscriptionStatus } from "./status";
export type BillingCycle =
| "Monthly"
| "Quarterly"
| "Semi-Annually"
| "Annually"
| "Biennially"
| "Triennially"
| "One-time";
export interface Subscription {
id: number;
serviceId: number;
productName: string;
domain?: string;
cycle: BillingCycle;
status: SubscriptionStatus;
nextDue?: string; // ISO
amount: number;
currency: string;
currencySymbol?: string; // e.g., '¥', '¥'
registrationDate: string; // ISO
notes?: string;
customFields?: Record<string, string>;
// Additional WHMCS fields
orderNumber?: string;
groupName?: string;
paymentMethod?: string;
serverName?: string;
}
export interface SubscriptionList {
subscriptions: Subscription[];
totalCount: number;
}
export interface Product {
id: number;
name: string;
description?: string;
group: string;
pricing: ProductPricing[];
features?: string[];
configOptions?: ConfigOption[];
available: boolean;
}
export interface ProductPricing {
cycle: string;
price: number;
currency: string;
setup?: number;
}
export type ConfigOptionType = "dropdown" | "radio" | "quantity";
export interface ConfigOption {
id: number;
name: string;
type: ConfigOptionType;
options: ConfigOptionValue[];
}
export interface ConfigOptionValue {
id: number;
name: string;
price?: number;
}