diff --git a/History.md b/History.md
index 701106d89..6a8f4be3a 100644
--- a/History.md
+++ b/History.md
@@ -1,3 +1,5 @@
+- #678
+- #679
2.16.0
=======
diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml
index 9b5e3bc9c..9d83688f5 100644
--- a/Mustang-CLI/pom.xml
+++ b/Mustang-CLI/pom.xml
@@ -3,7 +3,7 @@
org.mustangproject
core
- 2.15.3-SNAPSHOT
+ 2.16.1-SNAPSHOT
4.0.0
org.mustangproject
@@ -12,7 +12,7 @@
should also work for XRechnung/CII.
jar
- 2.15.3-SNAPSHOT
+ 2.16.1-SNAPSHOT
UTF-8
11
@@ -23,7 +23,7 @@
org.mustangproject
validator
- 2.15.3-SNAPSHOT
+ 2.16.1-SNAPSHOT
diff --git a/library/pom.xml b/library/pom.xml
index 073661c1f..81a1716fa 100644
--- a/library/pom.xml
+++ b/library/pom.xml
@@ -3,13 +3,13 @@
org.mustangproject
core
- 2.15.3-SNAPSHOT
+ 2.16.1-SNAPSHOT
4.0.0
org.mustangproject
library
- 2.15.3-SNAPSHOT
+ 2.16.1-SNAPSHOT
jar
Library to write, read and validate e-invoices (Factur-X, ZUGFeRD, Order-X, XRechnung/CII)
FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT
diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
index 61bfad67d..35efed238 100644
--- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
+++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java
@@ -309,7 +309,7 @@ public Invoice extractInto(Invoice zpp) throws XPathExpressionException, ParseEx
List includedNotes = new ArrayList<>();
//UBL...
- XPathExpression UBLNotesEx = xpath.compile("/*[local-name()=\"Invoice\"]/*[local-name()=\"Note\"]");
+ XPathExpression UBLNotesEx = xpath.compile("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"Note\"]");
NodeList UBLNotesNd = (NodeList) UBLNotesEx.evaluate(getDocument(), XPathConstants.NODESET);
if ((UBLNotesNd != null) && (UBLNotesNd.getLength() > 0)) {
for (int nodeIndex = 0; nodeIndex < UBLNotesNd.getLength(); nodeIndex++) {
@@ -536,15 +536,16 @@ public Invoice extractInto(Invoice zpp) throws XPathExpressionException, ParseEx
}
zpp.addNotes(includedNotes);
String rootNode = extractString("local-name(/*)");
- if (rootNode.equals("Invoice")) {
+ if (rootNode.equals("Invoice")||rootNode.equals("CreditNote")) {
// UBL...
- number = extractString("//*[local-name()=\"Invoice\"]/*[local-name()=\"ID\"]").trim();
- typeCode = extractString("//*[local-name()=\"Invoice\"]/*[local-name()=\"InvoiceTypeCode\"]").trim();
- String issueDateStr = extractString("//*[local-name()=\"Invoice\"]/*[local-name()=\"IssueDate\"]").trim();
+ // //*[local-name()="Invoice" or local-name()="CreditNote"]
+ number = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"ID\"]").trim();
+ typeCode = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"InvoiceTypeCode\"]").trim();
+ String issueDateStr = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"IssueDate\"]").trim();
if (issueDateStr.length()>0) {
issueDate = new SimpleDateFormat("yyyy-MM-dd").parse(issueDateStr);
}
- String dueDt = extractString("//*[local-name()=\"Invoice\"]/*[local-name()=\"DueDate\"]").trim();
+ String dueDt = extractString("/*[local-name()=\"Invoice\" or local-name()=\"CreditNote\"]/*[local-name()=\"DueDate\"]").trim();
if (dueDt.length() > 0) {
dueDate = new SimpleDateFormat("yyyy-MM-dd").parse(dueDt);
}
diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java
index 6014c5fcf..b8c15a40e 100644
--- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java
+++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java
@@ -373,7 +373,7 @@ public void testImportDebit() {
}
- public void testImportMinimum() {
+ public void testImportMinimum() {
File CIIinputFile = getResourceAsFile("cii/facturFrMinimum.xml");
try {
ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(CIIinputFile));
@@ -392,6 +392,28 @@ public void testImportMinimum() {
}
+ public void testImportUBLCreditnote() { // Confirm some basics also work with UBL credit notes
+ File CIIinputFile = getResourceAsFile("ubl/UBL-CreditNote-2.1-Example.ubl.xml");
+ try {
+ ZUGFeRDInvoiceImporter zii = new ZUGFeRDInvoiceImporter(new FileInputStream(CIIinputFile));
+
+
+ CalculatedInvoice i = new CalculatedInvoice();
+ zii.extractInto(i);
+ assertEquals("TOSL108", i.getNumber());
+ assertEquals("729", i.getGrandTotal().toString());
+
+ } catch (IOException e) {
+ fail("IOException not expected");
+ } catch (XPathExpressionException e) {
+ throw new RuntimeException(e);
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+
+
+ }
+
@Test
public void testImportPrepaid() throws XPathExpressionException, ParseException {
diff --git a/pom.xml b/pom.xml
index 9dade18f1..03f326a5a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
org.mustangproject
core
- 2.15.3-SNAPSHOT pom
+ 2.16.1-SNAPSHOT pom
Mustang
diff --git a/validator/pom.xml b/validator/pom.xml
index 67d7ca946..d8820ab1b 100644
--- a/validator/pom.xml
+++ b/validator/pom.xml
@@ -3,7 +3,7 @@
org.mustangproject
core
- 2.15.3-SNAPSHOT
+ 2.16.1-SNAPSHOT
4.0.0
org.mustangproject
@@ -11,7 +11,7 @@
Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung)
jar
- 2.15.3-SNAPSHOT
+ 2.16.1-SNAPSHOT
@@ -38,7 +38,7 @@
${project.groupId}
library
- 2.15.3-SNAPSHOT
+ 2.16.1-SNAPSHOT
org.dom4j
diff --git a/validator/src/main/java/org/mustangproject/validator/ValidationContext.java b/validator/src/main/java/org/mustangproject/validator/ValidationContext.java
index 73b95f2e7..ce3cde48a 100644
--- a/validator/src/main/java/org/mustangproject/validator/ValidationContext.java
+++ b/validator/src/main/java/org/mustangproject/validator/ValidationContext.java
@@ -70,7 +70,7 @@ public ValidationContext setGeneration(String version) {
}
public ValidationContext setProfile(String profile) {
- this.profile = profile;
+ this.profile = profile.trim();
return this;
}