UNPKG

ruch

Version:

Revolutionary React TypeScript CLI with hexagonal architecture & AI-powered development assistance. Create maintainable, scalable applications with domain-driven design and integrated AI tooling.

129 lines (115 loc) 2.52 kB
/** * Payment domain entities */ export interface Payment { id: string; orderId: string; userId: string; amount: number; currency: 'USD' | 'EUR' | 'GBP'; status: PaymentStatus; method: PaymentMethodType; provider: PaymentProvider; transactionId?: string; providerTransactionId?: string; metadata?: Record<string, any>; createdAt: string; updatedAt: string; processedAt?: string; failureReason?: string; } export type PaymentStatus = | 'pending' | 'processing' | 'succeeded' | 'failed' | 'cancelled' | 'refunded' | 'partially_refunded'; export type PaymentMethodType = | 'credit_card' | 'debit_card' | 'paypal' | 'apple_pay' | 'google_pay' | 'bank_transfer' | 'crypto'; export type PaymentProvider = | 'stripe' | 'paypal' | 'square' | 'braintree' | 'adyen'; export interface PaymentMethod { id: string; userId: string; type: PaymentMethodType; isDefault: boolean; isActive: boolean; details: PaymentMethodDetails; createdAt: string; updatedAt: string; } export interface PaymentMethodDetails { // Credit/Debit Card last4?: string; brand?: string; expiryMonth?: number; expiryYear?: number; country?: string; // PayPal email?: string; // Bank Transfer bankName?: string; accountType?: string; routingNumber?: string; accountLast4?: string; } export interface CreatePaymentData { orderId: string; amount: number; currency: 'USD' | 'EUR' | 'GBP'; paymentMethodId: string; description?: string; metadata?: Record<string, any>; } export interface ProcessPaymentData { paymentMethodId: string; amount: number; currency: 'USD' | 'EUR' | 'GBP'; confirmationToken?: string; cvv?: string; } export interface RefundData { paymentId: string; amount?: number; // If not provided, full refund reason?: string; } export interface PaymentIntent { id: string; amount: number; currency: 'USD' | 'EUR' | 'GBP'; status: 'requires_payment_method' | 'requires_confirmation' | 'succeeded' | 'failed'; clientSecret: string; metadata?: Record<string, any>; } export interface PaymentWebhook { id: string; type: string; data: Record<string, any>; provider: PaymentProvider; signature: string; processed: boolean; createdAt: string; } export interface PaymentStats { totalRevenue: number; totalTransactions: number; successRate: number; averageTransactionValue: number; currency: 'USD' | 'EUR' | 'GBP'; period: { start: string; end: string; }; }