This commit is contained in:
jstaerk
2025-01-14 13:47:37 +01:00
parent 8d7a3a9d6d
commit 4a410bcd14
3 changed files with 28 additions and 1 deletions

View File

@@ -1,5 +1,6 @@
- #678 - #678
- #679 - #679
- #681
2.16.0 2.16.0
======= =======

View File

@@ -813,9 +813,11 @@ public class ZUGFeRDInvoiceImporter {
d.setPaymentMeansInformation(paymentMeansInformation); d.setPaymentMeansInformation(paymentMeansInformation);
} }
zpp.getSender().addDebitDetails(d); zpp.getSender().addDebitDetails(d);
bankDetails.forEach(bankDetail -> zpp.getRecipient().addBankDetails(bankDetail));
} else {
bankDetails.forEach(bankDetail -> zpp.getSender().addBankDetails(bankDetail));
} }
bankDetails.forEach(bankDetail -> zpp.getSender().addBankDetails(bankDetail));
if (payeeNodes.getLength() > 0) { if (payeeNodes.getLength() > 0) {
zpp.setPayee(new TradeParty(payeeNodes)); zpp.setPayee(new TradeParty(payeeNodes));

View File

@@ -467,6 +467,30 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
} }
@Test
public void testIBANparsing() throws XPathExpressionException, ParseException, FileNotFoundException {
File inputFile = getResourceAsFile("cii/minimalDebit.xml");
ZUGFeRDInvoiceImporter importer = new ZUGFeRDInvoiceImporter(new FileInputStream(inputFile));
Invoice invoice = importer.extractInvoice();
assertEquals(1,invoice.getRecipient().getBankDetails().size());
// IBAN belongs to recipient in invoice with sepa debit
assertEquals("DE21860000000086001055",invoice.getRecipient().getBankDetails().get(0).getIBAN());
assertEquals(0,invoice.getSender().getBankDetails().size());
inputFile = getResourceAsFile("factur-x.xml");
importer = new ZUGFeRDInvoiceImporter(new FileInputStream(inputFile));
invoice = importer.extractInvoice();
assertEquals(1,invoice.getSender().getBankDetails().size());
// IBAN belongs to sender in normal invoice
assertEquals("DE88200800000970375700",invoice.getSender().getBankDetails().get(0).getIBAN());
assertEquals(0,invoice.getRecipient().getBankDetails().size());
}
@Test @Test
public void testImportPositionIncludedNotes() throws FileNotFoundException, XPathExpressionException, ParseException { public void testImportPositionIncludedNotes() throws FileNotFoundException, XPathExpressionException, ParseException {
File inputFile = getResourceAsFile("ZTESTZUGFERD_1_INVDSS_012015738820PDF-1.pdf"); File inputFile = getResourceAsFile("ZTESTZUGFERD_1_INVDSS_012015738820PDF-1.pdf");