diff --git a/History.md b/History.md index 55b0092b..0ea8685d 100644 --- a/History.md +++ b/History.md @@ -5,6 +5,7 @@ -? lineTotalAmount is null ? be able to access ID in error message ? log error IDs +- closes #579 2.15.0 diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java index 46594a26..7c1001e5 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java @@ -324,7 +324,7 @@ public class ZUGFeRDInvoiceImporter { } } - xpr = xpath.compile("//*[local-name()=\"PrepaidAmount\"]"); + xpr = xpath.compile("//*[local-name()=\"TotalPrepaidAmount\"]|//*[local-name()=\"PrepaidAmount\"]"); NodeList prepaidNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET); if (prepaidNodes.getLength() > 0) { zpp.setTotalPrepaidAmount(new BigDecimal(XMLTools.trimOrNull(prepaidNodes.item(0)))); diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java index b9342e1e..e07e2794 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ZF2ZInvoiceImporterTest.java @@ -377,6 +377,25 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase { } + @Test + public void testImportPrepaid() throws XPathExpressionException, ParseException { + InputStream inputStream = this.getClass() + .getResourceAsStream("/EN16931_1_Teilrechnung.pdf"); + ZUGFeRDInvoiceImporter importer = new ZUGFeRDInvoiceImporter(); + importer.doIgnoreCalculationErrors(); + importer.setInputStream(inputStream); + Invoice invoice = importer.extractInvoice(); + boolean isBD=invoice.getTotalPrepaidAmount() instanceof BigDecimal; + assertTrue(isBD); + BigDecimal expected=new BigDecimal(50); + if (isBD) { + BigDecimal amread=invoice.getTotalPrepaidAmount(); + assertTrue(amread.compareTo(expected) == 0); + } + + } + + @Test public void testImportIncludedNotes() throws XPathExpressionException, ParseException { InputStream inputStream = this.getClass() diff --git a/library/src/test/resources/EN16931_1_Teilrechnung.pdf b/library/src/test/resources/EN16931_1_Teilrechnung.pdf new file mode 100644 index 00000000..0bc3ea77 Binary files /dev/null and b/library/src/test/resources/EN16931_1_Teilrechnung.pdf differ