Skip to content

Migrate ZUGFeRD, PEPPOL BIS 3.0 DE, Factur-X FR and Peppol BIS 3.0 FR to the V2 draft import pipeline - #9792

Open
Groenbech96 wants to merge 4 commits into
mainfrom
edoc/migrate-de-fr-formats-to-v2-draft
Open

Migrate ZUGFeRD, PEPPOL BIS 3.0 DE, Factur-X FR and Peppol BIS 3.0 FR to the V2 draft import pipeline#9792
Groenbech96 wants to merge 4 commits into
mainfrom
edoc/migrate-de-fr-formats-to-v2-draft

Conversation

@Groenbech96

@Groenbech96 Groenbech96 commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

What & why

The German ZUGFeRD and PEPPOL BIS 3.0 DE formats and the French Factur-X FR and Peppol BIS 3.0 FR formats had not been migrated to the V2 (draft) inbound import pipeline - they only implemented the legacy V1 GetBasicInfoFromReceivedDocument / GetCompleteInfoFromReceivedDocument path. Customers using them could not use Read into Draft -> Prepare draft -> Finish draft, the independently reversible stages, or Copilot-assisted line and G/L account matching.

E-Document Core is not touched by this PR. Everything lives in the localization apps.

E-Document for Germany

  • E-Document ZUGFeRD Handler implements IStructuredFormatReader (CII parsing) and IStructureReceivedEDocument / IStructuredDataType (lifting the embedded CII XML out of the ZUGFeRD PDF/A-3 container). It accepts either the PDF/A-3 file or plain CII XML.
  • New enum extension values: "E-Doc. Read into Draft"::ZUGFeRD and "Structure Received E-Doc."::ZUGFeRD.
  • E-Doc. PEPPOL BIS 3.0 DE Hdlr + "E-Doc. Read into Draft"::"PEPPOL BIS 3.0 DE", reusing the existing DE XRechnung UBL reader since both are CIUS of PEPPOL BIS Billing 3.0.
  • The DE BuyerReference / Leitweg-ID handling that only existed in the V1 path is carried across into a DE table extension field "Buyer Reference DE" on E-Document Purchase Header, populated by both DE readers. The V2 draft pages are marked Extensible = false, so the value is stored but not surfaced in the UI yet.
  • Selecting the ZUGFeRD or PEPPOL BIS 3.0 DE document format on an E-Document Service defaults Read into Draft Impl. accordingly.

E-Reporting FR

  • E-Document Factur-X Handler - same CII + PDF/A-3 design as ZUGFeRD, with "E-Doc. Read into Draft"::"Factur-X FR" and "Structure Received E-Doc."::"Factur-X FR".
  • E-Doc. Peppol BIS 3.0 FR Hdlr - UBL reader for invoices and credit notes with "E-Doc. Read into Draft"::"Peppol BIS 3.0 FR". The French party identifiers that InjectFrenchElements writes on export (SIRET in cac:PartyIdentification, cbc:EndpointID) are mapped back on import.
  • Same document-format defaulting of Read into Draft Impl..

Linked work

AB#644275, AB#644276, AB#644277, AB#644278

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome

  • E-Doc. DE Struct. Import Tests runs the real import pipeline for ZUGFeRD (invoice, credit memo, unsupported root element, re-run idempotency) and PEPPOL BIS 3.0 DE (invoice incl. Leitweg-ID), with new CII and UBL test resources.
  • E-Doc. FR Struct. Import Tests covers Factur-X (invoice, credit memo, unsupported root element, re-run idempotency) and Peppol BIS 3.0 FR (invoice incl. SIRET mapping, unsupported root element) by calling the readers directly, so the FR test app needs no new dependencies on core internals.
  • I could not compile or run the suite locally (no AL symbol packages in this environment), so please treat CI as the first full build/test signal.

Risk & compatibility

  • No changes to E-Document Core, so no impact on plain PDF, PEPPOL XML, XRechnung or OIOUBL flows.
  • Additive only: new codeunits, new enum extension values, and one DE table extension field. No obsoletions and no data upgrade.
  • ZUGFeRD/Factur-X delivered as plain CII XML flow through Already Structured and the service Draft Format. When they arrive as a PDF/A-3 file, Structure Data Impl. has to point at the new localization structuring value; the readers also accept the PDF blob directly as a fallback.
  • Transferring the DE buyer reference onto the created purchase invoice Your Reference is not included: V2 Finish Draft has no extension point for it today, and adding one would mean changing core.

… the V2 draft import pipeline

The German ZUGFeRD and PEPPOL BIS 3.0 DE formats and the French Factur-X and
Peppol BIS 3.0 FR formats only supported the legacy V1 single-step import, so
customers using them could not use the V2 draft experience.

Core:
- Add codeunit "E-Document CII Handler" (public) implementing IStructuredFormatReader
  for UN/CEFACT Cross Industry Invoice, shared by ZUGFeRD and Factur-X. It accepts
  either the plain CII XML or the PDF/A-3 container that embeds it.
- Add codeunit "E-Doc. Hybrid PDF Handler" implementing IStructureReceivedEDocument
  and IStructuredDataType. It lifts the embedded e-invoice XML out of a PDF/A-3
  container and falls back to MLLM extraction for plain PDFs, which is now the
  preferred structuring implementation for the PDF file format.
- Add "E-Document Purchase Header"."Buyer Reference", populated from PEPPOL
  cbc:BuyerReference and CII ram:BuyerReference, and carry it to Purchase Header
  "Your Reference" when the draft is finished.
- Make "E-Document PEPPOL Handler" public so localized apps can reuse it.

DE and FR apps:
- Add IStructuredFormatReader implementations and "E-Doc. Read into Draft" enum
  values for ZUGFeRD, PEPPOL BIS 3.0 DE, Factur-X FR and Peppol BIS 3.0 FR, and
  default the service "Read into Draft Impl." when the document format is selected.

Tests:
- Add structured import tests and CII/UBL test resources for all four formats.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Groenbech96
Groenbech96 requested review from a team July 28, 2026 11:10
@Groenbech96
Groenbech96 requested review from a team as code owners July 28, 2026 11:10
@github-actions github-actions Bot added AL: Apps (W1) Add-on apps for W1 Integration GitHub request for Integration area labels Jul 28, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 28, 2026
Reworks the migration of ZUGFeRD, PEPPOL BIS 3.0 DE, Factur-X FR and
Peppol BIS 3.0 FR so that E-Document Core is not touched at all.

- The CII (UN/CEFACT Cross Industry Invoice) reading and the PDF/A-3
  extraction now live in "E-Document ZUGFeRD Handler" (DE) and
  "E-Document Factur-X Handler" (FR). Each implements IStructuredFormatReader
  plus IStructureReceivedEDocument/IStructuredDataType and is registered
  through localization enum extensions of "E-Doc. Read into Draft" and
  "Structure Received E-Doc.".
- "E-Doc. Peppol BIS 3.0 FR Hdlr" implements the UBL reader in the FR app
  instead of relying on the core PEPPOL reader.
- The buyer reference (Leitweg-ID) is stored in a DE table extension field on
  "E-Document Purchase Header" instead of a new core field.
- Removes the core CII handler, the core hybrid PDF structuring, the core
  "Buyer Reference" field, the PDF file format default change and the core
  test updates.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot removed the AL: Apps (W1) Add-on apps for W1 label Jul 28, 2026
Magnus Hartvig Grønbech and others added 2 commits July 28, 2026 14:34
…ad the data storage blob without the internal helper

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Integration GitHub request for Integration area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant