/** * Transaction Types */ /** * Transaction detail request parameters */ export interface TransactionDetailRequest { /** Request timestamp in UTC format YYYYMMDDHHmmss */ req_time: string; /** Merchant ID */ merchant_id: string; /** Transaction ID from the purchase */ tran_id: string; /** HMAC SHA-512 hash */ hash: string; } /** * Payment status code enum */ export declare enum PaymentStatusCode { /** Payment approved or pre-authorized */ APPROVED = 0, /** Payment pending */ PENDING = 2, /** Payment declined */ DECLINED = 3, /** Payment refunded */ REFUNDED = 4, /** Payment cancelled */ CANCELLED = 7 } /** * Payment status string */ export type PaymentStatus = 'APPROVED' | 'PRE-AUTH' | 'PENDING' | 'DECLINED' | 'REFUNDED' | 'CANCELLED'; /** * Card source type */ export type CardSource = 'ONUS' | 'OFFUS_DOMESTIC' | 'OFFUS_INTERNATIONAL' | ''; /** * Transaction operation in history */ export interface TransactionOperation { /** Operation status */ status: string; /** Operation amount */ amount: number; /** Operation date */ transaction_date: string; /** Bank reference */ bank_ref: string; } /** * Transaction detail data */ export interface TransactionDetailData { /** Transaction ID */ transaction_id: string; /** Payment status code */ payment_status_code: PaymentStatusCode; /** Payment status string */ payment_status: PaymentStatus; /** Original transaction amount before discount */ original_amount: number; /** Original transaction currency */ original_currency: string; /** Amount that customer paid */ payment_amount: number; /** Currency customer used */ payment_currency: string; /** Total amount */ total_amount: number; /** Refund amount */ refund_amount: number; /** Discount amount */ discount_amount: number; /** Approval code */ apv: string; /** Transaction date and time */ transaction_date: string; /** Customer first name */ first_name: string; /** Customer last name */ last_name: string; /** Customer email */ email: string; /** Customer phone */ phone: string; /** Bank reference number */ bank_ref: string; /** Payment type */ payment_type: string; /** Masked payer account */ payer_account: string; /** Bank name */ bank_name: string; /** Card source type */ card_source: CardSource; /** Transaction operations history */ transaction_operations: TransactionOperation[]; } /** * Transaction detail response */ export interface TransactionDetailResponse { /** Transaction detail data */ data: TransactionDetailData; /** Response status */ status: { /** Status code */ code: string; /** Status message */ message: string; /** Trace ID for debugging */ trace_id?: string; /** Transaction ID */ tran_id?: string; }; } /** * Get transaction detail options */ export interface GetTransactionDetailOptions { /** Transaction ID to retrieve details for */ tranId: string; } /** * Close transaction request parameters */ export interface CloseTransactionRequest { /** Request timestamp in UTC format YYYYMMDDHHmmss */ req_time: string; /** Merchant ID */ merchant_id: string; /** Original purchase transaction ID to close/cancel */ tran_id: string; /** HMAC SHA-512 hash */ hash: string; } /** * Close transaction response */ export interface CloseTransactionResponse { /** Response status */ status: { /** Status code: '00' = Success, '1' = Wrong Hash, '5' = Transaction not found, '26' = Invalid merchant profile */ code: string; /** Status message */ message: string; /** Cancelled transaction ID */ tran_id: string; }; } /** * Close transaction options */ export interface CloseTransactionOptions { /** Original purchase transaction ID to close/cancel */ tranId: string; } /** * Check transaction request parameters (for transactions within 7 days) */ export interface CheckTransactionRequest { /** Request timestamp in UTC format YYYYMMDDHHmmss */ req_time: string; /** Merchant ID */ merchant_id: string; /** Transaction ID to check */ tran_id: string; /** HMAC SHA-512 hash */ hash: string; } /** * Check transaction data (simplified response) */ export interface CheckTransactionData { /** Payment status code */ payment_status_code: PaymentStatusCode; /** Amount that customer paid after discount */ total_amount: number; /** Original purchase amount */ original_amount: number; /** Total of all refunded amount */ refund_amount: number; /** Discounted amount (follows original transaction currency) */ discount_amount: number; /** The amount that customer has paid */ payment_amount: number; /** The payment currency that the customer has paid */ payment_currency: string; /** Transaction approval code */ apv: string; /** Payment status */ payment_status: PaymentStatus; /** Date and time of the transaction created */ transaction_date: string; } /** * Check transaction response */ export interface CheckTransactionResponse { /** Transaction data */ data: CheckTransactionData; /** Response status */ status: { /** Status code: '00' = Success */ code: string; /** Status message */ message: string; /** Transaction ID */ tran_id: string; }; } /** * Check transaction options */ export interface CheckTransactionOptions { /** Transaction ID to check (must be within 7 days) */ tranId: string; } /** * Refund request parameters */ export interface RefundRequest { /** Request timestamp in UTC format YYYYMMDDHHmmss */ request_time: string; /** Merchant ID */ merchant_id: string; /** RSA encrypted merchant auth (Base64 encoded) */ merchant_auth: string; /** HMAC SHA-512 hash */ hash: string; } /** * Merchant auth data for refund (to be RSA encrypted) */ export interface RefundMerchantAuth { /** Merchant ID (same as merchant_id) */ mc_id: string; /** Transaction ID to refund */ tran_id: string; /** Amount to refund */ refund_amount: number; } /** * Refund response */ export interface RefundResponse { /** Grand total of original transaction */ grand_total: number; /** Total amount refunded so far */ total_refunded: number; /** Original currency of the transaction */ currency: string; /** Transaction status (REFUNDED) */ transaction_status: string; /** Response status */ status: { /** Status code: '00' = Success */ code: string; /** Status message */ message: string; }; } /** * Refund options */ export interface RefundOptions { /** Transaction ID to refund */ tranId: string; /** Amount to refund (can be partial) */ refundAmount: number; /** RSA public key for encryption */ rsaPublicKey: string; } /** * Transaction list request parameters */ export interface TransactionListRequest { /** Request timestamp in UTC format YYYYMMDDHHmmss */ req_time: string; /** Merchant ID */ merchant_id: string; /** Start date (YYYY-MM-DD HH:mm:ss) */ from_date?: string; /** End date (YYYY-MM-DD HH:mm:ss) */ to_date?: string; /** Minimum amount filter */ from_amount?: string; /** Maximum amount filter */ to_amount?: string; /** Status filter (comma-separated) */ status?: string; /** Page number (default: 1) */ page?: string; /** Records per page (default: 40, max: 1000) */ pagination?: string; /** HMAC SHA-512 hash */ hash: string; } /** * Transaction list item */ export interface TransactionListItem { /** Transaction ID */ transaction_id: string; /** Transaction date and time */ transaction_date: string; /** Approval code */ apv: string; /** Payment status */ payment_status: PaymentStatus; /** Payment status code */ payment_status_code: PaymentStatusCode; /** Original amount before discount */ original_amount: number; /** Original currency */ original_currency: string; /** Total amount after discount */ total_amount: number; /** Discount amount */ discount_amount: number; /** Refund amount */ refund_amount: number; /** Amount paid by customer */ payment_amount: number; /** Currency paid by customer */ payment_currency: string; /** Payer first name */ first_name: string; /** Payer last name */ last_name: string; /** Payer email */ email: string; /** Payer phone */ phone: string; /** Bank reference */ bank_ref: string; /** Payment type (ABA Pay, KHQR, VISA, etc.) */ payment_type: string; /** Masked account/card number */ payer_account: string; /** Bank name */ bank_name: string; /** Card source type */ card_source: CardSource; } /** * Transaction list response */ export interface TransactionListResponse { /** Array of transactions */ data: TransactionListItem[]; /** Current page */ page: string; /** Records per page */ pagination: string; /** Response status */ status: { /** Status code: '00' = Success */ code: string; /** Status message */ message: string; /** Request reference ID */ tran_id: string; }; } /** * Transaction list options */ export interface TransactionListOptions { /** Start date (YYYY-MM-DD HH:mm:ss or Date object) */ fromDate?: string | Date; /** End date (YYYY-MM-DD HH:mm:ss or Date object) */ toDate?: string | Date; /** Minimum amount */ fromAmount?: number; /** Maximum amount */ toAmount?: number; /** Status filter (array or comma-separated string) */ status?: PaymentStatus[] | string; /** Page number (default: 1) */ page?: number; /** Records per page (default: 40, max: 1000) */ pagination?: number; } /** * Complete pre-auth request parameters */ export interface CompletePreAuthRequest { /** Request timestamp in UTC format YYYYMMDDHHmmss */ request_time: string; /** Merchant ID */ merchant_id: string; /** RSA encrypted merchant auth (Base64 encoded) */ merchant_auth: string; /** HMAC SHA-512 hash of merchant_auth + request_time + merchant_id */ hash: string; } /** * Payout instruction for pre-auth completion */ export interface PreAuthPayout { /** ABA account or merchant ID */ acc: string; /** Payout amount */ amt: number; } /** * Merchant auth data for pre-auth completion (to be RSA encrypted) */ export interface CompletePreAuthMerchantAuth { /** Merchant ID (same as merchant_id) */ mc_id: string; /** Pre-auth transaction ID to complete */ tran_id: string; /** Amount to complete */ complete_amount: number; /** Optional payout instructions */ payout?: PreAuthPayout[]; } /** * Complete pre-auth response */ export interface CompletePreAuthResponse { /** Original amount authorized for pre-auth transaction */ grand_total: number; /** Original transaction currency */ currency: string; /** Transaction status (COMPLETED) */ transaction_status: string; /** Response status */ status: { /** * Status code: * '00' = Transaction successful * 'PTL02' = Invalid hash value * 'PTL04' = Parameter validation failed * 'PTL06' = Request expired * 'PTL36' = Invalid transaction * 'PTL62' = Invalid merchant information * 'PTL63' = No security configuration file * 'PTL59' = Unable to complete pre-authorization * 'PTL60' = Completion amount exceeds authorized limit * 'PTL61' = Invalid action type * 'PTL153' = Merchant with multiple settlement accounts not allowed * 'PTL157' = Unexpected error * 'PTL168' = Concurrent requests not allowed * 'PTL169' = Settlement account closed */ code: string; /** Status message */ message: string; }; } /** * Complete pre-auth options */ export interface CompletePreAuthOptions { /** Pre-auth transaction ID to complete */ tranId: string; /** Amount to complete (for card payments, can be up to 10% above original amount) */ completeAmount: number; /** RSA public key for encryption */ rsaPublicKey: string; /** Optional payout instructions for fund distribution */ payout?: PreAuthPayout[]; } /** * Cancel pre-auth request parameters */ export interface CancelPreAuthRequest { /** Request timestamp in UTC format YYYYMMDDHHmmss */ request_time: string; /** Merchant ID */ merchant_id: string; /** RSA encrypted merchant auth (Base64 encoded) */ merchant_auth: string; /** HMAC SHA-512 hash of merchant_id + merchant_auth + request_time */ hash: string; } /** * Merchant auth data for pre-auth cancellation (to be RSA encrypted) */ export interface CancelPreAuthMerchantAuth { /** Merchant ID (same as merchant_id) */ mc_id: string; /** Pre-auth transaction ID to cancel */ tran_id: string; } /** * Cancel pre-auth response */ export interface CancelPreAuthResponse { /** Original amount authorized for pre-auth transaction */ grand_total: number; /** Original transaction currency */ currency: string; /** Transaction status (CANCELLED) */ transaction_status: string; /** Response status */ status: { /** * Status code: * '00' = Success * 'PTL02' = Invalid hash provided * 'PTL04' = Parameter validation failed * 'PTL06' = Request expired * 'PTL36' = Invalid transaction * 'PTL59' = Unable to complete or cancel pre-auth * 'PTL60' = Pre-auth amount exceeds allowed limit * 'PTL61' = Invalid action type * 'PTL62' = Invalid merchant information * 'PTL63' = No security configuration file * 'PTL157' = Unexpected error * 'PTL168' = Concurrent requests not allowed * 'PTL169' = Settlement account closed * 'USD-NOT-ALLOW' = Amount not permitted * 'KHR-LESS-100' = KHR must be >= 100 * 'KHR-CONTAIN-DECIMAL' = KHR must be whole number */ code: string; /** Status message */ message: string; }; } /** * Cancel pre-auth options */ export interface CancelPreAuthOptions { /** Pre-auth transaction ID to cancel */ tranId: string; /** RSA public key for encryption */ rsaPublicKey: string; }