Merge branch 'ZUGFeRD:master' into fix-logback
This commit is contained in:
@@ -20,6 +20,16 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
|
|||||||
*/
|
*/
|
||||||
protected String mandate;
|
protected String mandate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* payment means code (BT-81 / UNTDID 4461)
|
||||||
|
*/
|
||||||
|
protected String paymentMeansCode = "59";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Payment means description (BT-82)
|
||||||
|
*/
|
||||||
|
protected String paymentMeansInformation = "SEPA direct debit";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* bean constructor
|
* bean constructor
|
||||||
*/
|
*/
|
||||||
@@ -38,6 +48,16 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
|
|||||||
this.mandate = mandate;
|
this.mandate = mandate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DirectDebit setPaymentMeansCode(String paymentMeansCode) {
|
||||||
|
this.paymentMeansCode = paymentMeansCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DirectDebit setPaymentMeansInformation(String paymentMeansInformation) {
|
||||||
|
this.paymentMeansInformation = paymentMeansInformation;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* getter for the IBAN
|
* getter for the IBAN
|
||||||
* @return IBAN
|
* @return IBAN
|
||||||
@@ -57,6 +77,16 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
|
|||||||
return this.mandate;
|
return this.mandate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentMeansCode() {
|
||||||
|
return this.paymentMeansCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentMeansInformation() {
|
||||||
|
return this.paymentMeansInformation;
|
||||||
|
}
|
||||||
|
|
||||||
public DirectDebit setMandate(String mandate) {
|
public DirectDebit setMandate(String mandate) {
|
||||||
this.mandate = mandate;
|
this.mandate = mandate;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -324,19 +324,20 @@ public interface IExportableTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* supplier identification assigned by the costumer
|
* get the rounding amount
|
||||||
|
* (only to be usef for NL whose currency requires a rounding to 5ct)
|
||||||
*
|
*
|
||||||
* @return the sender's identification
|
* @return the Bigdecimal
|
||||||
*/
|
*/
|
||||||
default BigDecimal getRoundingAmount() {
|
default BigDecimal getRoundingAmount() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get reference document number typically used for Invoice Corrections Will be
|
* get BuyerReference (BT-10) an identifier assigned by the buyer and used
|
||||||
* added as IncludedNote in comfort profile
|
* for internal routing. Used for the Leitweg-ID.
|
||||||
*
|
*
|
||||||
* @return the ID of the document this document refers to
|
* @return the BuyerReference of this document
|
||||||
*/
|
*/
|
||||||
default String getReferenceNumber() {
|
default String getReferenceNumber() {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ public interface IZUGFeRDTradeSettlementDebit extends IZUGFeRDTradeSettlement {
|
|||||||
@Override
|
@Override
|
||||||
default String getSettlementXML() {
|
default String getSettlementXML() {
|
||||||
String xml = "<ram:SpecifiedTradeSettlementPaymentMeans>"
|
String xml = "<ram:SpecifiedTradeSettlementPaymentMeans>"
|
||||||
+ "<ram:TypeCode>59</ram:TypeCode>"
|
+ "<ram:TypeCode>" + XMLTools.encodeXML(getPaymentMeansCode()) + "</ram:TypeCode>"
|
||||||
+ "<ram:Information>SEPA direct debit</ram:Information>"
|
+ "<ram:Information>" + XMLTools.encodeXML(getPaymentMeansInformation()) + "</ram:Information>"
|
||||||
+ "<ram:PayerPartyDebtorFinancialAccount>"
|
+ "<ram:PayerPartyDebtorFinancialAccount>"
|
||||||
+ "<ram:IBANID>" + XMLTools.encodeXML(getIBAN()) + "</ram:IBANID>"
|
+ "<ram:IBANID>" + XMLTools.encodeXML(getIBAN()) + "</ram:IBANID>"
|
||||||
+ "</ram:PayerPartyDebtorFinancialAccount>";
|
+ "</ram:PayerPartyDebtorFinancialAccount>";
|
||||||
@@ -51,4 +51,14 @@ public interface IZUGFeRDTradeSettlementDebit extends IZUGFeRDTradeSettlement {
|
|||||||
*/
|
*/
|
||||||
String getMandate();
|
String getMandate();
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @return payment means code (BT-81 / UNTDID 4461)
|
||||||
|
*/
|
||||||
|
String getPaymentMeansCode();
|
||||||
|
|
||||||
|
/***
|
||||||
|
* @return payment means description (BT-82) (optional)
|
||||||
|
*/
|
||||||
|
String getPaymentMeansInformation();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
NodeList headerTradeSettlementNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
NodeList headerTradeSettlementNodes = (NodeList) xpr.evaluate(getDocument(), XPathConstants.NODESET);
|
||||||
List<BankDetails> bankDetails = new ArrayList<>();
|
List<BankDetails> bankDetails = new ArrayList<>();
|
||||||
String directDebitMandateID = null;
|
String directDebitMandateID = null;
|
||||||
String IBAN = null, BIC = null;
|
String IBAN = null, BIC = null, paymentMeansCode = null, paymentMeansInformation = null;
|
||||||
|
|
||||||
for (int i = 0; i < headerTradeSettlementNodes.getLength(); i++) {
|
for (int i = 0; i < headerTradeSettlementNodes.getLength(); i++) {
|
||||||
// XMLTools.trimOrNull(nodes.item(i)))) {
|
// XMLTools.trimOrNull(nodes.item(i)))) {
|
||||||
@@ -693,8 +693,18 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
NodeList paymentMeansChilds = headerTradeSettlementChilds.item(settlementChildIndex).getChildNodes();
|
NodeList paymentMeansChilds = headerTradeSettlementChilds.item(settlementChildIndex).getChildNodes();
|
||||||
IBAN = null;
|
IBAN = null;
|
||||||
BIC = null;
|
BIC = null;
|
||||||
|
paymentMeansCode = null;
|
||||||
|
paymentMeansInformation = null;
|
||||||
for (int paymentMeansChildIndex = 0; paymentMeansChildIndex < paymentMeansChilds.getLength(); paymentMeansChildIndex++) {
|
for (int paymentMeansChildIndex = 0; paymentMeansChildIndex < paymentMeansChilds.getLength(); paymentMeansChildIndex++) {
|
||||||
|
|
||||||
|
if ((paymentMeansChilds.item(paymentMeansChildIndex).getLocalName() != null) && (paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("TypeCode"))) {
|
||||||
|
paymentMeansCode = XMLTools.trimOrNull(paymentMeansChilds.item(paymentMeansChildIndex));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((paymentMeansChilds.item(paymentMeansChildIndex).getLocalName() != null) && (paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("Information"))) {
|
||||||
|
paymentMeansInformation = XMLTools.trimOrNull(paymentMeansChilds.item(paymentMeansChildIndex));
|
||||||
|
}
|
||||||
|
|
||||||
if ((paymentMeansChilds.item(paymentMeansChildIndex).getLocalName() != null) && (paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("PayeePartyCreditorFinancialAccount") || paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("PayerPartyDebtorFinancialAccount"))) {
|
if ((paymentMeansChilds.item(paymentMeansChildIndex).getLocalName() != null) && (paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("PayeePartyCreditorFinancialAccount") || paymentMeansChilds.item(paymentMeansChildIndex).getLocalName().equals("PayerPartyDebtorFinancialAccount"))) {
|
||||||
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++) {
|
||||||
@@ -795,6 +805,12 @@ public class ZUGFeRDInvoiceImporter {
|
|||||||
|
|
||||||
if ((directDebitMandateID != null) && (IBAN != null)) {
|
if ((directDebitMandateID != null) && (IBAN != null)) {
|
||||||
DirectDebit d = new DirectDebit(IBAN, directDebitMandateID);
|
DirectDebit d = new DirectDebit(IBAN, directDebitMandateID);
|
||||||
|
if (paymentMeansCode != null) {
|
||||||
|
d.setPaymentMeansCode(paymentMeansCode);
|
||||||
|
}
|
||||||
|
if (paymentMeansInformation != null) {
|
||||||
|
d.setPaymentMeansInformation(paymentMeansInformation);
|
||||||
|
}
|
||||||
zpp.getSender().addDebitDetails(d);
|
zpp.getSender().addDebitDetails(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,6 +109,16 @@ public class DXTest extends MustangReaderTestCase {
|
|||||||
return "DE99XX12345";
|
return "DE99XX12345";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentMeansCode() {
|
||||||
|
return "54";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentMeansInformation() {
|
||||||
|
return "Credit Card";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -106,6 +106,16 @@ public class OXTest extends MustangReaderTestCase {
|
|||||||
return "DE99XX12345";
|
return "DE99XX12345";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentMeansCode() {
|
||||||
|
return "54";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentMeansInformation() {
|
||||||
|
return "Credit Card";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -100,6 +100,16 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
|
|||||||
return "DE99XX12345";
|
return "DE99XX12345";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentMeansCode() {
|
||||||
|
return "54";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentMeansInformation() {
|
||||||
|
return "Credit Card";
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -264,6 +274,16 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
|
|||||||
return "123";
|
return "123";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentMeansCode() {
|
||||||
|
return "42";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getPaymentMeansInformation() {
|
||||||
|
return "Überweisung";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the test case
|
* Create the test case
|
||||||
*
|
*
|
||||||
@@ -314,7 +334,8 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
|
|||||||
// now check the contents (like MustangReaderTest)
|
// now check the contents (like MustangReaderTest)
|
||||||
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
||||||
String resultXML=zi.getUTF8();
|
String resultXML=zi.getUTF8();
|
||||||
assertTrue(resultXML.contains("<ram:TypeCode>59</ram:TypeCode>"));
|
assertTrue(resultXML.contains("<ram:TypeCode>54</ram:TypeCode>"));
|
||||||
|
assertTrue(resultXML.contains("<ram:Information>Credit Card</ram:Information>"));
|
||||||
assertTrue(resultXML.contains("<ram:ShipToTradeParty>"));
|
assertTrue(resultXML.contains("<ram:ShipToTradeParty>"));
|
||||||
assertTrue(resultXML.contains("<ram:IBANID>DE540815</ram:IBANID>"));
|
assertTrue(resultXML.contains("<ram:IBANID>DE540815</ram:IBANID>"));
|
||||||
assertTrue(resultXML.contains("<ram:ApplicableTradePaymentDiscountTerms"));
|
assertTrue(resultXML.contains("<ram:ApplicableTradePaymentDiscountTerms"));
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ Permissive Open Source APL2, see LICENSE
|
|||||||
| 23 | Not a PDF/A-3 |
|
| 23 | Not a PDF/A-3 |
|
||||||
| 24 | Issues in CEN EN16931 Schematron Check |
|
| 24 | Issues in CEN EN16931 Schematron Check |
|
||||||
| 25 | Unsupported profile type |
|
| 25 | Unsupported profile type |
|
||||||
| 26 | No rules matched, XML to minimal? |
|
| 26 | No rules matched, XML too minimal? |
|
||||||
|
|
||||||
## History
|
## History
|
||||||
|
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ public class XMLValidator extends Validator {
|
|||||||
|
|
||||||
|
|
||||||
if (firedRules == 0) {
|
if (firedRules == 0) {
|
||||||
context.addResultItem(new ValidationResultItem(ESeverity.error, "No rules matched, XML to minimal?").setSection(26)
|
context.addResultItem(new ValidationResultItem(ESeverity.error, "No rules matched, XML too minimal?").setSection(26)
|
||||||
.setPart(EPart.fx));
|
.setPart(EPart.fx));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user