/** * UBL XML Builder * * Converts our clean JSON invoice format to a Peppol BIS 3.0 UBL 2.1 structure. * Compliance still depends on the supplied business data; use `Peppol.toXml()` * for the SDK's blocking offline checks before generating XML. * * Reference: https://docs.peppol.eu/poacc/billing/3.0/ */ import type { InvoiceInput, CreditNoteInput, InvoiceLine, AllowanceCharge } from "../types/invoice.js"; /** @internal Stable, non-echoing input error used by `Peppol.toXml()`. */ export declare class UblBuilderInputError extends Error { readonly field: string; readonly ruleId?: string | undefined; constructor(message: string, field: string, ruleId?: string | undefined); } /** Peppol monetary rounding shared with the gateway mapper. */ export declare function roundUblCurrencyAmount(value: number): number; /** Monetary-only projection of an invoice / credit note — the fields that * determine the legal amount due. Party and routing data are irrelevant here. */ export interface UblMonetaryInput { lines: InvoiceLine[]; allowances?: AllowanceCharge[]; charges?: AllowanceCharge[]; prepaidAmount?: number; roundingAmount?: number; } /** The two distinct legal totals rendered in `cac:LegalMonetaryTotal`. */ export interface UblMonetaryAmounts { /** BT-112 — document total including VAT; prepaid/rounding do not change it. */ taxInclusiveAmount: number; /** BT-115 — amount due after prepaid amount and payable rounding. */ payableAmount: number; } /** * BT-112 and BT-115 from the same calculation used by the Invoice and CreditNote * XML builders. Consumers that need both totals must call this projection once, * rather than maintaining a second partial formula for the display amount. */ export declare function computeUblMonetaryAmounts(input: UblMonetaryInput): UblMonetaryAmounts; /** * BT-115 PayableAmount of the document — the legal amount due, integrating * line- and document-level allowances/charges, VAT, prepaid and rounding. * This is the SAME computation buildInvoiceXml/buildCreditNoteXml render into * cac:LegalMonetaryTotal, exposed so consumers (e.g. the getpeppr gateway's * settlement ledger, GPR-833) never re-derive the amount from a parallel * formula that would drift from the UBL on the network. */ export declare function computeUblPayableAmount(input: UblMonetaryInput): number; /** * Build a Peppol BIS 3.0 UBL 2.1 Invoice XML from a simple JSON input. * * This low-level builder does not run the full Peppol rulebook. Compliance is * conditional on the input (for example, BuyerReference or OrderReference is * required, and exempt VAT breakdowns need `taxExemptReason`). Prefer * `Peppol.toXml()` when blocking SDK validation is required before rendering. */ export declare function buildInvoiceXml(input: InvoiceInput): string; /** * Build a Peppol BIS 3.0 UBL 2.1 Credit Note XML. * Compliance is conditional on the business data; see `buildInvoiceXml`. * * Generates XML directly with correct CreditNote elements — no string replacement. */ export declare function buildCreditNoteXml(input: CreditNoteInput): string; //# sourceMappingURL=ubl-builder.d.ts.map