Support <ram:UltimateShipToTradeParty/>
This commit is contained in:
@@ -42,7 +42,7 @@ public class Invoice implements IExportableTransaction {
|
||||
protected boolean testIndicator;
|
||||
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 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;
|
||||
@@ -790,6 +790,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;
|
||||
|
||||
@@ -513,6 +513,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)
|
||||
*
|
||||
|
||||
@@ -732,6 +732,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) {
|
||||
|
||||
@@ -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...
|
||||
|
||||
@@ -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"))
|
||||
@@ -692,6 +693,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) {
|
||||
|
||||
Reference in New Issue
Block a user