This commit is contained in:
jstaerk
2024-11-25 11:02:26 +01:00
parent 15b99832c4
commit c5f5581aa8
4 changed files with 21 additions and 1 deletions

View File

@@ -5,6 +5,7 @@
-? lineTotalAmount is null
? be able to access ID in error message
? log error IDs
- closes #579
2.15.0

View File

@@ -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))));

View File

@@ -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()

Binary file not shown.