UNPKG

ynkap-payment

Version:

Module de paiement Y-Nkap pour Angular - Intégration simple des paiements mobiles (Orange Money, MTN Mobile Money)

161 lines (160 loc) • 3.6 kB
/** * Interface for Payment Method */ export interface PaymentMethod { /** * Unique identifier for the payment method */ id: string; /** * Name of the payment method (e.g., 'Mobile Money', 'Card', 'Bank Transfer') */ name: string; /** * Provider of the payment method (e.g., 'MTN', 'Orange', 'Visa', 'MasterCard') */ provider: string; /** * Icon URL for the payment method */ iconUrl?: string; /** * Status of the payment method ('enabled' or 'disabled') */ status: 'enabled' | 'disabled'; /** * Fee percentage for this payment method (if applicable) */ feePercentage?: number; /** * Fixed fee amount for this payment method (if applicable) */ fixedFee?: number; } /** * Interface for Payment Transaction */ export interface PaymentTransaction { /** * Unique identifier for the transaction */ id: string; /** * Reference code for the transaction */ reference: string; /** * Merchant reference for the transaction (from the original payment request) */ merchantReference: string; /** * Amount of the transaction */ amount: number; /** * Currency of the transaction (default: XAF - Central African CFA franc) */ currency: string; /** * Payment method used for the transaction */ paymentMethod?: PaymentMethod; /** * ID of the payment method used for the transaction */ paymentMethodId: string; /** * Description of the transaction */ description?: string; /** * Date when the transaction was created */ createdAt: Date; /** * Date when the transaction was updated */ updatedAt: Date; /** * Status of the transaction ('pending', 'completed', 'failed', 'cancelled') */ status: 'pending' | 'completed' | 'failed' | 'cancelled'; /** * Additional metadata for the transaction */ metadata?: Record<string, any>; /** * Error message in case the transaction failed */ errorMessage?: string; } /** * Interface for Payment Request */ export interface PaymentRequest { /** * Amount to be paid */ amount: number; /** * Currency of the amount (default: XAF - Central African CFA franc) */ currency?: string; /** * Description of the payment */ description?: string; /** * Reference for the payment from the merchant system */ merchantReference?: string; /** * URL to redirect after successful payment */ successUrl?: string; /** * URL to redirect after cancelled payment */ cancelUrl?: string; /** * URL for webhook notifications */ webhookUrl?: string; /** * Customer information */ customer?: { name?: string; email?: string; phone?: string; }; /** * Additional metadata for the payment */ metadata?: Record<string, any>; } /** * Interface for Payment Response */ export interface PaymentResponse { /** * Status of the payment ('success', 'pending', 'failed') */ status: 'success' | 'pending' | 'failed'; /** * Message related to the payment status */ message: string; /** * Transaction details if available */ transaction?: PaymentTransaction; /** * Error details if the payment failed */ error?: { code: string; message: string; details?: any; }; }