Merge pull request #78 from HardyLoppmann/master

Add BLZ&Kto.-Nr
This commit is contained in:
Jochen Staerk
2019-04-02 21:21:47 +02:00
committed by GitHub
16 changed files with 186 additions and 21 deletions

9
.gitignore vendored
View File

@@ -6,3 +6,12 @@ target/
pom.xml.*
bin/
/.gradle/
# ignore intelliJ foobar
*.iml
.idea
# ignore test files
ZUGFeRD-*-test
dependency-reduced-pom.xml

View File

@@ -26,7 +26,7 @@ Migrated by Mustangproject XSLT
<ram:LineID>1</ram:LineID>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:Name>Künstlerische Gestaltung (Stunde): Einer Beispielrechnung</ram:Name>
<ram:Name>Künstlerische Gestaltung (Stunde): Einer Beispielrechnung</ram:Name>
<ram:Description/>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
@@ -90,7 +90,7 @@ Migrated by Mustangproject XSLT
<ram:LineID>3</ram:LineID>
</ram:AssociatedDocumentLineDocument>
<ram:SpecifiedTradeProduct>
<ram:Name>Heiße Luft pro Liter</ram:Name>
<ram:Name>Heiße Luft pro Liter</ram:Name>
<ram:Description/>
</ram:SpecifiedTradeProduct>
<ram:SpecifiedLineTradeAgreement>
@@ -158,12 +158,14 @@ Migrated by Mustangproject XSLT
<ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>
<ram:SpecifiedTradeSettlementPaymentMeans>
<ram:TypeCode>42</ram:TypeCode>
<ram:Information>Überweisung</ram:Information>
<ram:Information>Überweisung</ram:Information>
<ram:PayeePartyCreditorFinancialAccount>
<ram:IBANID>DE88 2008 0000 0970 3757 00</ram:IBANID>
<ram:ProprietaryID>44421800</ram:ProprietaryID>
</ram:PayeePartyCreditorFinancialAccount>
<ram:PayeeSpecifiedCreditorFinancialInstitution>
<ram:BICID>COBADEFFXXX</ram:BICID>
<ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>
<ram:Name>Commerzbank</ram:Name>
</ram:PayeeSpecifiedCreditorFinancialInstitution>
</ram:SpecifiedTradeSettlementPaymentMeans>

View File

@@ -39,8 +39,8 @@
<additionalparam>-Xdoclint:none</additionalparam>
<!-- Skip error check for javadoc -->
<maven.compiler.compilerVersion>1.7</maven.compiler.compilerVersion>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/net.sf.saxon/Saxon-HE -->

View File

