Adding a tax ExemptionReasonCode to Product.
This commit is contained in:
@@ -189,6 +189,9 @@ public class Item implements IZUGFeRDExportableItem {
|
|||||||
icnm.getAsNodeMap("ApplicableTradeTax")
|
icnm.getAsNodeMap("ApplicableTradeTax")
|
||||||
.flatMap(cnm -> cnm.getAsString("ExemptionReason"))
|
.flatMap(cnm -> cnm.getAsString("ExemptionReason"))
|
||||||
.ifPresent(product::setTaxExemptionReason);
|
.ifPresent(product::setTaxExemptionReason);
|
||||||
|
icnm.getAsNodeMap("ApplicableTradeTax")
|
||||||
|
.flatMap(cnm -> cnm.getAsString("ExemptionReasonCode"))
|
||||||
|
.ifPresent(product::setTaxExemptionReasonCode);
|
||||||
|
|
||||||
icnm.getAllNodes("SpecifiedTradeAllowanceCharge").map(NodeMap::new).forEach(stac -> {
|
icnm.getAllNodes("SpecifiedTradeAllowanceCharge").map(NodeMap::new).forEach(stac -> {
|
||||||
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {
|
stac.getAsNodeMap("ChargeIndicator").ifPresent(ci -> {
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
protected String unit, name, sellerAssignedID, buyerAssignedID;
|
protected String unit, name, sellerAssignedID, buyerAssignedID;
|
||||||
protected String description = "";
|
protected String description = "";
|
||||||
protected String taxExemptionReason = null;
|
protected String taxExemptionReason = null;
|
||||||
|
protected String taxExemptionReasonCode = null;
|
||||||
protected String taxCategoryCode = null;
|
protected String taxCategoryCode = null;
|
||||||
protected BigDecimal VATPercent;
|
protected BigDecimal VATPercent;
|
||||||
protected boolean isReverseCharge = false;
|
protected boolean isReverseCharge = false;
|
||||||
@@ -157,7 +158,22 @@ public class Product implements IZUGFeRDExportableProduct {
|
|||||||
* @return fluent setter
|
* @return fluent setter
|
||||||
*/
|
*/
|
||||||
public Product setTaxExemptionReason(String taxExemptionReasonText) {
|
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;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,10 @@ public interface IZUGFeRDExportableProduct {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default String getTaxExemptionReasonCode() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
default String getCountryOfOrigin() {
|
default String getCountryOfOrigin() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -537,6 +537,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
if (currentItem.getProduct().getTaxExemptionReason() != null) {
|
if (currentItem.getProduct().getTaxExemptionReason() != null) {
|
||||||
xml += "<ram:ExemptionReason>" + XMLTools.encodeXML(currentItem.getProduct().getTaxExemptionReason()) + "</ram:ExemptionReason>";
|
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>";
|
xml += "<ram:CategoryCode>" + currentItem.getProduct().getTaxCategoryCode() + "</ram:CategoryCode>";
|
||||||
if (!currentItem.getProduct().getTaxCategoryCode().equals(TaxCategoryCodeTypeConstants.UNTAXEDSERVICE)) {
|
if (!currentItem.getProduct().getTaxCategoryCode().equals(TaxCategoryCodeTypeConstants.UNTAXEDSERVICE)) {
|
||||||
xml += "<ram:RateApplicablePercent>" + vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>";
|
xml += "<ram:RateApplicablePercent>" + vatFormat(currentItem.getProduct().getVATPercent()) + "</ram:RateApplicablePercent>";
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addVATID("DE4711")
|
.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")))
|
.setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE")))
|
||||||
.setNumber(number)
|
.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);
|
String theXML = new String(ze.getProvider().getXML(), StandardCharsets.UTF_8);
|
||||||
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
assertTrue(theXML.contains("<rsm:CrossIndustryInvoice"));
|
||||||
@@ -179,6 +179,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assertEquals(i.getZFItems()[0].getNotesWithSubjectCode().get(0).getContent(), theNote);
|
assertEquals(i.getZFItems()[0].getNotesWithSubjectCode().get(0).getContent(), theNote);
|
||||||
|
assertNotNull(i.getZFItems()[0].getProduct().getTaxExemptionReasonCode());
|
||||||
assertEquals(senderDescription, i.getSender().getDescription());
|
assertEquals(senderDescription, i.getSender().getDescription());
|
||||||
|
|
||||||
// now check the contents (like MustangReaderTest)
|
// now check the contents (like MustangReaderTest)
|
||||||
|
|||||||
Reference in New Issue
Block a user