v0.2.0 — structured e-Factura authoring
✍️ anafpy can now author CIUS-RO invoices from scratch — no upstream invoicing system required.
Until now, e-Factura outbound was XML pass-through only: bring the complete
UBL XML your invoicing software exported. This release adds a second,
first-class path for callers with no upstream system of their own —
structured authoring (anafpy.efactura.authoring):
- One bidirectional flat model,
InvoiceDocument, covers both invoices and
credit notes (kindpicks the render target), with computed totals and
VAT breakdown (explicit overrides preserved). - A hand-translated EN 16931 + CIUS-RO rule set (
validate()) returns
findings tagged with officialBR-*rule ids — ANAF's ownvalidare
endpoint stays authoritative; this is a local, informational pre-check. - Byte-stable round-trips:
render_invoice/read_invoice/parse_invoice. - Wired into
EFacturaClient.upload_invoice(flat model → XML → upload) and
the MCP server's two-step gated filing tools (efactura_prepare_invoice→
efactura_submit), alongside the existing XML pass-through tools. - The e-Factura inbox now reads downloads through the same strict
read_invoice:DownloadedMessage.viewnever raises —Nonewhen the
content isn't representable, with raw bytes and the full UBL model as the
fallback tiers. - A live-suite CIUS-RO drift tripwire files a minimal invoice via the
authoring path and cross-checks localvalidate()verdicts against ANAF's
ownvalidare, so a future CIUS-RO revision announces itself.
As with everything in anafpy, the durable record of a filed invoice is the
caller's responsibility — ANAF's SPV purges filed messages after ~60 days;
it is not invoice storage. XML pass-through remains the strongly recommended
path whenever an upstream invoicing system already produces the document.
Install: pip install anafpy · pip install 'anafpy[mcp]'
Docs: https://anafpy.readthedocs.io/en/latest/library/authoring/