Merge branch 'langfr-feature/UltimateShipToTradeParty'

This commit is contained in:
langfr
2026-05-14 13:32:03 +01:00
5 changed files with 34 additions and 1 deletions

View File

@@ -43,7 +43,7 @@ public class Invoice implements IExportableTransaction {
protected String documentName = null, documentCode = null, number = null, ownOrganisationFullPlaintextInfo = null, referenceNumber = null, shipToOrganisationID = null, shipToOrganisationName = null, shipToStreet = null, shipToZIP = null, shipToLocation = null, shipToCountry = null, buyerOrderReferencedDocumentID = null, buyerOrderReferencedDocumentIssueDateTime = null, ownForeignOrganisationID = null, ownOrganisationName = null, currency = null, paymentTermDescription = null;
protected String deliveryTypeCode;
protected Date issueDate = null, dueDate = null, deliveryDate = null;
protected TradeParty sender = null, recipient = null, deliveryAddress = null, payee = null, invoicer = null, invoicee = null;
protected TradeParty sender = null, recipient = null, deliveryAddress = null, endCustomerDeliveryAddress = null, payee = null, invoicer = null, invoicee = null;
protected ArrayList<CashDiscount> cashDiscounts = null;
@JsonDeserialize(contentAs = Item.class)
protected ArrayList<IZUGFeRDExportableItem> ZFItems = null;
@@ -800,6 +800,16 @@ public class Invoice implements IExportableTransaction {
return this;
}
@Override
public TradeParty getEndCustomerDeliveryAddress() {
return endCustomerDeliveryAddress;
}
public Invoice setEndCustomerDeliveryAddress(TradeParty endCustomerDeliveryAddress) {
this.endCustomerDeliveryAddress = endCustomerDeliveryAddress;
return this;
}
@Override
public TradeParty getPayee() {
return this.payee;

View File

@@ -517,6 +517,15 @@ public interface IExportableTransaction {
return null;
}
/***
* ultimate delivery address, i.e. ram:UltimateShipToTradeParty (only supported for zf2)
*
* @return the IZUGFeRDExportableTradeParty delivery address
*/
default IZUGFeRDExportableTradeParty getEndCustomerDeliveryAddress() {
return null;
}
/***
* payee / payment receiver, if different from seller, ram:Payee (only supported for zf2)
*

View File

@@ -739,6 +739,11 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
getTradePartyAsXML(this.trans.getDeliveryAddress(), false, true) +
"</ram:ShipToTradeParty>";
}
if (this.trans.getEndCustomerDeliveryAddress() != null) {
xml += "<ram:UltimateShipToTradeParty>" +
getTradePartyAsXML(this.trans.getEndCustomerDeliveryAddress(), false, true) +
"</ram:UltimateShipToTradeParty>";
}
if (trans.getDeliveryDate() != null) {

View File

@@ -396,12 +396,19 @@ public class ZUGFeRDInvoiceImporter {
XPath xpath = xpathFact.newXPath();
XPathExpression xpr = xpath.compile("//*[local-name()=\"SellerTradeParty\"]|//*[local-name()=\"AccountingSupplierParty\"]/*");
NodeList SellerNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
XPathExpression shipEx = xpath.compile("//*[local-name()=\"ShipToTradeParty\"]");
NodeList deliveryNodes = (NodeList) shipEx.evaluate(getDocument(), XPathConstants.NODESET);
if (deliveryNodes.getLength() > 0) {
zpp.setDeliveryAddress(new TradeParty(deliveryNodes));
}
XPathExpression ultimateShipEx = xpath.compile("//*[local-name()=\"UltimateShipToTradeParty\"]");
NodeList ultimateDeliveryNodes = (NodeList) ultimateShipEx.evaluate(getDocument(), XPathConstants.NODESET);
if (ultimateDeliveryNodes.getLength() > 0) {
zpp.setEndCustomerDeliveryAddress(new TradeParty(ultimateDeliveryNodes));
}
List<IncludedNote> includedNotes = new ArrayList<>();
//UBL...

View File

@@ -605,6 +605,7 @@ public class ZF2PushTest extends TestCase {
.setDetailedDeliveryPeriod(new SimpleDateFormat("yyyyMMdd").parse(occurrenceFrom), new SimpleDateFormat("yyyyMMdd").parse(occurrenceTo))
.setSender(new TradeParty(orgname, "teststr", "55232", "teststadt", "DE").addTaxID(taxID).setEmail("sender@test.org").setID(orgID).addVATID("DE0815"))
.setDeliveryAddress(new TradeParty("just the other side of the street", "teststr.12a", "55232", "Entenhausen", "DE").addVATID("DE47110"))
.setEndCustomerDeliveryAddress(new TradeParty("Max Mustermann", "Glückswinkel 42", "98765", "Musterhausen", "DE"))
.setContractReferencedDocument(contractID)
.setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE").addGlobalID(gln).setEmail("recipient@test.org").addVATID("DE4711")
.setContact(new Contact("Franz Müller", "01779999999", "franz@mueller.de", "teststr. 12", "55232", "Entenhausen", "DE").setFax("++49555123456")).setAdditionalAddress("Hinterhaus 3"))
@@ -695,6 +696,7 @@ public class ZF2PushTest extends TestCase {
assertNotNull(i.getInvoicer());
assertNotNull(i.getInvoicee());
assertNotNull(i.getEndCustomerDeliveryAddress());
} catch (XPathExpressionException e) {
fail("XPathExpressionException should not be raised");
} catch (ParseException e) {