Support <ram:DeliveryTypeCode/>
This commit is contained in:
@@ -41,6 +41,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 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 ArrayList<CashDiscount> cashDiscounts = null;
|
||||
@@ -332,6 +333,15 @@ public class Invoice implements IExportableTransaction {
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDeliveryTypeCode() {
|
||||
return deliveryTypeCode;
|
||||
}
|
||||
|
||||
public Invoice setDeliveryTypeCode(String deliveryTypeCode) {
|
||||
this.deliveryTypeCode = deliveryTypeCode;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBuyerOrderReferencedDocumentID() {
|
||||
return buyerOrderReferencedDocumentID;
|
||||
|
||||
@@ -438,6 +438,10 @@ public interface IExportableTransaction {
|
||||
return null;
|
||||
}
|
||||
|
||||
default String getDeliveryTypeCode() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the ID of the SellerOrderReferencedDocument, which sits in the
|
||||
* ApplicableSupplyChainTradeAgreement/ApplicableHeaderTradeAgreement
|
||||
|
||||
@@ -661,6 +661,13 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
xml += "<ram:SellerTradeParty>" + getTradePartyAsXML(trans.getSender(), true, false) + "</ram:SellerTradeParty>";
|
||||
xml += "<ram:BuyerTradeParty>" + getTradePartyAsXML(trans.getRecipient(), false, false) + "</ram:BuyerTradeParty>";
|
||||
|
||||
if (trans.getDeliveryTypeCode() != null && getProfile() == Profiles.getByName("Extended")) {
|
||||
xml += "<ram:ApplicableTradeDeliveryTerms>"
|
||||
+ "<ram:DeliveryTypeCode>"
|
||||
+ trans.getDeliveryTypeCode()
|
||||
+ "</ram:DeliveryTypeCode>"
|
||||
+ "</ram:ApplicableTradeDeliveryTerms>";
|
||||
}
|
||||
if (trans.getSellerOrderReferencedDocumentID() != null && !trans.getSellerOrderReferencedDocumentID().trim().isEmpty()) {
|
||||
xml += "<ram:SellerOrderReferencedDocument>"
|
||||
+ "<ram:IssuerAssignedID>"
|
||||
|
||||
@@ -749,6 +749,16 @@ public class ZUGFeRDInvoiceImporter {
|
||||
NodeList headerTradeAgreementChilds = headerTradeAgreementNode.getChildNodes();
|
||||
for (int agreementChildIndex = 0; agreementChildIndex < headerTradeAgreementChilds.getLength(); agreementChildIndex++) {
|
||||
if (headerTradeAgreementChilds.item(agreementChildIndex).getLocalName() != null) {
|
||||
if (headerTradeAgreementChilds.item(agreementChildIndex).getLocalName().equals("ApplicableTradeDeliveryTerms")) {
|
||||
NodeList applicableTradeDeliveryTermsChilds = headerTradeAgreementChilds.item(agreementChildIndex).getChildNodes();
|
||||
for (int applicableTradeDeliveryTermsChildIndex = 0; applicableTradeDeliveryTermsChildIndex < applicableTradeDeliveryTermsChilds.getLength(); applicableTradeDeliveryTermsChildIndex++) {
|
||||
if ((applicableTradeDeliveryTermsChilds.item(applicableTradeDeliveryTermsChildIndex).getLocalName() != null)
|
||||
&& (applicableTradeDeliveryTermsChilds.item(applicableTradeDeliveryTermsChildIndex).getLocalName().equals("DeliveryTypeCode"))) {
|
||||
zpp.setDeliveryTypeCode(XMLTools.trimOrNull(applicableTradeDeliveryTermsChilds.item(applicableTradeDeliveryTermsChildIndex)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (headerTradeAgreementChilds.item(agreementChildIndex).getLocalName().equals("BuyerOrderReferencedDocument")) {
|
||||
NodeList buyerOrderChilds = headerTradeAgreementChilds.item(agreementChildIndex).getChildNodes();
|
||||
for (int buyerOrderChildIndex = 0; buyerOrderChildIndex < buyerOrderChilds.getLength(); buyerOrderChildIndex++) {
|
||||
|
||||
@@ -623,6 +623,7 @@ public class ZF2PushTest extends TestCase {
|
||||
.setTenderReferencedDocument(dr1)
|
||||
.setDeliveryDate(sdf.parse("2020-11-02")).setNumber(number).setVATDueDateTypeCode(EventTimeCodeTypeConstants.PAYMENT_DATE)
|
||||
.setInvoiceReferencedDocumentID("abc123").addInvoiceReferencedDocument(new ReferencedDocument("abcd1234"))
|
||||
.setDeliveryTypeCode("EXW")
|
||||
);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
@@ -652,6 +653,7 @@ public class ZF2PushTest extends TestCase {
|
||||
assertTrue(zi.getUTF8().contains(occurrenceFrom));
|
||||
assertTrue(zi.getUTF8().contains(occurrenceTo));
|
||||
assertTrue(zi.getUTF8().contains(contractID));
|
||||
assertTrue(zi.getUTF8().contains("EXW"));
|
||||
assertEquals(zi.importedInvoice.getZFItems()[0].getId(), "a123");
|
||||
assertEquals(zi.importedInvoice.getZFItems()[0].getDeliveryNoteReferencedDocumentID(), "deliverynote123");
|
||||
assertEquals(zi.importedInvoice.getZFItems()[0].getDeliveryNoteReferencedDocumentLineID(), "deliverypos456");
|
||||
@@ -677,6 +679,7 @@ public class ZF2PushTest extends TestCase {
|
||||
Invoice i = zii.extractInvoice();
|
||||
|
||||
assertEquals("abc123", i.getInvoiceReferencedDocumentID());
|
||||
assertEquals("EXW", i.getDeliveryTypeCode());
|
||||
assertEquals(1, i.getInvoiceReferencedDocuments().size());
|
||||
assertEquals("abcd1234", i.getInvoiceReferencedDocuments().get(0).getIssuerAssignedID());
|
||||
assertEquals("4304171000002", i.getRecipient().getGlobalID());
|
||||
|
||||
Reference in New Issue
Block a user