Write RateApplicablePercent on head also for tax free (UNTAXEDSERVICE) invoices.
This commit is contained in:
@@ -739,7 +739,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (trans.getDocumentCode() != null
|
if (trans.getDocumentCode() != null
|
||||||
&& Set.of(DocumentCodeTypeConstants.CORRECTEDINVOICE, DocumentCodeTypeConstants.CREDITNOTE).contains(trans.getDocumentCode())) {
|
&& Arrays.asList(DocumentCodeTypeConstants.CORRECTEDINVOICE, DocumentCodeTypeConstants.CREDITNOTE).contains(trans.getDocumentCode())) {
|
||||||
hasDueDate = false;
|
hasDueDate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,10 +763,8 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ "<ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>" // currencyID=\"EUR\"
|
+ "<ram:BasisAmount>" + currencyFormat(amount.getBasis()) + "</ram:BasisAmount>" // currencyID=\"EUR\"
|
||||||
+ "<ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>"
|
+ "<ram:CategoryCode>" + amountCategoryCode + "</ram:CategoryCode>"
|
||||||
+ (amountDueDateTypeCode != null ? "<ram:DueDateTypeCode>" + amountDueDateTypeCode + "</ram:DueDateTypeCode>" : "");
|
+ (amountDueDateTypeCode != null ? "<ram:DueDateTypeCode>" + amountDueDateTypeCode + "</ram:DueDateTypeCode>" : "");
|
||||||
if (!amountCategoryCode.equals(TaxCategoryCodeTypeConstants.UNTAXEDSERVICE)) {
|
xml += "<ram:RateApplicablePercent>"
|
||||||
xml += "<ram:RateApplicablePercent>"
|
+ vatFormat(amount.getApplicablePercent()) + "</ram:RateApplicablePercent>";
|
||||||
+ vatFormat(amount.getApplicablePercent()) + "</ram:RateApplicablePercent>";
|
|
||||||
}
|
|
||||||
xml += "</ram:ApplicableTradeTax>";
|
xml += "</ram:ApplicableTradeTax>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -299,7 +299,7 @@ public class XRTest extends TestCase {
|
|||||||
String number = "123";
|
String number = "123";
|
||||||
String amountStr = "1.00";
|
String amountStr = "1.00";
|
||||||
BigDecimal amount = new BigDecimal(amountStr);
|
BigDecimal amount = new BigDecimal(amountStr);
|
||||||
var i = new Invoice().setDueDate(new java.util.Date()).setIssueDate(new java.util.Date()).setDeliveryDate(new java.util.Date())
|
Invoice i = new Invoice().setDueDate(new java.util.Date()).setIssueDate(new java.util.Date()).setDeliveryDate(new java.util.Date())
|
||||||
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID("DE4711").addVATID("DE0815").setEmail("info@example.org").setContact(new org.mustangproject.Contact("Hans Test", "+49123456789", "test@example.org")).addBankDetails(new org.mustangproject.BankDetails("DE12500105170648489890", "COBADEFXXX")))
|
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID("DE4711").addVATID("DE0815").setEmail("info@example.org").setContact(new org.mustangproject.Contact("Hans Test", "+49123456789", "test@example.org")).addBankDetails(new org.mustangproject.BankDetails("DE12500105170648489890", "COBADEFXXX")))
|
||||||
.setRecipient(recipient)
|
.setRecipient(recipient)
|
||||||
.setReferenceNumber("991-01484-64")//leitweg-id
|
.setReferenceNumber("991-01484-64")//leitweg-id
|
||||||
@@ -311,10 +311,14 @@ public class XRTest extends TestCase {
|
|||||||
zf2p.generateXML(i);
|
zf2p.generateXML(i);
|
||||||
String theXML = new String(zf2p.getXML(), StandardCharsets.UTF_8);
|
String theXML = new String(zf2p.getXML(), StandardCharsets.UTF_8);
|
||||||
// Untaxed services don't have the field RateApplicablePercent, since it would be always 0. An error is thrown on validation, if 0 is set.
|
// Untaxed services don't have the field RateApplicablePercent, since it would be always 0. An error is thrown on validation, if 0 is set.
|
||||||
assertThat(theXML).valueByXPath("count(//*[local-name()='RateApplicablePercent'])")
|
assertThat(theXML).valueByXPath("count(//*[local-name()='SpecifiedLineTradeSettlement']/*[local-name()='ApplicableTradeTax']/*[local-name()='RateApplicablePercent'])")
|
||||||
.asInt()
|
.asInt()
|
||||||
.isEqualTo(0);
|
.isEqualTo(0);
|
||||||
|
|
||||||
|
assertThat(theXML).valueByXPath("count(//*[local-name()='ApplicableHeaderTradeSettlement']/*[local-name()='ApplicableTradeTax']/*[local-name()='RateApplicablePercent'])")
|
||||||
|
.asInt()
|
||||||
|
.isEqualTo(1);
|
||||||
|
|
||||||
//Exemption reason needs to be set if TaxCategoryCode == "O", reason should be at the product and in the ApplicableTradeTax
|
//Exemption reason needs to be set if TaxCategoryCode == "O", reason should be at the product and in the ApplicableTradeTax
|
||||||
assertThat(theXML).valueByXPath("count(//*[local-name()='ExemptionReason'])")
|
assertThat(theXML).valueByXPath("count(//*[local-name()='ExemptionReason'])")
|
||||||
.asInt()
|
.asInt()
|
||||||
|
|||||||
Reference in New Issue
Block a user