Files
einfach-produktiv-invoicing/src/index.ts
T
Marco 63e3a02212 Phase 3: actual ZUGFeRD/Factur-X e-invoice generation
renderInvoiceEInvoice()/renderCorrectionInvoiceEInvoice() produce a
Factur-X-EN16931 hybrid PDF/A-3 (existing @react-pdf/renderer PDF +
embedded EN16931 XML) via @e-invoice-eu/core, instead of a plain PDF.
The plain renderInvoicePdf()/renderCorrectionInvoicePdf() stay unchanged
and are still what Live Preview uses — this only adds a post-processing
step for the actual send/download paths.

buildEInvoiceData()/buildCorrectionEInvoiceData() map InvoiceOrder/
CorrectionInvoiceOrder + InvoiceSeller into the library's raw UBL-shaped
Invoice object, reusing computeTaxBreakdown() for the tax math — one
implementation feeding both the human-readable and machine-readable side
of the same document. Verified end-to-end: rendered a sample invoice and
correction invoice, inflated the embedded XML stream out of the resulting
PDF/A-3 by hand (the library has no attachment-reading API to check
against), confirmed correct CrossIndustryInvoice XML, EN16931 guideline
reference, per-rate tax breakdown matching the order totals exactly, and
payment means with the IBAN from Phase 2 — not just "it didn't throw."

Found only through actually running it (not documented anywhere): every
EN16931 amount field requires a sibling `*@currencyID` key via the
library's runtime ajv validation, invisible in its TypeScript types.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-23 11:28:03 +00:00

19 lines
698 B
TypeScript

export { computeTaxBreakdown, type TaxBreakdownLine, type TaxBreakdownGroup } from "./taxBreakdown";
export { formatPrice, formatDate } from "./formatters";
export type { InvoiceSeller } from "./seller";
export {
InvoiceDocument,
renderInvoicePdf,
SAMPLE_INVOICE_ORDER,
type InvoiceItem,
type InvoiceOrder,
} from "./invoicePdf";
export {
renderCorrectionInvoicePdf,
type CorrectionInvoiceKind,
type CorrectionInvoiceItem,
type CorrectionInvoiceOrder,
} from "./correctionInvoicePdf";
export { renderInvoiceEInvoice, renderCorrectionInvoiceEInvoice } from "./einvoice/renderEInvoice";
export { buildEInvoiceData, buildCorrectionEInvoiceData } from "./einvoice/buildEInvoiceData";