/** * Payout Types * Types for ABA PayWay Funds Route API */ import { Currency } from './common.types'; /** * Beneficiary information for payout */ export interface PayoutBeneficiary { /** Account number or Merchant ID - can be either ABA account # or MID */ account: string; /** Amount to payout to this beneficiary */ amount: number; } /** * Payout request parameters */ export interface PayoutRequest { /** A unique merchant key provided by ABA Bank */ merchant_id: string; /** Unique transaction id (max 20 characters) */ tran_id: string; /** Encrypted payout beneficiaries information */ beneficiaries: string; /** Total payout amount (sum of all beneficiary amounts) */ amount: number; /** Transaction currency (USD or KHR) */ currency: Currency; /** Additional field information as JSON string (optional, max 255 characters) */ custom_fields?: string; /** HMAC SHA-512 hash */ hash: string; } /** * Payout options for creating a payout transaction */ export interface PayoutOptions { /** Unique transaction ID (optional, will be auto-generated if not provided) */ tranId?: string; /** Array of beneficiaries with account/MID and amount */ beneficiaries: PayoutBeneficiary[]; /** Total payout amount (sum of all beneficiary amounts) */ amount: number; /** Transaction currency (USD or KHR) */ currency: Currency; /** Custom fields object (optional) */ customFields?: Record; /** RSA Public Key provided by ABA Bank for encryption */ rsaPublicKey: string; } /** * Payout beneficiary response */ export interface PayoutBeneficiaryResponse { /** A unique id generated by payment gateway */ payout_id?: string; /** Beneficiary name */ name?: string; /** Identifier of the beneficiary (MID or ABA account #) */ mid_acccount?: string; /** Payout amount */ amount?: number; /** Payout currency (follows transaction currency) */ currency?: string; } /** * Payout status codes */ export declare enum PayoutStatusCode { /** Success */ SUCCESS = "0", /** Duplicated Transaction ID */ DUPLICATED_TRANSACTION = "4", /** Something went wrong. Try again or contact the merchant for help */ GENERIC_ERROR = "11", /** Cannot decrypt data */ CANNOT_DECRYPT = "24", /** Allow maximum 10 beneficiaries per request */ MAX_BENEFICIARIES_EXCEEDED = "25", /** Invalid Merchant Profile */ INVALID_MERCHANT_PROFILE = "26", /** Payout account or amount is invalid */ INVALID_PAYOUT_INFO = "36", /** Payout accounts are not in whitelist */ NOT_IN_WHITELIST = "37", /** Purchase amount has reached transaction limit */ TRANSACTION_LIMIT_REACHED = "44", /** Something went wrong with requested parameters */ INVALID_PARAMETERS = "48", /** Total purchase amount has reached daily limit */ DAILY_LIMIT_REACHED = "70", /** Payment Rejected! */ PAYMENT_REJECTED = "79", /** Custom fields invalid */ CUSTOM_FIELDS_INVALID = "80", /** Total amount must be greater than 0 */ AMOUNT_MUST_BE_POSITIVE = "81", /** Invalid transaction currency (only USD or KHR supported) */ INVALID_CURRENCY = "82", /** Transaction is duplicated */ TRANSACTION_DUPLICATED = "83", /** Unable to access merchant's account details */ MERCHANT_ACCOUNT_INACCESSIBLE = "84", /** Transaction currency does not match merchant's currency */ CURRENCY_MISMATCH = "85", /** Unable to debit merchant's account */ DEBIT_FAILED = "86", /** Unable to retrieve beneficiary's account details (first error) */ BENEFICIARY_ACCOUNT_ERROR_1 = "87", /** Unable to retrieve beneficiary's MID details */ BENEFICIARY_MID_ERROR = "88", /** Unable to retrieve beneficiary's account details (second error) */ BENEFICIARY_ACCOUNT_ERROR_2 = "89", /** Currencies for merchant and beneficiary do not align */ CURRENCY_ALIGNMENT_ERROR = "90", /** Unable to credit beneficiary's account */ CREDIT_FAILED = "91", /** Total payout amount does not match total transaction amount */ AMOUNT_MISMATCH = "92", /** Insufficient balance */ INSUFFICIENT_BALANCE = "93", /** Bad request */ BAD_REQUEST = "400", /** Total purchase amount has reached daily limit (LAM01) */ LAM01 = "LAM01", /** Total purchase amount has reached monthly limit (LAM02) */ LAM02 = "LAM02" } /** * Payout status response */ export interface PayoutStatus { /** Status code */ code?: string; /** Status message */ message?: string; /** Unique transaction ID passed from merchant */ tran_id?: string; /** Unique ID generated by payment gateway for tracing issues */ trace_id?: string; } /** * Payout response */ export interface PayoutResponse { /** Unique transaction ID passed from merchant */ transaction_id?: string; /** The approved date and time of the transaction */ transaction_date?: string; /** Unique reference booking entry number from core banking system */ external_reference?: string; /** Random 6-digit number generated by payment gateway */ apv?: string; /** Total transaction amount */ transaction_amount?: number; /** Transaction currency */ transaction_currency?: string; /** Array of beneficiaries with payout details */ beneficiaries?: PayoutBeneficiaryResponse[]; /** Status information */ status?: PayoutStatus; }