Skip to content

E invoice profiles - #8

Open
embewee wants to merge 7 commits into
masterfrom
e-invoice-profiles
Open

E invoice profiles#8
embewee wants to merge 7 commits into
masterfrom
e-invoice-profiles

Conversation

@embewee

@embewee embewee commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@embewee
embewee requested a review from csteuer August 17, 2026 14:55
Comment on lines +3 to +18
/**
* Selects which {@code ExchangedDocumentContext} identifiers {@link XRechnungWriter} writes.
* <p>
* XRechnung, ZUGFeRD (Germany) and Factur-X (France) all use the same Cross Industry Invoice (CII)
* syntax and the same EN16931 semantic data model — they only differ in the guideline and
* business-process URNs declared in the document context. Everything else {@link XRechnungWriter}
* produces is identical across profiles.
* <p>
* Note that {@code ZUGFERD_EN16931} and {@code FACTURX_EN16931} only cover the EN16931 ("COMFORT")
* conformance level. Other conformance levels (e.g. ZUGFeRD/Factur-X BASIC, MINIMUM, EXTENDED) use
* different guideline URNs and are not covered by this profile.
* <p>
* Also note that ZUGFeRD and Factur-X are
* hybrid formats that combine a PDF/A-3 document with an embedded XML; {@link XRechnungWriter} only
* produces the XML part — embedding it into a PDF/A-3 document is the caller's responsibility.
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's sufficient to say that the profile determines which kind of e-invoice format is produced, as long as it's based on the CII syntax.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can get rid of this file.

Testing whether a constant has a certain value or if a deprecated method uses a specific parameter value for the method it has been replaced with is not worth it, in my opinion.
It's unlikely that the constants are changed accidentally. If they are changed, the change is on purpose.
Same for the deprecated functions.

The other tests do not cover anything that is not already covered by the golden file tests.

Comment on lines 33 to 45
/**
* Writes a XRechnung XML with the data of an {@linkplain Invoice} object
* <p>
* The mapping from the XRechnung specification ID (like BT-82) to the corresponding XML element can be found
* in the <code>XRechnung-v3.0.2-Syntax-Binding-Extension-UBL.pdf</code> or in the XRechnung bundle at:
* <code>xrechnung-3.0.2-xrechnung-visualization-2024-06-20/xsl/cii-xr.xsl</code>
* <p>
* The writer will always produce valid XML, but it does not guarantee that the generated XRechnung is valid
* according to the schema and the business rules.
* E.g. if required data is missing the writer will create an empty element or omit the corresponding xml structure completely.
* The XRechnung will only be valid if the data in the invoice object is correct.
*/
public class XRechnungWriter {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that it's also possible to write Factur-X and ZUGFeRD XMLs this class name and the description must be changed. E.g. EInvoiceXMLWriter or EInvoiceCIIXMLWriter

*
* <p>Scenarios and profiles are registered once in {@link TestHelper}.</p>
*/
public class InvoiceScenarioXmlTest {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be called after the class that it tests

public class InvoiceScenarioXmlTest {

@ParameterizedTest(name = "{0} / {1}")
@MethodSource("de.codebarista.gallop.TestHelper#invoiceProfilesAndScenarios")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If InvoiceProfileTest is removed, I would inline that and the other things that have been extracted into the TestHelper class.

Comment thread README.md

Gallop does not manipulate your data. It writes the exact values you provide into the XRechnung XML,
with no calculations or transformations (aside from necessary XML escaping).
Gallop does not manipulate your data. It writes the exact values you provide into the XRechnung XML, with no

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Gallop does not manipulate your data. It writes the exact values you provide into the XRechnung XML, with no
Gallop does not manipulate your data. It writes the exact values you provide into the XML, with no

Comment thread README.md
Comment on lines +30 to +31
e-invoice, but will not notice or complain when the result does not meet all the rules specified in the XRechnung
standard.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
e-invoice, but will not notice or complain when the result does not meet all the rules specified in the XRechnung
standard.
e-invoice, but will not notice or complain when the result does not meet all the rules specified in the
choosen e-invoice format.

Comment thread README.md
```

XRechnung, ZUGFeRD and Factur-X all share the same Cross Industry Invoice (CII) syntax and the same EN16931 semantic
data model, so the same `Invoice` object works for all three — only the document context identifiers differ, and Gallop

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
data model, so the same `Invoice` object works for all three — only the document context identifiers differ, and Gallop
data model, so the same `Invoice` object works for all three. Only the document context identifiers differ, and Gallop

Comment thread README.md

Note that ZUGFeRD and Factur-X are hybrid formats combining a PDF/A-3 document with embedded XML; Gallop only produces
the XML part, embedding it into a PDF/A-3 document is up to you. Also note that unit codes conventionally differ by
format: XRechnung examples use `XPP` for "piece", while ZUGFeRD examples use `H87` (see `UnitCode.java`) — pick the unit

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
format: XRechnung examples use `XPP` for "piece", while ZUGFeRD examples use `H87` (see `UnitCode.java`) — pick the unit
format: XRechnung examples use `XPP` for "piece", while ZUGFeRD examples use `H87` (see `UnitCode.java`). Pick the unit

Comment thread README.md
### Changelog

- 2.3.0: Add `Profile` parameter for ZUGFeRD/Factur-X (EN16931) support alongside XRechnung; deprecate
`generateXRechnungXML(Invoice)` and `XRechnungWriter(Invoice)` in favor of the explicit-profile

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`generateXRechnungXML(Invoice)` and `XRechnungWriter(Invoice)` in favor of the explicit-profile
`generateXRechnungXML(Invoice)` and `XRechnungWriter(Invoice)` in favor of the explicit-profile methods

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants