support account holders, new sample invoice

This commit is contained in:
jstaerk
2020-11-21 20:46:05 +01:00
parent 3ff25bc9fe
commit a79a48095e
5 changed files with 79 additions and 33 deletions

View File

@@ -6,7 +6,7 @@ import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementPayment;
* provides e.g. the IBAN to transfer money to :-)
*/
public class BankDetails implements IZUGFeRDTradeSettlementPayment {
protected String IBAN, BIC;
protected String IBAN, BIC, accountName=null;
public BankDetails(String IBAN, String BIC) {
this.IBAN = IBAN;
@@ -23,7 +23,7 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
* if you deduct from a customer's account you may e.g. leave out the first or last
* digits so that nobody spying on the invoice gets to know the complete number
* @param IBAN the "IBAN ID", i.e. the IBAN or parts of it
* @return fluent setter
* @return fluent setter<
*/
public BankDetails setIBAN(String IBAN) {
this.IBAN = IBAN;
@@ -34,6 +34,11 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
return BIC;
}
/***
* The bank identifier. Bank name is no longer neccessary in SEPA.
* @param BIC the bic code
* @return fluent setter
*/
public BankDetails setBIC(String BIC) {
this.BIC = BIC;
return this;
@@ -55,6 +60,21 @@ public class BankDetails implements IZUGFeRDTradeSettlementPayment {
}
/**
* set Holder
* @param name account name (usually account holder if != sender)
* @return fluent setter
*/
public BankDetails setAccountName(String name) {
accountName=name;
return this;
}
@Override
public String getAccountName() {
return accountName;
}
}

View File

@@ -52,14 +52,28 @@ public interface IZUGFeRDTradeSettlementPayment extends IZUGFeRDTradeSettlement
return null;
}
/***
* Account name
*
* @return the name of the account holder (if not identical to sender)
*/
default String getAccountName() { return null; }
default String getSettlementXML() {
String accountNameStr="";
if (getAccountName()!=null) {
accountNameStr="<ram:AccountName>" + XMLTools.encodeXML(getAccountName()) + "</ram:AccountName>\n"; //$NON-NLS-2$
}
String xml = " <ram:SpecifiedTradeSettlementPaymentMeans>\n"
+ " <ram:TypeCode>42</ram:TypeCode>\n"
+ " <ram:Information>Überweisung</ram:Information>\n"
+ " <ram:Information>Bank transfer</ram:Information>\n"
+ " <ram:PayeePartyCreditorFinancialAccount>\n"
+ " <ram:IBANID>" + XMLTools.encodeXML(getOwnIBAN()) + "</ram:IBANID>\n"; //$NON-NLS-2$
xml+= " </ram:PayeePartyCreditorFinancialAccount>\n"
xml+= accountNameStr;
xml+= " </ram:PayeePartyCreditorFinancialAccount>\n"
+ " <ram:PayeeSpecifiedCreditorFinancialInstitution>\n"
+ " <ram:BICID>" + XMLTools.encodeXML(getOwnBIC()) + "</ram:BICID>\n" //$NON-NLS-2$
// + " <ram:Name>"+trans.getOwnBankName()+"</ram:Name>\n"