Merge pull request #962 from langfr/feature/ExemptionReasonCode

Adding a tax ExemptionReasonCode to Product.
This commit is contained in:
Jochen Staerk
2025-12-11 14:43:42 +01:00
committed by GitHub
5 changed files with 29 additions and 2 deletions

View File

@@ -193,6 +193,9 @@ public class Item implements IZUGFeRDExportableItem {
icnm.getAsNodeMap("ApplicableTradeTax")
.flatMap(cnm -> cnm.getAsString("ExemptionReason"))
.ifPresent(product::setTaxExemptionReason);
icnm.getAsNodeMap("ApplicableTradeTax")
.flatMap(cnm -> cnm.getAsString("ExemptionReasonCode"))
.ifPresent(product::setTaxExemptionReasonCode);
icnm.getAllNodes("SpecifiedTradeAllowanceCharge").map(NodeMap::new).forEach(stac -> {
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {

View File

@@ -23,6 +23,7 @@ public class Product implements IZUGFeRDExportableProduct {
protected String unit, name, sellerAssignedID, buyerAssignedID;
protected String description = "";
protected String taxExemptionReason = null;
protected String taxExemptionReasonCode = null;
protected String taxCategoryCode = null;
protected BigDecimal VATPercent;
protected boolean isReverseCharge = false;
@@ -157,7 +158,22 @@ public class Product implements IZUGFeRDExportableProduct {
* @return fluent setter
*/
public Product setTaxExemptionReason(String taxExemptionReasonText) {
taxExemptionReason = taxExemptionReasonText;
this.taxExemptionReason = taxExemptionReasonText;
return this;
}
@Override
public String getTaxExemptionReasonCode() {
return taxExemptionReasonCode;
}
/***
*
* @param taxExemptionReasonCode, https://docs.peppol.eu/poacc/billing/3.0/codelist/vatex/
* @return fluent setter
*/
public Product setTaxExemptionReasonCode(String taxExemptionReasonCode) {
this.taxExemptionReasonCode = taxExemptionReasonCode;
return this;
}

View File

@@ -158,6 +158,10 @@ public interface IZUGFeRDExportableProduct {
return null;
}
default String getTaxExemptionReasonCode() {
return null;
}
default String getCountryOfOrigin() {
return null;
}

View File

@@ -537,6 +537,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
if (currentItem.getProduct().getTaxExemptionReason() != null) {
xml += "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
}
if (currentItem.getProduct().getTaxExemptionReasonCode() != null) {
xml += "<ram:ExemptionReasonCode>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReasonCode()) + "</ram:ExemptionReasonCode>";
}
xml += "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>";
BigDecimal vatValue=BigDecimal.ZERO;
if (currentItem.getProduct().getTaxCategoryCode().equals(TaxCategoryCodeTypeConstants.ZEROTAXPRODUCTS)) {

View File

@@ -160,7 +160,7 @@ public class ZF2PushTest extends TestCase {
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE4711")
.setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE")))
.setNumber(number)
.addItem(new Item(new Product("Testprodukt", "", "H87", new BigDecimal(0)).setTaxExemptionReason("Kleinunternehmer gemäß §19 UStG").setTaxCategoryCode("E"), price, new BigDecimal(1.0)).addNote(theNote))
.addItem(new Item(new Product("Testprodukt", "", "H87", new BigDecimal(0)).setTaxExemptionReason("Kleinunternehmer gemäß §19 UStG").setTaxCategoryCode("E").setTaxExemptionReasonCode( "VATEX-EU-I" ), price, new BigDecimal(1.0)).addNote(theNote))
);
String theXML = new String(ze.getProvider().getXML(), StandardCharsets.UTF_8);
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
@@ -179,6 +179,7 @@ public class ZF2PushTest extends TestCase {
}
assertEquals(i.getZFItems()[0].getNotesWithSubjectCode().get(0).getContent(), theNote);
assertNotNull(i.getZFItems()[0].getProduct().getTaxExemptionReasonCode());
assertEquals(senderDescription, i.getSender().getDescription());
// now check the contents (like MustangReaderTest)