BCApps icon indicating copy to clipboard operation
BCApps copied to clipboard

[Bug]: Inbound German e-documents are accepted without validating mandatory EN 16931 fields

Open ADO-BST opened this issue 3 months ago • 2 comments

Describe the issue

When an inbound German electronic invoice is imported into Business Central, mandatory data elements required by EN 16931 are not consistently validated.

If mandatory information is missing or invalid, the document can still be imported and stored. Missing values may be mapped to empty fields without a validation error, warning, or clear indication that the document is not compliant.

This affects inbound ZUGFeRD and XRechnung documents.

Expected behavior

Business Central should validate inbound German electronic invoices against the applicable EN 16931 requirements and the relevant ZUGFeRD/XRechnung business rules.

If a mandatory element is missing or invalid, Business Central should:

  • reject the document or clearly set it to an invalid/error status;
  • display a meaningful validation message;
  • identify the affected EN 16931 business term or field;
  • prevent the document from being treated as a valid inbound e-document.

Steps to reproduce

  1. Create or obtain a German ZUGFeRD or XRechnung invoice.
  2. Remove or invalidate a mandatory EN 16931 element, for example:
    • BT-1: Invoice number
    • BT-2: Invoice issue date
    • BT-5: Invoice currency code
    • BT-44: Buyer name
    • BG-23: VAT breakdown
    • BT-112 / BT-115: Invoice totals
  3. Import the document as an inbound e-document in Business Central.
  4. Process or open the imported e-document.
  5. Observe that the document is accepted or stored without an appropriate validation error.

Additional context

This issue is related to the previously reported issue: https://github.com/microsoft/ALAppExtensions/issues/30263

The issue concerns inbound validation. Existing validation logic appears to be used primarily in the outbound/send scenario and is not consistently applied when receiving German e-documents.

I will NOT Proviide a fix for a bug. I Open the issue for @djukicmilica

I will provide a fix for a bug

  • [x] I will provide a fix for a bug

ADO-BST avatar Aug 10 '26 12:08 ADO-BST

:robot: AI triage completed. Product group, please validate the triage report (Microsoft internal access only, use Ctrl+Click to open in new tab).


Was this triage helpful? React with :thumbsup: or :thumbsdown: on this comment to provide feedback.

github-actions[bot] avatar Aug 10 '26 12:08 github-actions[bot]

One observation on the reproduction steps, because it changes what a fix has to prove.

The listed cases (BT-1, BT-2, BT-5, BT-44, BG-23, BT-112/BT-115) are all presence violations. Those are the ones most likely to be caught by whatever validation does exist, since a missing element often trips schema cardinality or a simple null check before any business rule runs. The class that tends to survive is the document that is schema-valid, complete, and arithmetically wrong:

  • BR-CO-15 — Invoice total amount with VAT (BT-112) must equal Invoice total amount without VAT (BT-109) + Invoice total VAT amount (BT-110).
  • BR-CO-16 — Amount due for payment (BT-115) must equal BT-112 − Paid amount (BT-113) + Rounding amount (BT-114).

Every element is present, so nothing is "missing" to detect; only a Schematron-level calculation check fails. If inbound validation is added for the presence cases only, this issue can be closed while the more damaging class — a document that posts clean but carries the wrong payable amount — still imports silently.

There is a second one specific to ZUGFeRD/Factur-X. The applicable rule set is selected by the guideline identifier in BT-24, and a document may declare EXTENDED, EN 16931 (COMFORT), or a national CTC profile. If the inbound path picks its rule set before reading BT-24 — or defaults to one — it will validate real documents against rules that do not apply to them, in both directions: false rejections and false acceptances. This is not hypothetical; a closely related BT-24 profile-selection regression is open right now at invopop/gobl.cii#79.

The practical consequence for testing: a corpus of valid documents that pass proves nothing here. What proves the gate closes is the inverse — one deliberately invalid document per rule, each with a recorded expectation that it must be rejected, and a test that fails if it is accepted. A positive-only suite reports green on exactly the defect this issue describes.

Happy to contribute such a negative-control corpus for the German profiles (ZUGFeRD/XRechnung) as test data if that would be useful — public, no strings. Disclosure so it is on the record: I do this commercially (EN 16931 / Peppol BIS conformance testing at Jithox), so treat the offer accordingly; the two observations above stand on their own either way.

— Victor, Jithox

victor-emmanuel-c avatar Aug 26 '26 16:08 victor-emmanuel-c