E invoice profiles - #8
Conversation
| /** | ||
| * 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. | ||
| */ |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| /** | ||
| * 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 { |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
Should be called after the class that it tests
| public class InvoiceScenarioXmlTest { | ||
|
|
||
| @ParameterizedTest(name = "{0} / {1}") | ||
| @MethodSource("de.codebarista.gallop.TestHelper#invoiceProfilesAndScenarios") |
There was a problem hiding this comment.
If InvoiceProfileTest is removed, I would inline that and the other things that have been extracted into the TestHelper class.
|
|
||
| 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 |
There was a problem hiding this comment.
| 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 |
| e-invoice, but will not notice or complain when the result does not meet all the rules specified in the XRechnung | ||
| standard. |
There was a problem hiding this comment.
| 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. |
| ``` | ||
|
|
||
| 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 |
There was a problem hiding this comment.
| 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 |
|
|
||
| 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 |
There was a problem hiding this comment.
| 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 |
| ### 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 |
There was a problem hiding this comment.
| `generateXRechnungXML(Invoice)` and `XRechnungWriter(Invoice)` in favor of the explicit-profile | |
| `generateXRechnungXML(Invoice)` and `XRechnungWriter(Invoice)` in favor of the explicit-profile methods |
No description provided.