/** * QR Payment Types */ import { Currency, QRItem, PayerInfo, PayoutInfo, ReturnDeeplink, PurchaseType, PaymentOption } from './common.types'; /** * Generate QR request parameters */ export interface GenerateQRRequest { /** Request timestamp in UTC format YYYYMMDDHHmmss */ req_time: string; /** Merchant ID */ merchant_id: string; /** Transaction ID */ tran_id: string; /** Transaction amount */ amount: number; /** Currency (USD or KHR) */ currency?: Currency; /** Items as Base64 encoded JSON string */ items?: string; /** Shipping amount */ shipping?: number; /** First name */ first_name?: string; /** Last name */ last_name?: string; /** Email */ email?: string; /** Phone number */ phone?: string; /** Purchase type */ purchase_type?: PurchaseType; /** Payment option (required) */ payment_option: PaymentOption; /** Return parameters as Base64 encoded JSON string */ return_params?: string; /** Shipping address */ shipping_address?: string; /** Callback URL as Base64 encoded string */ callback_url?: string; /** Continue success URL */ continue_success_url?: string; /** Return deeplink as Base64 encoded JSON string */ return_deeplink?: string; /** Custom fields as Base64 encoded JSON string */ custom_fields?: string; /** Payout as Base64 encoded JSON string */ payout?: string; /** QR lifetime in minutes (required) */ lifetime: number; /** QR image template (required) */ qr_image_template: string; /** HMAC SHA-512 hash */ hash: string; } /** * Simple QR creation options */ export interface CreateQROptions { /** Transaction amount */ amount: number; /** Currency (USD or KHR) */ currency?: Currency; /** Custom transaction ID (optional, auto-generated if not provided) */ tranId?: string; /** Array of items */ items?: QRItem[]; /** Payer information */ payer?: PayerInfo; /** Callback URL for payment notification */ callbackUrl?: string; /** Custom fields */ customFields?: Record; /** Return parameters */ returnParams?: Record; /** Payout distribution */ payout?: PayoutInfo[]; /** QR lifetime in minutes */ lifetime?: number; /** QR template */ template?: string; /** Purchase type */ purchaseType?: PurchaseType; /** Payment option */ paymentOption?: PaymentOption; /** Continue success URL */ continueSuccessUrl?: string; /** Return deeplink configuration */ returnDeeplink?: ReturnDeeplink; } /** * QR generation response */ export interface GenerateQRResponse { /** KHQR string for generating QR code */ qrString: string; /** Base64 encoded QR code image */ qrImage: string; /** ABA Pay deeplink for mobile payment */ abapay_deeplink: string; /** App Store link for ABA Mobile */ app_store: string; /** Play Store link for ABA Mobile */ play_store: string; /** Transaction amount */ amount: number; /** Currency */ currency: string; /** Response status */ status: { /** Status code ('0' = success) */ code: string; /** Status message */ message: string; /** Trace ID for debugging */ trace_id?: string; /** Transaction ID */ tran_id?: string; }; }