v0.1.4 — validation normalization, allowance amount guard, crypto guards
Patch release across all packages — correctness and error-model improvements (no breaking changes).
Highlights
- Allowance amount validation (fix).
amountSummarySchemanow enforcessalesAmount + taxAmount === totalAmounton allowances, not just invoices —allowance()rejects an inconsistent amount locally instead of sending it to the provider. - Normalized validation errors. Adapter input validation now rejects with an
InvoiceError(codeVALIDATION, with the provider name and offending field) instead of leaking a rawZodError, so every operation honors the SDK contract. (amego / ECPay / ezPay) - Clear crypto key/IV errors. A wrong-length
HashKey/HashIVnow throws a message naming the field and actual byte count, instead of an opaque NodecreateCipheriverror (ECPay 16/16, ezPay 32/16). InvoiceError.toJSON(). Structured logging keeps the normalized fields (code/rawCode/rawMessage) that a plainJSON.stringify(error)dropped.- New shared exports from
@paid-tw/einvoice:parseInput,parseTaipeiDate,taipeiDateTime,taxTypeToCode.
Under the hood (no API change)
- Build migrated from tsup → tsdown (rolldown); published outputs unchanged, verified with
attw+publint. - De-duplicated Taipei date helpers and the tax-type mapping into core.
- Extracted types/wire-maps out of the large ECPay/ezReceipt providers.
- Added MSW coverage for the tax-type wire mapping and the allowance amount guard.
All changes verified against the live provider sandboxes (Amego, ECPay, ezPay, ezPay cross-border, ezReceipt).
Versions
| Package | Version |
|---|---|
@paid-tw/einvoice |
0.3.2 |
@paid-tw/einvoice-amego |
0.3.2 |
@paid-tw/einvoice-ecpay |
0.3.2 |
@paid-tw/einvoice-ezpay |
0.3.2 |
@paid-tw/einvoice-ezpay-crossborder |
0.1.3 |
@paid-tw/einvoice-ezreceipt |
0.1.3 |