ShipToTradeParty should not contain URIUniversalCommunication

This commit is contained in:
langfr
2025-08-06 19:59:19 +01:00
parent 7a17055f8c
commit d1522479bb
3 changed files with 7 additions and 5 deletions

View File

@@ -219,7 +219,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
xml += "<ram:CountryID>" + XMLTools.encodeXML(party.getCountry()) xml += "<ram:CountryID>" + XMLTools.encodeXML(party.getCountry())
+ "</ram:CountryID>" + "</ram:CountryID>"
+ "</ram:PostalTradeAddress>"; + "</ram:PostalTradeAddress>";
if (party.getUriUniversalCommunicationID() != null && party.getUriUniversalCommunicationIDScheme() != null) { if (party.getUriUniversalCommunicationID() != null && party.getUriUniversalCommunicationIDScheme() != null && (!isShipToTradeParty)) {
xml += "<ram:URIUniversalCommunication>" + xml += "<ram:URIUniversalCommunication>" +
"<ram:URIID schemeID=\"" + party.getUriUniversalCommunicationIDScheme() + "\">" + "<ram:URIID schemeID=\"" + party.getUriUniversalCommunicationIDScheme() + "\">" +
XMLTools.encodeXML(party.getUriUniversalCommunicationID()) XMLTools.encodeXML(party.getUriUniversalCommunicationID())
@@ -462,10 +462,8 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
} }
xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>"; xml += "<ram:Name>" + XMLTools.encodeXML(currentItem.getProduct().getName()) + "</ram:Name>";
if (currentItem.getProduct().getDescription() != null) { if (currentItem.getProduct().getDescription() != null && !currentItem.getProduct().getDescription().isEmpty()) {
xml += "<ram:Description>" + xml += "<ram:Description>" + XMLTools.encodeXML(currentItem.getProduct().getDescription()) + "</ram:Description>";
XMLTools.encodeXML(currentItem.getProduct().getDescription()) +
"</ram:Description>";
} }
if (currentItem.getProduct().getClassifications() != null) { if (currentItem.getProduct().getClassifications() != null) {
for (IDesignatedProductClassification classification : currentItem.getProduct().getClassifications()) { for (IDesignatedProductClassification classification : currentItem.getProduct().getClassifications()) {

View File

@@ -106,6 +106,7 @@ public class XRTest extends TestCase {
Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()) Invoice i = new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date())
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").setEmail("sender@example.com").addTaxID("DE4711").addVATID("DE0815").setContact(new Contact("Hans Test", "+49123456789", "test@example.org")).addBankDetails(new BankDetails("DE12500105170648489890", "COBADEFXXX").setAccountName("kontoInhaber"))) .setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").setEmail("sender@example.com").addTaxID("DE4711").addVATID("DE0815").setContact(new Contact("Hans Test", "+49123456789", "test@example.org")).addBankDetails(new BankDetails("DE12500105170648489890", "COBADEFXXX").setAccountName("kontoInhaber")))
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setEmail("recipient@sample.org")) .setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setEmail("recipient@sample.org"))
.setDeliveryAddress(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").setEmail("recipient@sample.org"))
.addCashDiscount(new CashDiscount(new BigDecimal(2), 7)) .addCashDiscount(new CashDiscount(new BigDecimal(2), 7))
.addCashDiscount(new CashDiscount(new BigDecimal(3), 14)) .addCashDiscount(new CashDiscount(new BigDecimal(3), 14))
.setReferenceNumber("991-01484-64")//leitweg-id .setReferenceNumber("991-01484-64")//leitweg-id

View File

@@ -177,6 +177,9 @@ public class LibraryTest extends ResourceCase {
assertThat(res).valueByXPath("count(//error)") assertThat(res).valueByXPath("count(//error)")
.asInt() .asInt()
.isEqualTo(0); .isEqualTo(0);
assertThat(res).valueByXPath("count(//warning)")
.asInt()
.isEqualTo(0);
assertThat(res).valueByXPath("/validation/summary/@status") assertThat(res).valueByXPath("/validation/summary/@status")
.asString() .asString()
.isEqualTo("valid");// expect to be valid because XR notices are, well, only notices .isEqualTo("valid");// expect to be valid because XR notices are, well, only notices