@@ -83,7 +83,13 @@ public interface IZUGFeRDExportableTransaction {
*/
String getOwnBIC();
/***
/***
* BLZ of the sender
* @return the BLZ code of the recipient sender's bank
*/
String getOwnBLZ();
/***
* Bank name of the sender
* @return the name of the sender's bank
*/
@@ -95,7 +101,13 @@ public interface IZUGFeRDExportableTransaction {
*/
String getOwnIBAN();
/**
/**
* IBAN of the sender
* @return the Account Number of the invoice sender's bank account
*/
String getOwnKto();
/**
* Tax ID (not VAT ID) of the sender
* @return Tax ID (not VAT ID) of the sender
*/

View File

@@ -344,9 +344,11 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ " <ram:Information>Überweisung</ram:Information>\n" //$NON-NLS-1$
+ " <ram:PayeePartyCreditorFinancialAccount>\n" //$NON-NLS-1$
+ " <ram:IBANID>"+trans.getOwnIBAN()+"</ram:IBANID>\n" //$NON-NLS-1$ //$NON-NLS-2$
+ " <ram:ProprietaryID>"+trans.getOwnKto()+"</ram:ProprietaryID>\n" //$NON-NLS-1$ //$NON-NLS-2$
+ " </ram:PayeePartyCreditorFinancialAccount>\n" //$NON-NLS-1$
+ " <ram:PayeeSpecifiedCreditorFinancialInstitution>\n" //$NON-NLS-1$
+ " <ram:BICID>"+trans.getOwnBIC()+"</ram:BICID>\n" //$NON-NLS-1$ //$NON-NLS-2$
+ " <ram:GermanBankleitzahlID>"+ trans.getOwnBLZ()+"</ram:GermanBankleitzahlID>\n" //$NON-NLS-1$ //$NON-NLS-2$
// + " <ram:Name>"+trans.getOwnBankName()+"</ram:Name>\n" //$NON-NLS-1$ //$NON-NLS-2$
+ " </ram:PayeeSpecifiedCreditorFinancialInstitution>\n" //$NON-NLS-1$
+ " </ram:SpecifiedTradeSettlementPaymentMeans>\n"; //$NON-NLS-1$

View File

@@ -161,7 +161,7 @@ public class ZUGFeRDExporter implements Closeable {
public static String getFilenameForVersion(int ver) {
if (ver == 1) {
return "ZUGFeRD-invoice.xml";
} else if (ver == 2)&&(isFacturX) {
} else if ((ver == 2) || (isFacturX)) {
return "factur-x.xml";
} else {
throw new IllegalArgumentException("Version not supported");

View File

@@ -63,8 +63,10 @@ public class ZUGFeRDImporter {
private boolean containsMeta = false;
/** @var the reference (i.e. invoice number) of the sender */
private String foreignReference;
private String BLZ;
private String BIC;
private String IBAN;
private String KTO;
private String holder;
private String amount;
private String dueDate;
@@ -127,7 +129,7 @@ public class ZUGFeRDImporter {
//start
InputStream XMP=doc.getDocumentCatalog().getMetadata().exportXMPMetadata();
xmpString=convertStreamToString(XMP);
xmpString=convertStreamToString(XMP);
etn = names.getEmbeddedFiles();
if (etn == null) {
return;
@@ -283,9 +285,12 @@ public class ZUGFeRDImporter {
Node detail = bookingDetails.item(detailIndex);
if ((detail.getLocalName() != null) && (detail.getLocalName().equals("IBANID"))) { //$NON-NLS-1$
setIBAN(detail.getTextContent());
}
}
if ((detail.getLocalName() != null) && (detail.getLocalName().equals("ProprietaryID"))) { //$NON-NLS-1$
setKTO(detail.getTextContent());
}
}
}
ndList = document.getElementsByTagNameNS("*", "PayeeSpecifiedCreditorFinancialInstitution");// ZF1 //$NON-NLS-1$
@@ -299,6 +304,9 @@ public class ZUGFeRDImporter {
if ((detail.getLocalName() != null) && (detail.getLocalName().equals("BICID"))) { //$NON-NLS-1$
setBIC(detail.getTextContent());
}
if ((detail.getLocalName() != null) && (detail.getLocalName().equals("GermanBankleitzahlID"))) { //$NON-NLS-1$
setBLZ(detail.getTextContent());
}
if ((detail.getLocalName() != null) && (detail.getLocalName().equals("Name"))) { //$NON-NLS-1$
setBankName(detail.getTextContent());
}
@@ -393,6 +401,24 @@ public class ZUGFeRDImporter {
this.foreignReference = foreignReference;
}
/**
*
* @return the sender's bank's BLZ code
*/
public String getBLZ() {
if (!parsed) {
throw new RuntimeException("use extract() before requesting a value");
}
if (BLZ==null) {
parse();
}
return BLZ;
}
private void setBLZ(String blz) {
this.BLZ = blz;
}
/**
*
* @return the sender's bank's BIC code
@@ -433,7 +459,21 @@ public class ZUGFeRDImporter {
return IBAN;
}
/**
/**
*
* @return the sender's KTO
*/
public String getKTO() {
if (!parsed) {
throw new RuntimeException("use extract() before requesting a value");
}
if (KTO==null) {
parse();
}
return KTO;
}
/**
*
* @return the sender's bank name
*/
@@ -451,7 +491,11 @@ public class ZUGFeRDImporter {
this.IBAN = IBAN;
}
/**
private void setKTO(String KTO) {
this.KTO = KTO;
}
/**
*
* @return the name of the owner of the sender's bank account
*/

View File

@@ -363,6 +363,9 @@ class ZUGFeRDTransactionModelConverter {
IDType iban = xmlFactory.createIDType();
iban.setValue(trans.getOwnIBAN());
bankAccount.setIBANID(iban);
IDType kto = xmlFactory.createIDType();
kto.setValue(trans.getOwnKto());
bankAccount.setProprietaryID(kto);
paymentData.setPayeePartyCreditorFinancialAccount(bankAccount);
CreditorFinancialInstitutionType bankData = xmlFactory
@@ -373,6 +376,10 @@ class ZUGFeRDTransactionModelConverter {
TextType bankName = xmlFactory.createTextType();
bankName.setValue(trans.getOwnBankName());
bankData.setName(bankName);
IDType blz = xmlFactory.createIDType();
blz.setValue(trans.getOwnBLZ());
bankData.setGermanBankleitzahlID(blz);
paymentData.setPayeeSpecifiedCreditorFinancialInstitution(bankData);
return paymentData;
}

View File

@@ -30,6 +30,8 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
private IZUGFeRDAllowanceCharge[] zFLogisticsServiceCharges;
private IZUGFeRDExportableItem[] zFItems;
private IZUGFeRDExportableContact recipient;
private String ownKto;
private String ownBLZ;
private String ownBIC;
private String ownBankName;
private String ownIBAN;
@@ -91,6 +93,16 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
return recipient;
}
@Override
public String getOwnKto() {
return ownKto;
}
@Override
public String getOwnBLZ() {
return ownBLZ;
}
@Override
public String getOwnBIC() {
return ownBIC;
@@ -211,6 +223,11 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnBLZ(String ownBLZ) {
this.ownBLZ = ownBLZ;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnBIC(String ownBIC) {
this.ownBIC = ownBIC;
return this;
@@ -221,6 +238,11 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnKto(String ownKto) {
this.ownKto = ownKto;
return this;
}
public IZUGFeRDExportableTransactionImpl setOwnIBAN(String ownIBAN) {
this.ownIBAN = ownIBAN;
return this;

View File

@@ -216,10 +216,12 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
" <ram:TypeCode>42</ram:TypeCode>\n" +
" <ram:Information>Überweisung</ram:Information>\n" +
" <ram:PayeePartyCreditorFinancialAccount>\n" +
" <ram:IBANID>DE88 2008 0000 0970 3757 00</ram:IBANID>\n" +
" </ram:PayeePartyCreditorFinancialAccount>\n" +
" <ram:IBANID>DE88 2008 0000 0970 3757 00</ram:IBANID>\n" +
" <ram:ProprietaryID>44421800</ram:ProprietaryID>\n" +
" </ram:PayeePartyCreditorFinancialAccount>\n" +
" <ram:PayeeSpecifiedCreditorFinancialInstitution>\n" +
" <ram:BICID>COBADEFFXXX</ram:BICID>\n" +
" <ram:BICID>COBADEFFXXX</ram:BICID>\n" +
" <ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>\n" +
" <ram:Name>Commerzbank</ram:Name>\n" +
" </ram:PayeeSpecifiedCreditorFinancialInstitution>\n" +
" </ram:SpecifiedTradeSettlementPaymentMeans>\n" +
@@ -276,22 +278,28 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
String amount = null;
String bic = null;
String blz = null;
String iban = null;
String kto = null;
String holder = null;
String ref = null;
if (zi.canParse()) {
zi.parse();
amount = zi.getAmount();
blz = zi.getBLZ();
bic = zi.getBIC();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
ref = zi.getForeignReference();
}
assertEquals(amount, "571.04");
assertEquals(blz, "41441604");
assertEquals(bic, "COBADEFFXXX");
assertEquals(iban, "DE88 2008 0000 0970 3757 00");
assertEquals(kto, "44421800");
assertEquals(holder, "Bei Spiel GmbH");
assertEquals(ref, "RE-20171118/506");
}
@@ -350,9 +358,13 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
+ "<ram:SpecifiedTradeSettlementPaymentMeans>\n" + "<ram:TypeCode>42</ram:TypeCode>\n"
+ "<ram:Information>Überweisung</ram:Information>\n" + "<ram:PayeePartyCreditorFinancialAccount>\n"
+ "<ram:IBANID>DE88 2008 0000 0970 3757 00</ram:IBANID>\n"
+ "<ram:ProprietaryID>44421800</ram:ProprietaryID>\n"
+ "</ram:PayeePartyCreditorFinancialAccount>\n"
+ "<ram:PayeeSpecifiedCreditorFinancialInstitution>\n" + "<ram:BICID>COBADEFFXXX</ram:BICID>\n"
+ "<ram:Name>Commerzbank</ram:Name>\n" + "</ram:PayeeSpecifiedCreditorFinancialInstitution>\n"
+ "<ram:PayeeSpecifiedCreditorFinancialInstitution>\n"
+ "<ram:BICID>COBADEFFXXX</ram:BICID>\n"
+ "<ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>\n"
+ "<ram:Name>Commerzbank</ram:Name>\n"
+ "</ram:PayeeSpecifiedCreditorFinancialInstitution>\n"
+ "</ram:SpecifiedTradeSettlementPaymentMeans>\n" + "<ram:ApplicableTradeTax>\n"
+ "<ram:CalculatedAmount currencyID=\"EUR\">11.20</ram:CalculatedAmount>\n"
+ "<ram:TypeCode>VAT</ram:TypeCode>\n"
@@ -467,7 +479,9 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
String amount = null;
String bic = null;
String blz = null;
String iban = null;
String kto = null;
String holder = null;
String ref = null;
@@ -475,14 +489,18 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
zi.parse();
amount = zi.getAmount();
bic = zi.getBIC();
blz = zi.getBLZ();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
ref = zi.getForeignReference();
}
assertEquals(amount, "571.04");
assertEquals(bic, "COBADEFFXXX");
assertEquals(blz, "41441604");
assertEquals(iban, "DE88 2008 0000 0970 3757 00");
assertEquals(kto, "44421800");
assertEquals(holder, "Bei Spiel GmbH");
assertEquals(ref, "RE-20170509/505");
}

View File

@@ -59,6 +59,18 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
return "RE-20170509/505";
}
@Override
public String getOwnKto()
{
return "44421800";
}
@Override
public String getOwnBLZ()
{
return "41441604";
}
@Override
public String getOwnBIC()
{
@@ -364,7 +376,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
// //////// TESTS //////////////////////////////////////////////////////////////////////////////////////////
/**
* The importer test imports from ./src/test/MustangGnuaccountingBeispielRE-20151008_504.pdf to check the values.
* The importer test imports from ./src/test/MustangGnuaccountingBeispielRE-20170509_505.pdf to check the values.
* --> as only Name Ascending is supported for Test Unit sequence, I renamed the this test-A-Export to run before
* testZExport
*
@@ -379,7 +391,9 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
String amount = null;
String bic = null;
String blz = null;
String iban = null;
String kto = null;
String holder = null;
String ref = null;
String dueDate = null;
@@ -389,7 +403,9 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
zi.parse();
amount = zi.getAmount();
bic = zi.getBIC();
blz = zi.getBLZ();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
dueDate = zi.getDueDate();
ref = zi.getForeignReference();
@@ -397,7 +413,9 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
assertEquals(amount, "571.04");
assertEquals(bic, getOwnBIC());
assertEquals(blz, getOwnBLZ());
assertEquals(iban, getOwnIBAN());
assertEquals(kto, getOwnKto());
assertEquals(holder, getOwnOrganisationName());
assertEquals(dueDate, "20170530");
@@ -439,7 +457,9 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
String amount = null;
String bic = null;
String blz = null;
String iban = null;
String kto = null;
String holder = null;
String ref = null;
@@ -448,14 +468,18 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
zi.parse();
amount = zi.getAmount();
bic = zi.getBIC();
blz = zi.getBLZ();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
ref = zi.getForeignReference();
}
assertEquals(amount, "571.04");
assertEquals(bic, getOwnBIC());
assertEquals(blz, getOwnBLZ());
assertEquals(iban, getOwnIBAN());
assertEquals(kto, getOwnKto());
assertEquals(holder, getOwnOrganisationName());
assertEquals(ref, getNumber());

View File

@@ -56,7 +56,17 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
return "RE-20171118/506";
}
@Override
@Override
public String getOwnKto() {
return "44421800";
}
@Override
public String getOwnBLZ() {
return "41441604";
}
@Override
public String getOwnBIC() {
return "COBADEFFXXX";
}
@@ -345,23 +355,29 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
// Reading ZUGFeRD
String amount = null;
String blz = null;
String bic = null;
String iban = null;
String kto = null;
String holder = null;
String ref = null;
if (zi.canParse()) {
zi.parse();
amount = zi.getAmount();
blz = zi.getBLZ();
bic = zi.getBIC();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
ref = zi.getForeignReference();
}
// this resembles the data written in MustangReaderWriterCustomXMLTest
assertEquals(amount, "571.04");
assertEquals(bic, "COBADEFFXXX");
assertEquals(blz, "41441604");
assertEquals(bic, "COBADEFFXXX");
assertEquals(iban, "DE88 2008 0000 0970 3757 00");
assertEquals(kto, "44421800");
assertEquals(holder, "Bei Spiel GmbH");
assertEquals(ref, "RE-20170509/505");
@@ -514,6 +530,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
String amount = null;
String bic = null;
String iban = null;
String kto = null;
String holder = null;
String ref = null;
if (zi.canParse()) {
@@ -521,6 +538,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
amount = zi.getAmount();
bic = zi.getBIC();
iban = zi.getIBAN();
kto = zi.getKTO();
holder = zi.getHolder();
ref = zi.getForeignReference();
}
@@ -528,6 +546,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
assertEquals(amount, "571.04");
assertEquals(bic, getOwnBIC());
assertEquals(iban, getOwnIBAN());
assertEquals(kto, getOwnKto());
assertEquals(holder, getOwnOrganisationName());
assertEquals(ref, getNumber());

View File

@@ -77,9 +77,11 @@
<ram:Information>Überweisung</ram:Information>
<ram:PayeePartyCreditorFinancialAccount>
<ram:IBANID>DE88 2008 0000 0970 3757 00</ram:IBANID>
<ram:ProprietaryID>44421800</ram:ProprietaryID>
</ram:PayeePartyCreditorFinancialAccount>
<ram:PayeeSpecifiedCreditorFinancialInstitution>
<ram:BICID>COBADEFFXXX</ram:BICID>
<ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>
<ram:Name>Commerzbank</ram:Name>
</ram:PayeeSpecifiedCreditorFinancialInstitution>
</ram:SpecifiedTradeSettlementPaymentMeans>

View File

@@ -77,9 +77,11 @@
<ram:Information>Überweisung</ram:Information>
<ram:PayeePartyCreditorFinancialAccount>
<ram:IBANID>DE88 2008 0000 0970 3757 00</ram:IBANID>
<ram:ProprietaryID>44421800</ram:ProprietaryID>
</ram:PayeePartyCreditorFinancialAccount>
<ram:PayeeSpecifiedCreditorFinancialInstitution>
<ram:BICID>COBADEFFXXX</ram:BICID>
<ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>
<ram:Name>Commerzbank</ram:Name>
</ram:PayeeSpecifiedCreditorFinancialInstitution>
</ram:SpecifiedTradeSettlementPaymentMeans>

View File

@@ -177,9 +177,11 @@ Migrated by Mustangproject XSLT
<ram:Information>Überweisung</ram:Information>
<ram:PayeePartyCreditorFinancialAccount>
<ram:IBANID>DE88 2008 0000 0970 3757 00</ram:IBANID>
<ram:ProprietaryID>44421800</ram:ProprietaryID>
</ram:PayeePartyCreditorFinancialAccount>
<ram:PayeeSpecifiedCreditorFinancialInstitution>
<ram:BICID>COBADEFFXXX</ram:BICID>
<ram:GermanBankleitzahlID>41441604</ram:GermanBankleitzahlID>
<ram:Name>Commerzbank</ram:Name>
</ram:PayeeSpecifiedCreditorFinancialInstitution>
</ram:SpecifiedTradeSettlementPaymentMeans>