Skip to content

Commit

Permalink
DespatchAdviceID
Browse files Browse the repository at this point in the history
  • Loading branch information
jstaerk committed Mar 21, 2022
1 parent 58b1359 commit 3ee042d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
2 changes: 2 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
2.4.1
=======

DespatchAdviceReferencedDocument/IssuerAssignedID

- allow to specify legalorganisation ID+scheme ID
- allow to specify additional files to be attached in command line
- update to zf 2.2
Expand Down
15 changes: 14 additions & 1 deletion library/src/main/java/org/mustangproject/Invoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public class Invoice implements IExportableTransaction {
protected Date invoiceReferencedIssueDate;
protected String specifiedProcuringProjectID = null;
protected String specifiedProcuringProjectName = null;
protected String despatchAdviceReferencedDocumentID = null;

public Invoice() {
public Invoice() {
ZFItems = new ArrayList<>();
setCurrency("EUR");
}
Expand Down Expand Up @@ -667,6 +668,18 @@ public Invoice setSpecifiedProcuringProjectID(String specifiedProcuringProjectID
return this;
}

@Override
public String getDespatchAdviceReferencedDocumentID() {
return despatchAdviceReferencedDocumentID;
}


public Invoice setDespatchAdviceReferencedDocumentID(String despatchAdviceReferencedDocumentID) {
this.despatchAdviceReferencedDocumentID = despatchAdviceReferencedDocumentID;
return this;
}


@Override
public String getSpecifiedProcuringProjectName() {
return specifiedProcuringProjectName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,9 @@ default FileAttachment[] getAdditionalReferencedDocuments() {
return null;
}


default String getDespatchAdviceReferencedDocumentID() {
return null;
}
/***
* additional text description
* @return an array of strings of document wide "includedNotes" (descriptive text values)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,16 +512,23 @@ public void generateXML(IExportableTransaction trans) {
throw new IllegalStateException("No delivery date provided");
}
xml += "</ram:OccurrenceDateTime>\n";
xml += " </ram:ActualDeliverySupplyChainEvent>\n"
xml += " </ram:ActualDeliverySupplyChainEvent>\n";

/*
* + " <DeliveryNoteReferencedDocument>\n" +
* " <IssueDateTime format=\"102\">20130603</IssueDateTime>\n" +
* " <ID>2013-51112</ID>\n" +
* " </DeliveryNoteReferencedDocument>\n"
* + " <DeliveryNoteReferencedDocument>\n" +
* " <IssueDateTime format=\"102\">20130603</IssueDateTime>\n" +
* " <ID>2013-51112</ID>\n" +
* " </DeliveryNoteReferencedDocument>\n"
*/
+ " </ram:ApplicableHeaderTradeDelivery>\n" + " <ram:ApplicableHeaderTradeSettlement>\n"
+ " <ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>\n"
+ " <ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>\n";
if (trans.getDespatchAdviceReferencedDocumentID() != null) {
xml += "<ram:DespatchAdviceReferencedDocument>";
xml += "<ram:IssuerAssignedID>"+XMLTools.encodeXML(trans.getDespatchAdviceReferencedDocumentID())+"</ram:IssuerAssignedID>";
xml += "</ram:DespatchAdviceReferencedDocument>";

}
xml += " </ram:ApplicableHeaderTradeDelivery>\n" + " <ram:ApplicableHeaderTradeSettlement>\n"
+ " <ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>\n"
+ " <ram:InvoiceCurrencyCode>" + trans.getCurrency() + "</ram:InvoiceCurrencyCode>\n";

if (trans.getTradeSettlementPayment() != null) {
for (final IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,11 @@ public String getReferenceNumber() {
return "AB321";
}

@Override
public String getDespatchAdviceReferencedDocumentID() {
return "123";
}

/**
* Create the test case
*
Expand Down Expand Up @@ -311,6 +316,8 @@ public void testEdgeExport() {
assertTrue(resultXML.contains("<ram:DueDateDateTime>"));
assertFalse(resultXML.contains("EUR"));
assertTrue(resultXML.contains("USD"));//currency should be USD, test for #150
assertTrue(resultXML.contains("<ram:DespatchAdviceReferencedDocument>"));
assertTrue(resultXML.contains("<ram:IssuerAssignedID>123</ram:IssuerAssignedID>"));

// Reading ZUGFeRD
assertEquals("496.00", zi.getAmount());
Expand Down

0 comments on commit 3ee042d

Please sign in to comment.