Commit Graph
12 Commits
Author SHA1 Message Date
m3ta-chironandClaude Fable 5.2 34490db0ad fix(validator): make pdf_abgleich compare XML values with the PDF text
The check only recognized the English patterns "Invoice" and "Total:",
so it compared nothing on German invoices and always passed. It now
reports every key XML value (invoice number, net, VAT and gross total)
that does not appear in the PDF text, tolerant of number notation and
of columns running together in extracted text. Mismatches stay warnings.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 18:33:19 +01:00
m3ta-chironandClaude Fable 5.2 fa9eaa4f82 feat: extract due date and buyer reference, require it on XRechnung
- CII: due_date is read from the payment due date (BT-9) instead of the
  delivery terms description, normalized to YYYY-MM-DD
- new field buyer_reference (BT-10, the Leitweg-ID) for CII and UBL
- /validate accepts an optional profile; on XRECHNUNG_* profiles a
  missing buyer reference is a critical error (BR-DE-15)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 18:33:08 +01:00
m3ta-chironandClaude Fable 5.2 4ff994a299 feat(logging): honor the LOG_LEVEL environment variable
LOG_LEVEL was documented but never read; the level was fixed at INFO.
The JSON handler now sits on the "src" package logger so all service
modules share format and level. Invalid values fall back to INFO.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 18:32:58 +01:00
m3ta-chironandClaude Fable 5.2 7aa4506dd7 feat(extract): support plain XML invoices and UBL syntax
/extract now accepts all EN 16931 e-invoices, not only ZUGFeRD PDFs:

- plain XML files via the new xml_base64 field; XML sent as pdf_base64
  is detected from the content
- UBL 2.1 Invoice and CreditNote (XRechnung UBL, Peppol BIS Billing) via
  the new src/ubl_parser.py, also when embedded in a PDF
- new response field xml_syntax ("CII" or "UBL")
- CII invoice dates are normalized to YYYY-MM-DD, matching UBL
- XRechnung profiles are detected from the specification identifier,
  independent of the factur-x version (6.x reports them as EN16931)
- untrusted XML is parsed without entity or DTD resolution (XXE)

Fixtures: KoSIT XRechnung test-suite case 01.01a in CII and UBL.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 18:32:46 +01:00
m3ta-chironandClaude Fable 5.2 6126a19bb7 fix(validator): accept zero quantity on text-only line items
A line with quantity 0 was always reported as a missing required field.
Real invoices carry text-only positions (e.g. a delivery note reference)
with quantity 0 and line total 0. Quantity 0 is now an error only when
the line bills an amount.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-11 18:32:20 +01:00
m3ta-chiron fead1534c7 bd: update sync.remote 2026-11-11 18:21:05 +01:00
m3ta-chiron b2274894b5 bd init: initialize beads issue tracking 2026-11-11 18:14:23 +01:00
m3ta-chiron ccf8ad67fa feat(tests): fixture sweep, anonymized real-invoice regression corpus, CI
CI / docker (push) Canceled after 0s
CI / test (push) Canceled after 0s
- test_fixture_sweep: extract+validate every fixture PDF on every run;
  known extractor/validator gaps are catalogued explicitly and the sweep
  fails on any deviation from that catalogue
- tests/fixtures/real/: anonymized XML from real production invoices that
  revealed bugs (verified to contain no real-world data); first entry
  locks in the FC-tax-number/basis-quantity/spaced-VAT-ID regressions
- CI workflow: uv sync --frozen from lockfile + pytest + docker build
2026-09-11 16:06:27 +02:00
m3ta-chiron 0cf359d201 build(deps): upgrade factur-x to 6.8, commit lockfile and pin python 3.11
The venv had drifted (python 3.14 interpreter with python 3.13 packages)
because uv.lock was never committed. Lockfile is now tracked and CI syncs
from it with --frozen.
2026-09-11 16:06:13 +02:00
m3ta-chiron 7fcb3ff21d fix: extract tax number, price basis quantity, spaced VAT IDs and contact email
- supplier/buyer: extract FC tax registration (BT-32/BT-49) into new
  tax_number field; previously only VA (USt-IdNr.) was read
- pflichtfelder: critical error only when neither vat_id nor tax_number
  is present (EN 16931 BR-CO-26)
- ustid: tolerate formatting whitespace inside VAT IDs (e.g. 'DE 140 978 617')
- line items: normalize unit price by basis quantity (BT-149), so a
  price per 100 units no longer inflates line totals by factor 100
- supplier email: also look in DefinedTradeContact (BT-42)
- rewrite xrechnung fallback test to assert only our own behavior,
  independent of factur-x version specifics
2026-09-11 16:05:41 +02:00
m3ta-chiron e2e1d8c046 Allow zero-euro line item amounts 2026-06-03 07:52:52 +02:00
m3ta-chiron d497a4cb5b fix(extractor): detect xrechnung XML attachments 2026-05-21 14:45:20 +02:00