Build order and mapping notes
| Phase | Parser family | Formats it covers | Mapping notes |
|---|---|---|---|
| 1 | ubl |
Peppol BIS 3 + self-billing, XRechnung UBL, NLCIUS, CIUS-RO, CIUS-PT, HR-CIUS, OIOUBL 3, UBL.BE, PINT, BIS 2 (best-effort), OIOUBL 2 | One parser, profile-specific rules on top. Invoice vs CreditNote element names differ (InvoicedQuantity/CreditedQuantity). UBL 2.1 CreditNote has no root cbc:DueDate: read cac:PaymentMeans/cbc:PaymentDueDate, and accept a root cbc:DueDate only as a fallback with a warning (it appears in some XRechnung test files). |
| 1 | cii |
Factur-X/ZUGFeRD 2.x all profiles, XRechnung CII, NLCIUS CII, France CII | D16B and D22B share the root namespace. MINIMUM/BASIC WL have no lines. |
| 2 | fatturapa |
FatturaPA, semplificata | Child elements are unqualified (no namespace). Several FatturaElettronicaBody per file. Natura → VAT category, RT0x → withholdings, cassa previdenziale → charge + extensions.it. SdI ID from the separate metadata file. Done: see src/parsers/fatturapa.ts (FPR12/FPA12 and FSM10; TD04/TD08 are credit notes; split payment → totals.splitPaymentVat; bollo → otherTaxes + extensions.it.stampDuty). |
| 2 | ksef |
FA(2), FA(3), FA_RR | P_12 rate codes (23, zw, oo, np I, 0 WDT…) → VAT category. P_14_xW = VAT in PLN. StanPrzed → correctionState. Podmiot3 + Rola → additionalParties. KSeF number from download metadata. |
| 2 | facturae |
Facturae 3.2–3.2.2 | Batches (Modality L). TaxesWithheld → withholdings, recargo → otherTaxes. XAdES signature inside. |
| 2 | isdoc, ebinterface, finvoice, e-arve, eslog |
National formats in active B2B use | ISDOC symbols → extensions.cz; ebInterface varies by version; Finvoice: SOAP + ISO-8859-15; e-arve: several invoices per file; eSLOG uses EDIFACT segment names (S_BGM, G_SG26…). |
| 3 | svefaktura, zugferd1, teappsxml, mydata, cfdi |
Legacy and low-volume (cfdi is Mexican, see above) |
Svefaktura follows SFTI’s “Mapping of Svefaktura 1.0 onto EN 16931-1” (see src/parsers/svefaktura.ts). |
Done: ubl, cii, svefaktura and fatturapa. Corrective documents whose direction depends on the amounts (KSeF KOR, Facturae rectificativa, ISDOC) must set kind from the sign of the correction total; see effectiveSign() in src/canonical.ts.