Merge branch 'ZUGFeRD:master' into master
This commit is contained in:
@@ -20,6 +20,16 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
|
||||
*/
|
||||
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
|
||||
*/
|
||||
@@ -38,6 +48,16 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
|
||||
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
|
||||
* @return IBAN
|
||||
@@ -57,6 +77,16 @@ public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
|
||||
return this.mandate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentMeansCode() {
|
||||
return this.paymentMeansCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentMeansInformation() {
|
||||
return this.paymentMeansInformation;
|
||||
}
|
||||
|
||||
public DirectDebit setMandate(String mandate) {
|
||||
this.mandate = mandate;
|
||||
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() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get reference document number typically used for Invoice Corrections Will be
|
||||
* added as IncludedNote in comfort profile
|
||||
*
|
||||
* @return the ID of the document this document refers to
|
||||
* get BuyerReference (BT-10) an identifier assigned by the buyer and used
|
||||
* for internal routing. Used for the Leitweg-ID.
|
||||
*
|
||||
* @return the BuyerReference of this document
|
||||
*/
|
||||
default String getReferenceNumber() {
|
||||
return null;
|
||||
|
||||
@@ -25,8 +25,8 @@ public interface IZUGFeRDTradeSettlementDebit extends IZUGFeRDTradeSettlement {
|
||||
@Override
|
||||
default String getSettlementXML() {
|
||||
String xml = "<ram:SpecifiedTradeSettlementPaymentMeans>"
|
||||
+ "<ram:TypeCode>59</ram:TypeCode>"
|
||||
+ "<ram:Information>SEPA direct debit</ram:Information>"
|
||||
+ "<ram:TypeCode>" + XMLTools.encodeXML(getPaymentMeansCode()) + "</ram:TypeCode>"
|
||||
+ "<ram:Information>" + XMLTools.encodeXML(getPaymentMeansInformation()) + "</ram:Information>"
|
||||
+ "<ram:PayerPartyDebtorFinancialAccount>"
|
||||
+ "<ram:IBANID>" + XMLTools.encodeXML(getIBAN()) + "</ram:IBANID>"
|
||||
+ "</ram:PayerPartyDebtorFinancialAccount>";
|
||||
@@ -51,4 +51,14 @@ public interface IZUGFeRDTradeSettlementDebit extends IZUGFeRDTradeSettlement {
|
||||
*/
|
||||
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);
|
||||
List<BankDetails> bankDetails = new ArrayList<>();
|
||||
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++) {
|
||||
// XMLTools.trimOrNull(nodes.item(i)))) {
|
||||
@@ -693,8 +693,18 @@ public class ZUGFeRDInvoiceImporter {
|
||||
NodeList paymentMeansChilds = headerTradeSettlementChilds.item(settlementChildIndex).getChildNodes();
|
||||
IBAN = null;
|
||||
BIC = null;
|
||||
paymentMeansCode = null;
|
||||
paymentMeansInformation = null;
|
||||
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"))) {
|
||||
NodeList accountChilds = paymentMeansChilds.item(paymentMeansChildIndex).getChildNodes();
|
||||
for (int accountChildIndex = 0; accountChildIndex < accountChilds.getLength(); accountChildIndex++) {
|
||||
@@ -795,6 +805,12 @@ public class ZUGFeRDInvoiceImporter {
|
||||
|
||||
if ((directDebitMandateID != null) && (IBAN != null)) {
|
||||
DirectDebit d = new DirectDebit(IBAN, directDebitMandateID);
|
||||
if (paymentMeansCode != null) {
|
||||
d.setPaymentMeansCode(paymentMeansCode);
|
||||
}
|
||||
if (paymentMeansInformation != null) {
|
||||
d.setPaymentMeansInformation(paymentMeansInformation);
|
||||
}
|
||||
zpp.getSender().addDebitDetails(d);
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +109,16 @@ public class DXTest extends MustangReaderTestCase {
|
||||
return "DE99XX12345";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentMeansCode() {
|
||||
return "54";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentMeansInformation() {
|
||||
return "Credit Card";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -106,6 +106,16 @@ public class OXTest extends MustangReaderTestCase {
|
||||
return "DE99XX12345";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentMeansCode() {
|
||||
return "54";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentMeansInformation() {
|
||||
return "Credit Card";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -100,6 +100,16 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
|
||||
return "DE99XX12345";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentMeansCode() {
|
||||
return "54";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentMeansInformation() {
|
||||
return "Credit Card";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -264,6 +274,16 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
|
||||
return "123";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentMeansCode() {
|
||||
return "42";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPaymentMeansInformation() {
|
||||
return "Überweisung";
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
@@ -314,7 +334,8 @@ public class ZF2EdgeTest extends MustangReaderTestCase {
|
||||
// now check the contents (like MustangReaderTest)
|
||||
ZUGFeRDImporter zi = new ZUGFeRDImporter(TARGET_PDF);
|
||||
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:IBANID>DE540815</ram:IBANID>"));
|
||||
assertTrue(resultXML.contains("<ram:ApplicableTradePaymentDiscountTerms"));
|
||||
|
||||
Reference in New Issue
Block a user