M9 · Fatturazione elettronica (v0.9.0) #128

Merged
Alby96 merged 5 commits from feat/74-fatturazione-elettronica into main 2026-11-13 13:31:17 +01:00
Owner

M9 · Fatturazione elettronica (v0.9.0).

Closes #74
Closes #75
Closes #76
Closes #77
Closes #79
Closes #80
Closes #81

#78 (choice of the intermediaries, SdICoop accreditation) stays open: it waits for the owner.

What changes

  • FatturaPA file (#74, ADR 0039): FatturaPaWriter writes FPR12/FPA12/FSM10 v1.2 with SDI naming and a base-36
    progressive never reused; FatturaPaValidator repeats offline the SDI checks with the same error codes and the
    tolerances of specification 1.9.1, plus the structure against an embedded hand-written schema.
  • Notifications (#75): RC, NS, MC, NE, DT, AT, SE and MT read by the Italian pack, stored once and applied to
    the file and its document in the same transaction; manual import of XML, P7M and portal ZIPs; rejected invoices
    become editable again and get a new file; courtesy PDF with the XML embedded.
  • Channels (#76, #77, ADR 0040): PEC with in-house IMAP and MIME, SdICoop SOAP/MTOM with client certificate, two
    generic REST intermediaries, all behind IEInvoiceTransport; routing rules with fallback channel; einvoice.poll
    every 15 minutes; SdICoop push at POST /sdicoop/{company} authenticated by the channel key (mTLS on the reverse
    proxy).
  • Screens: SDI dashboard (mockup 058), channels and routing (059), received invoices, notifications,
    conservation packages; Home feed items for rejected and pending files.
  • Inbox and conservation (#79): supplier invoices from channels or uploads, registered through the purchase
    import; ZIP packages with SHA-256 index.
  • Demo data (#80): e-invoices in the demo company (paused PEC channel, no data reaches the SDI) and
    DemoDataRemover, driven by the schema of the migrations, with scripts/seed.sh --remove-demo.
  • Docs (#81): wiki Fatturazione elettronica rewritten as a complete guide with 9 screenshots; Dati di base e
    di esempio
    , Guida all'uso, Fiscalità italiana, Vendite, Acquisti, Attività programmate, Roadmap,
    Home, Changelog; ADR 0039 and 0040; MODULES.md, STATUS.md, CHANGELOG.md [0.9.0].

Notes

  • The XSD used for the structure check is written for Khaemhat: the official one was not downloaded (no downloads
    without the owner's permission). Swapping it in changes no code.
  • The courtesy PDF has the PDF/A-3 structure for the embedded file but does not claim PDF/A conformance.

Tests

851 tests green on SQLite (23 PostgreSQL tests skipped) and all 874 green on PostgreSQL 18 with a local container; scripts/check-packages.sh and scripts/gen-datamodel.sh --check OK.

🤖 Generated with Claude Code

M9 · Fatturazione elettronica (v0.9.0). Closes #74 Closes #75 Closes #76 Closes #77 Closes #79 Closes #80 Closes #81 #78 (choice of the intermediaries, SdICoop accreditation) stays open: it waits for the owner. ## What changes - **FatturaPA file** (#74, ADR 0039): `FatturaPaWriter` writes FPR12/FPA12/FSM10 v1.2 with SDI naming and a base-36 progressive never reused; `FatturaPaValidator` repeats offline the SDI checks with the same error codes and the tolerances of specification 1.9.1, plus the structure against an embedded hand-written schema. - **Notifications** (#75): RC, NS, MC, NE, DT, AT, SE and MT read by the Italian pack, stored once and applied to the file and its document in the same transaction; manual import of XML, P7M and portal ZIPs; rejected invoices become editable again and get a new file; courtesy PDF with the XML embedded. - **Channels** (#76, #77, ADR 0040): PEC with in-house IMAP and MIME, SdICoop SOAP/MTOM with client certificate, two generic REST intermediaries, all behind `IEInvoiceTransport`; routing rules with fallback channel; `einvoice.poll` every 15 minutes; SdICoop push at `POST /sdicoop/{company}` authenticated by the channel key (mTLS on the reverse proxy). - **Screens**: SDI dashboard (mockup 058), channels and routing (059), received invoices, notifications, conservation packages; Home feed items for rejected and pending files. - **Inbox and conservation** (#79): supplier invoices from channels or uploads, registered through the purchase import; ZIP packages with SHA-256 index. - **Demo data** (#80): e-invoices in the demo company (paused PEC channel, no data reaches the SDI) and `DemoDataRemover`, driven by the schema of the migrations, with `scripts/seed.sh --remove-demo`. - **Docs** (#81): wiki *Fatturazione elettronica* rewritten as a complete guide with 9 screenshots; *Dati di base e di esempio*, *Guida all'uso*, *Fiscalità italiana*, *Vendite*, *Acquisti*, *Attività programmate*, *Roadmap*, *Home*, *Changelog*; ADR 0039 and 0040; `MODULES.md`, `STATUS.md`, `CHANGELOG.md` [0.9.0]. ## Notes - The XSD used for the structure check is written for Khaemhat: the official one was not downloaded (no downloads without the owner's permission). Swapping it in changes no code. - The courtesy PDF has the PDF/A-3 structure for the embedded file but does not claim PDF/A conformance. ## Tests 851 tests green on SQLite (23 PostgreSQL tests skipped) and all 874 green on PostgreSQL 18 with a local container; `scripts/check-packages.sh` and `scripts/gen-datamodel.sh --check` OK. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Alby96 added this to the M9 — Fatturazione elettronica · v0.9.0 milestone 2026-11-13 13:24:52 +01:00
Alby96 added 5 commits 2026-11-13 13:24:53 +01:00
The Italian pack can now produce and check the e-invoice and talk to the SDI:
- FatturaPaWriter writes FPR12/FPA12 v1.2 with SDI file naming; FatturaPaValidator
  checks it against an embedded schema and the AdE semantic rules (official codes).
- SdiReceiptReader reads RC, NS, MC, NE, DT, AT, MT and SE notifications.
- The incoming-invoice model becomes the shared EInvoice* model, read and written.
- In-house ImapClient and MimeParser (no external libraries) back the PEC channel;
  SdICoop (SOAP/MTOM with client certificate) and two generic REST intermediaries
  sit behind the same IEInvoiceTransport contract, with fake-server tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds the company tables of the electronic invoice and the services that drive them:
the builder turns an issued document into the FatturaPA model, the service generates,
checks and sends the file through the channel chosen by the routing rules (with a
fallback) and applies the SDI notifications to the e-invoice and its document. The
channel settings keep their secrets protected and out of the audit trail; a job reads
the PEC mailbox and the intermediaries every 15 minutes, storing supplier invoices in
the inbox and acknowledging a message only once all its files are kept. The inbox
registers received invoices through the purchase import, and the conservation export
packs a period with a SHA-256 index. A rejected invoice can now be corrected and
generated again; the courtesy PDF embeds the XML.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The demo company now has its electronic invoices: a paused PEC channel and an
intermediary, routing rules, the files of the demo invoices with the notifications
the SDI would send (delivered, one rejected, one not delivered, some waiting) read
by the fiscal pack as real ones, and three supplier invoices in the inbox with their
metadata. Every demo seeder now marks as demo also the rows the services write for
it (entries, open items, payments, mandates, statements), so the new
DemoDataRemover, driven by the schema of the migrations, removes the demo data and
only them; it stops and names the tables when rows entered by users still refer to
demo rows. `scripts/seed.sh --remove-demo` exposes it and the seed prints its time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SDI dashboard (mockup 058) with its six counters, the documents to
generate, generate+send, manual receipts import, history, courtesy copy
and mark-as-sent; the channels page (mockup 059) with settings, test,
pause and routing rules; the received invoices, the notifications and
the conservation packages. The SdICoop web service receives pushes at
/sdicoop/{company}, authenticated by the key of the channel, through a
new IEInvoicePushReader feature so the web layer stays country-neutral.
The menu gives each e-invoice page its own permission and keeps the
intent declarations under M10.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
docs: e-invoicing guide, ADR 0039-0040 and 0.9.0 changelog (#81)
CI / Build and test (SQLite) (pull_request) Successful in 4m27s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / YAML check (pull_request) Successful in 7s
CI / Docker image (pull_request) Successful in 1m30s
246d6f9357
The wiki page "Fatturazione elettronica" becomes a complete guide for 0.9 with
nine screenshots of the real screens, and the pages that pointed to M9 now
describe what shipped (demo data and their removal, scheduled jobs, sales,
purchases, Italian tax rules, user guide). ADR 0039 records the e-invoice
design (file rows, progressive, offline checks with SDI codes and in-house
schema, notification dedup, safe polling, routing, SdICoop push with channel
key) and ADR 0040 the generic intermediary contracts and the schema-driven
removal of demo data. Screen polish: dashboard actions in the header, filters
on two rows, tables no longer squeezed, report titles and notification errors;
demo e-invoices get realistic send times and a rejection in the history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Alby96 merged commit 836a316b05 into main 2026-11-13 13:31:17 +01:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: BalboSoft/Khaemhat#128