Merge pull request #439 from langfr/feature/436
Direct Debit: add field CreditorReferenceID.
This commit is contained in:
42
library/src/main/java/org/mustangproject/DirectDebit.java
Normal file
42
library/src/main/java/org/mustangproject/DirectDebit.java
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
package org.mustangproject;
|
||||||
|
|
||||||
|
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementDebit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* provides e.g. the IBAN to transfer money to :-)
|
||||||
|
*/
|
||||||
|
public class DirectDebit implements IZUGFeRDTradeSettlementDebit {
|
||||||
|
/**
|
||||||
|
* Debited account identifier (BT-91)
|
||||||
|
*/
|
||||||
|
protected final String IBAN;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mandate reference identifier (BT-89)
|
||||||
|
*/
|
||||||
|
protected final String mandate;
|
||||||
|
|
||||||
|
/***
|
||||||
|
* constructor for normal use :-)
|
||||||
|
* @param IBAN the IBAN as string
|
||||||
|
* @param mandate the mandate as string
|
||||||
|
*/
|
||||||
|
public DirectDebit(String IBAN, String mandate) {
|
||||||
|
this.IBAN = IBAN;
|
||||||
|
this.mandate = mandate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* getter for the IBAN
|
||||||
|
* @return IBAN
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getIBAN() {
|
||||||
|
return this.IBAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMandate() {
|
||||||
|
return this.mandate;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,6 +63,7 @@ public class Invoice implements IExportableTransaction {
|
|||||||
protected String specifiedProcuringProjectName = null;
|
protected String specifiedProcuringProjectName = null;
|
||||||
protected String despatchAdviceReferencedDocumentID = null;
|
protected String despatchAdviceReferencedDocumentID = null;
|
||||||
protected String vatDueDateTypeCode = null;
|
protected String vatDueDateTypeCode = null;
|
||||||
|
protected String creditorReferenceID; // required when direct debit is used.
|
||||||
|
|
||||||
public Invoice() {
|
public Invoice() {
|
||||||
ZFItems = new ArrayList<>();
|
ZFItems = new ArrayList<>();
|
||||||
@@ -878,4 +879,13 @@ public class Invoice implements IExportableTransaction {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCreditorReferenceID() {
|
||||||
|
return creditorReferenceID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Invoice setCreditorReferenceID(String creditorReferenceID) {
|
||||||
|
this.creditorReferenceID = creditorReferenceID;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
|
|||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTradeParty;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTradeParty;
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDLegalOrganisation;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDLegalOrganisation;
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlement;
|
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlement;
|
||||||
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementDebit;
|
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
@@ -27,7 +26,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
|||||||
protected String additionalAddress = null;
|
protected String additionalAddress = null;
|
||||||
protected String additionalAddressExtension = null;
|
protected String additionalAddressExtension = null;
|
||||||
protected List<BankDetails> bankDetails = new ArrayList<>();
|
protected List<BankDetails> bankDetails = new ArrayList<>();
|
||||||
protected List<IZUGFeRDTradeSettlementDebit> debitDetails = new ArrayList<>();
|
protected List<DirectDebit> debitDetails = new ArrayList<>();
|
||||||
protected Contact contact = null;
|
protected Contact contact = null;
|
||||||
protected LegalOrganisation legalOrg = null;
|
protected LegalOrganisation legalOrg = null;
|
||||||
protected SchemedID globalId = null;
|
protected SchemedID globalId = null;
|
||||||
@@ -483,7 +482,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
|
|||||||
* @param debitDetail e.g. containing IBAN and mandate
|
* @param debitDetail e.g. containing IBAN and mandate
|
||||||
* @return fluent setter
|
* @return fluent setter
|
||||||
*/
|
*/
|
||||||
public TradeParty addDebitDetails(IZUGFeRDTradeSettlementDebit debitDetail) {
|
public TradeParty addDebitDetails(DirectDebit debitDetail) {
|
||||||
debitDetails.add(debitDetail);
|
debitDetails.add(debitDetail);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -522,4 +522,7 @@ public interface IExportableTransaction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default String getCreditorReferenceID() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,35 +22,30 @@ import org.mustangproject.XMLTools;
|
|||||||
|
|
||||||
public interface IZUGFeRDTradeSettlementDebit extends IZUGFeRDTradeSettlement {
|
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>59</ram:TypeCode>"
|
||||||
|
+ "<ram:Information>SEPA direct debit</ram:Information>"
|
||||||
+ "<ram:PayerPartyDebtorFinancialAccount>"
|
+ "<ram:PayerPartyDebtorFinancialAccount>"
|
||||||
+ "<ram:IBANID>"+XMLTools.encodeXML(getIBAN())+"</ram:IBANID>"
|
+ "<ram:IBANID>" + XMLTools.encodeXML(getIBAN()) + "</ram:IBANID>"
|
||||||
+ "</ram:PayerPartyDebtorFinancialAccount>";
|
+ "</ram:PayerPartyDebtorFinancialAccount>";
|
||||||
|
|
||||||
xml += "</ram:SpecifiedTradeSettlementPaymentMeans>";
|
xml += "</ram:SpecifiedTradeSettlementPaymentMeans>";
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
default String getPaymentXML() {
|
default String getPaymentXML() {
|
||||||
return "<ram:DirectDebitMandateID>"+XMLTools.encodeXML(getMandate())+"</ram:DirectDebitMandateID>";
|
return "<ram:DirectDebitMandateID>" + XMLTools.encodeXML(getMandate()) + "</ram:DirectDebitMandateID>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* @return IBAN of the debtor (optional)
|
* @return IBAN of the debtor (optional)
|
||||||
*/
|
*/
|
||||||
String getIBAN();
|
String getIBAN();
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* @return sepa direct debit mandate reference
|
* @return sepa direct debit mandate reference
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -598,6 +598,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
|
|
||||||
xml += "</ram:ApplicableHeaderTradeDelivery>";
|
xml += "</ram:ApplicableHeaderTradeDelivery>";
|
||||||
xml += "<ram:ApplicableHeaderTradeSettlement>";
|
xml += "<ram:ApplicableHeaderTradeSettlement>";
|
||||||
|
if ((trans.getCreditorReferenceID() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
|
||||||
|
xml += "<ram:CreditorReferenceID>" + XMLTools.encodeXML(trans.getCreditorReferenceID()) + "</ram:CreditorReferenceID>";
|
||||||
|
}
|
||||||
if ((trans.getNumber() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
|
if ((trans.getNumber() != null) && (getProfile() != Profiles.getByName("Minimum"))) {
|
||||||
xml += "<ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>";
|
xml += "<ram:PaymentReference>" + XMLTools.encodeXML(trans.getNumber()) + "</ram:PaymentReference>";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user