ข้ามไปยังเนื้อหา

thai-qr-payment

Version 1.0.0

Minor Changes

  • 7ae8f9d Thanks @uunw! - Close the feature parity gap with reference Thai QR libraries. New surface:

    • parsePayload(payload, { strict }) — opt-in strict CRC mode throws on a missing or mismatched checksum tag. Default stays backwards-compatible.
    • Truncated-CRC auto-fix — non-strict parses now recover payloads whose CRC was clipped to 1–3 hex chars (some Thai banking apps emit these). The parsed result exposes a crc: { value, valid, truncated } bookkeeping field so callers can warn on the source app’s bug.
    • Raw tag accessors on ParsedPayloadgetTag(id) and getTagValue(id, subId?) let callers read unknown / future TLV tags without re-parsing. The full rawTags list is also exposed.
    • TrueMoney Wallet QRThaiQrPaymentBuilder.trueMoney(mobileNo, { amount, message }) plus parser support for the matching wire format. UTF-16BE personal-message tag 81 round-trips through encodePersonalMessage / decodePersonalMessage.
    • Slip Verify Mini-QRbuildSlipVerify / parseSlipVerify for the slip-verify envelope (root tag 00, country 51, CRC tag 91 — different from a payment QR). Used by bank Open APIs to look up transactions after slip OCR.
    • TrueMoney Slip VerifybuildTrueMoneySlipVerify / parseTrueMoneySlipVerify, including the lowercase-CRC quirk that TrueMoney emits.
    • BOT 1D BarcodebuildBotBarcode / parseBotBarcode for the \r-delimited counter-payment barcode scanned at bank tellers and 7-Eleven counters. Not EMVCo TLV — a separate wire format entirely.

    Bundle impact: payload package 3.09 KB → 4.65 KB brotli (still inside the 5 KB budget). The payloadFor-only entrypoint grew 2.98 → 4.48 KB because class methods aren’t tree-shaken; budget bumped 4 → 5 KB to match.

  • 5a5a62e Thanks @uunw! - Close the second feature parity gap (vs promptpay-js). Four new wire-format surfaces:

    • .bankAccount(bankCode, accountNo) — PromptPay credit transfer to a bank account (sub-tag 04 under tag 29). Adds 'bankAccount' to PromptPayRecipientType. Parser exposes optional bankCode + accountNo on the parsed merchant.
    • .ota(otaCode) — One-Time Authorization PromptPay credit transfer (sub-tag 05, fixed 10 chars). Builder swaps the merchant AID from A000000677010111 to A000000677010114 so scanners route the payload through the single-use flow. Parser surfaces the OTA code on ParsedPromptPay.ota.
    • .vatTqrc({ sellerTaxBranchId, vatRate?, vatAmount }) — VAT TQRC (top-level tag 80). Turns a regular PromptPay payment QR into a Bank-of-Thailand-Tax-Qualified-QR-Code source for e-tax-receipt integrations. Parser exposes vatTqrc on ParsedPayload.
    • .billPayment({ ..., crossBorder: true }) — cross-border bill payment (ASEAN PayNow / DuitNow / QRIS interop). Same tag-30 envelope, different AID (A000000677012006). Parser flags ParsedBillPayment.crossBorder: boolean. The 18-char purposeOfTransaction triple (currencyCode + localAmount + countryCode) round-trips opaquely.

    Bundle impact: @thai-qr-payment/payload 4.65 → 5.37 KB brotli; sub-path entry 4.61 → 5.33 KB; payloadFor-only entry 4.48 → 5.20 KB. All three budgets bumped 5 → 6 KB to absorb the new class methods (which don’t tree-shake).