promptparse
Version:
All-in-one JS library for PromptPay & EMVCo QR Codes
73 lines (66 loc) • 2.43 kB
TypeScript
/**
* Validate & extract data from BCEL OneProof QR
*
* @param payload - QR Code Payload
* @returns Type, Ticket No. and Reference No. or null if payload invalid
*/
declare function bcelOneProof(payload: string): {
type: string | undefined;
ticket: string | undefined;
fccref: string | undefined;
} | null;
/**
* Validate & extract data from PromptPay AnyID (Tag 29) QR Code
*
* @param payload - QR Code Payload
* @returns Proxy type, target identifier and optional amount or null if payload invalid
*/
declare function anyId(payload: string): {
amount?: number | undefined;
type: "MSISDN" | "NATID" | "EWALLETID" | "BANKACC";
target: string;
} | null;
/**
* Validate & extract data from PromptPay Bill Payment (Tag 30) QR Code
*
* @param payload - QR Code Payload
* @returns Biller ID, references and optional amount or null if payload invalid
*/
declare function billPayment(payload: string): {
amount?: number | undefined;
ref3?: string | undefined;
ref2?: string | undefined;
billerId: string;
ref1: string;
} | null;
/**
* Validate & extract data from Slip Verify QR (for use with Bank Open API)
*
* @param payload - QR Code Payload
* @param crcAutoFix - Attempt to fix bad checksum from bank app
* @returns Bank code and Transaction reference or null if payload invalid
*/
declare function slipVerify(payload: string, crcAutoFix?: boolean): {
sendingBank: string;
transRef: string;
} | null;
/**
* Validate & extract data from TrueMoney Slip Verify QR
*
* @param payload - QR Code Payload
* @returns Type, Transaction ID and Date (DDMMYYYY) or null if payload invalid
*/
declare function trueMoneySlipVerify(payload: string): {
eventType: string | undefined;
transactionId: string | undefined;
date: string | undefined;
} | null;
declare const index_anyId: typeof anyId;
declare const index_bcelOneProof: typeof bcelOneProof;
declare const index_billPayment: typeof billPayment;
declare const index_slipVerify: typeof slipVerify;
declare const index_trueMoneySlipVerify: typeof trueMoneySlipVerify;
declare namespace index {
export { index_anyId as anyId, index_bcelOneProof as bcelOneProof, index_billPayment as billPayment, index_slipVerify as slipVerify, index_trueMoneySlipVerify as trueMoneySlipVerify };
}
export { anyId as a, bcelOneProof as b, billPayment as c, index as i, slipVerify as s, trueMoneySlipVerify as t };