- also parse BICs in InvoiceImporter not only IBANs

This commit is contained in:
jstaerk
2024-10-10 10:53:41 +02:00
parent 2b16f53c12
commit 2a00af8768
3 changed files with 16 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
- also parse BICs in InvoiceImporter not only IBANs
- #509 CLI currently does not write a logfile - #509 CLI currently does not write a logfile
2.14.1 2.14.1

View File

@@ -237,8 +237,8 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
if ((headerTradeSettlementChilds.item(settlementChildIndex).getLocalName() != null) if ((headerTradeSettlementChilds.item(settlementChildIndex).getLocalName() != null)
&& (headerTradeSettlementChilds.item(settlementChildIndex).getLocalName().equals("SpecifiedTradeSettlementPaymentMeans"))) { && (headerTradeSettlementChilds.item(settlementChildIndex).getLocalName().equals("SpecifiedTradeSettlementPaymentMeans"))) {
NodeList paymentMeansChilds = headerTradeSettlementChilds.item(settlementChildIndex).getChildNodes(); NodeList paymentMeansChilds = headerTradeSettlementChilds.item(settlementChildIndex).getChildNodes();
String IBAN = null, BIC = null;
for (int paymentMeansChildIndex = 0; paymentMeansChildIndex < paymentMeansChilds.getLength(); paymentMeansChildIndex++) { for (int paymentMeansChildIndex = 0; paymentMeansChildIndex < paymentMeansChilds.getLength(); paymentMeansChildIndex++) {
String IBAN = null, BIC = null;
if ((paymentMeansChilds.item(paymentMeansChildIndex).getLocalName() != null) && (paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("PayeePartyCreditorFinancialAccount"))) { if ((paymentMeansChilds.item(paymentMeansChildIndex).getLocalName() != null) && (paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("PayeePartyCreditorFinancialAccount"))) {
NodeList accountChilds = paymentMeansChilds.item(paymentMeansChildIndex).getChildNodes(); NodeList accountChilds = paymentMeansChilds.item(paymentMeansChildIndex).getChildNodes();
for (int accountChildIndex = 0; accountChildIndex < accountChilds.getLength(); accountChildIndex++) { for (int accountChildIndex = 0; accountChildIndex < accountChilds.getLength(); accountChildIndex++) {
@@ -247,7 +247,7 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
} }
} }
} }
if ((paymentMeansChilds.item(paymentMeansChildIndex).getLocalName() != null) && (paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("PayeePartyCreditorFinancialInstitution"))) { if ((paymentMeansChilds.item(paymentMeansChildIndex).getLocalName() != null) && (paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("PayeeSpecifiedCreditorFinancialInstitution"))) {
NodeList accountChilds = paymentMeansChilds.item(paymentMeansChildIndex).getChildNodes(); NodeList accountChilds = paymentMeansChilds.item(paymentMeansChildIndex).getChildNodes();
for (int accountChildIndex = 0; accountChildIndex < accountChilds.getLength(); accountChildIndex++) { for (int accountChildIndex = 0; accountChildIndex < accountChilds.getLength(); accountChildIndex++) {
if ((accountChilds.item(accountChildIndex).getLocalName() != null) && (accountChilds.item(accountChildIndex).getLocalName().equals("BICID"))) {//CII if ((accountChilds.item(accountChildIndex).getLocalName() != null) && (accountChilds.item(accountChildIndex).getLocalName().equals("BICID"))) {//CII
@@ -255,13 +255,14 @@ public class ZUGFeRDInvoiceImporter extends ZUGFeRDImporter {
} }
} }
} }
if (IBAN != null) {
BankDetails bd = new BankDetails(IBAN); }
if (BIC != null) { if (IBAN != null) {
bd.setBIC(BIC); BankDetails bd = new BankDetails(IBAN);
} if (BIC != null) {
bankDetails.add(bd); bd.setBIC(BIC);
} }
bankDetails.add(bd);
} }
} }
} }

View File

@@ -287,6 +287,12 @@ public class ZF2ZInvoiceImporterTest extends ResourceCase {
assertFalse(hasExceptions); assertFalse(hasExceptions);
TransactionCalculator tc = new TransactionCalculator(invoice); TransactionCalculator tc = new TransactionCalculator(invoice);
assertEquals(new BigDecimal("1.00"), tc.getGrandTotal()); assertEquals(new BigDecimal("1.00"), tc.getGrandTotal());
assertTrue(invoice.getTradeSettlement().length==1);
assertTrue(invoice.getTradeSettlement()[0] instanceof IZUGFeRDTradeSettlementPayment);
IZUGFeRDTradeSettlementPayment paym=(IZUGFeRDTradeSettlementPayment)invoice.getTradeSettlement()[0];
assertEquals("DE12500105170648489890", paym.getOwnIBAN());
assertEquals("COBADEFXXX", paym.getOwnBIC());
assertTrue(invoice.getPayee() != null); assertTrue(invoice.getPayee() != null);
assertEquals("VR Factoring GmbH", invoice.getPayee().getName()); assertEquals("VR Factoring GmbH", invoice.getPayee().getName());