-
-
Notifications
You must be signed in to change notification settings - Fork 201
Description
When using Product.setTaxExemptionReason() with setTaxCategoryCode("E") in EN16931 profile, the <ram:ExemptionReason> element is written to both the line item (SpecifiedLineTradeSettlement) and the header (ApplicableHeaderTradeSettlement).
However, EN16931 only allows ExemptionReason in the header (BG-23 VAT breakdown), not on line item level. Validators reject this with:
From https://portal3.gefeg.com/invoice validator:
Das Element 'ram:ExemptionReason' soll in diesem Kontext nicht verwendet werden. [Zeile 68]
Steps to reproduce:
Invoice invoice = new Invoice()
.setNumber("TEST-001")
.setIssueDate(new Date())
// ... sender/recipient setup ...
.addItem(new Item(
new Product("Insurance", "", "C62", BigDecimal.ZERO)
.setTaxCategoryCode("E")
.setTaxExemptionReason("Exempt under §4 UStG"),
new BigDecimal("100.00"),
new BigDecimal("1")
));
ZUGFeRDExporterFromA1 exporter = new ZUGFeRDExporterFromA1();
exporter.setProfile(Profiles.getByName("EN16931"));
exporter.setTransaction(invoice);
exporter.export("output.pdf");Actual Result:
<!-- Line item - INVALID for EN16931 -->
<ram:SpecifiedLineTradeSettlement>
<ram:ApplicableTradeTax>
<ram:ExemptionReason>Exempt under §4 UStG</ram:ExemptionReason> <!-- WRONG -->
<ram:CategoryCode>E</ram:CategoryCode>
</ram:ApplicableTradeTax>
</ram:SpecifiedLineTradeSettlement>
<!-- Header - OK -->
<ram:ApplicableHeaderTradeSettlement>
<ram:ApplicableTradeTax>
<ram:ExemptionReason>Exempt under §4 UStG</ram:ExemptionReason> <!-- CORRECT -->
<ram:CategoryCode>E</ram:CategoryCode>
</ram:ApplicableTradeTax>
</ram:ApplicableHeaderTradeSettlement>Expected result:
ExemptionReason should only appear in ApplicableHeaderTradeSettlement, not in SpecifiedLineTradeSettlement when using EN16931 profile.
Workaround:
Post-process the XML to remove ExemptionReason from line items.
Version: 2.21.0