Merge pull request #84 from HardyLoppmann/master
change to multiple bank accounts
This commit is contained in:
@@ -105,53 +105,9 @@ public interface IZUGFeRDExportableTransaction {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* BIC of the sender
|
* the creditors payment informations
|
||||||
*
|
|
||||||
* @return the BIC code of the recipient sender's bank
|
|
||||||
*/
|
*/
|
||||||
default String getOwnBIC() {
|
IZUGFeRDTradeSettlementPayment[] getTradeSettlementPayment();
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BLZ of the sender
|
|
||||||
*
|
|
||||||
* @return the BLZ code of the recipient sender's bank
|
|
||||||
*/
|
|
||||||
default String getOwnBLZ() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Bank name of the sender
|
|
||||||
*
|
|
||||||
* @return the name of the sender's bank
|
|
||||||
*/
|
|
||||||
default String getOwnBankName() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IBAN of the sender
|
|
||||||
*
|
|
||||||
* @return the IBAN of the invoice sender's bank account
|
|
||||||
*/
|
|
||||||
default String getOwnIBAN() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* IBAN of the sender
|
|
||||||
*
|
|
||||||
* @return the Account Number of the invoice sender's bank account
|
|
||||||
*/
|
|
||||||
default String getOwnKto() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -252,16 +208,6 @@ public interface IZUGFeRDExportableTransaction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get payment information text. e.g. Bank transfer
|
|
||||||
*
|
|
||||||
* @return payment information text
|
|
||||||
*/
|
|
||||||
default String getOwnPaymentInfoText() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get payment term descriptional text e.g. Bis zum 22.10.2015 ohne Abzug
|
* get payment term descriptional text e.g. Bis zum 22.10.2015 ohne Abzug
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
/** **********************************************************************
|
||||||
|
*
|
||||||
|
* Copyright 2019 by ak on 12.04.19.
|
||||||
|
*
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy
|
||||||
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*********************************************************************** */
|
||||||
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
public interface IZUGFeRDTradeSettlementPayment {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get payment information text. e.g. Bank transfer
|
||||||
|
*
|
||||||
|
* @return payment information text
|
||||||
|
*/
|
||||||
|
default String getOwnPaymentInfoText() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BIC of the sender
|
||||||
|
*
|
||||||
|
* @return the BIC code of the recipient sender's bank
|
||||||
|
*/
|
||||||
|
default String getOwnBIC() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* BLZ of the sender
|
||||||
|
*
|
||||||
|
* @return the BLZ code of the recipient sender's bank
|
||||||
|
*/
|
||||||
|
default String getOwnBLZ() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bank name of the sender
|
||||||
|
*
|
||||||
|
* @return the name of the sender's bank
|
||||||
|
*/
|
||||||
|
default String getOwnBankName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IBAN of the sender
|
||||||
|
*
|
||||||
|
* @return the IBAN of the invoice sender's bank account
|
||||||
|
*/
|
||||||
|
default String getOwnIBAN() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IBAN of the sender
|
||||||
|
*
|
||||||
|
* @return the Account Number of the invoice sender's bank account
|
||||||
|
*/
|
||||||
|
default String getOwnKto() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,13 +29,11 @@ import java.util.HashMap;
|
|||||||
public class ZUGFeRD2PullProvider implements IXMLProvider {
|
public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||||
|
|
||||||
private class LineCalc {
|
private class LineCalc {
|
||||||
private IZUGFeRDExportableItem currentItem = null;
|
|
||||||
private BigDecimal totalGross;
|
private BigDecimal totalGross;
|
||||||
private BigDecimal itemTotalNetAmount;
|
private BigDecimal itemTotalNetAmount;
|
||||||
private BigDecimal itemTotalVATAmount;
|
private BigDecimal itemTotalVATAmount;
|
||||||
|
|
||||||
public LineCalc(IZUGFeRDExportableItem currentItem) {
|
public LineCalc(IZUGFeRDExportableItem currentItem) {
|
||||||
this.currentItem = currentItem;
|
|
||||||
BigDecimal multiplicator = currentItem.getProduct().getVATPercent().divide(new BigDecimal(100)).add(new BigDecimal(1));
|
BigDecimal multiplicator = currentItem.getProduct().getVATPercent().divide(new BigDecimal(100)).add(new BigDecimal(1));
|
||||||
// priceGross=currentItem.getPrice().multiply(multiplicator);
|
// priceGross=currentItem.getPrice().multiply(multiplicator);
|
||||||
totalGross = currentItem.getPrice().multiply(multiplicator).multiply(currentItem.getQuantity());
|
totalGross = currentItem.getPrice().multiply(multiplicator).multiply(currentItem.getQuantity());
|
||||||
@@ -58,14 +56,11 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
|
|
||||||
protected byte[] zugferdData;
|
protected byte[] zugferdData;
|
||||||
private IZUGFeRDExportableTransaction trans;
|
private IZUGFeRDExportableTransaction trans;
|
||||||
private boolean isTest;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enables the flag to indicate a test invoice in the XML structure
|
* enables the flag to indicate a test invoice in the XML structure
|
||||||
*/
|
*/
|
||||||
public void setTest() {
|
public void setTest() {}
|
||||||
isTest = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String nDigitFormat(BigDecimal value, int scale) {
|
private String nDigitFormat(BigDecimal value, int scale) {
|
||||||
/*
|
/*
|
||||||
@@ -155,7 +150,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
* @return which taxes have been used with which amounts in this invoice
|
* @return which taxes have been used with which amounts in this invoice
|
||||||
*/
|
*/
|
||||||
private HashMap<BigDecimal, VATAmount> getVATPercentAmountMap() {
|
private HashMap<BigDecimal, VATAmount> getVATPercentAmountMap() {
|
||||||
HashMap<BigDecimal, VATAmount> hm = new HashMap<BigDecimal, VATAmount>();
|
HashMap<BigDecimal, VATAmount> hm = new HashMap<>();
|
||||||
|
|
||||||
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
||||||
BigDecimal percent = currentItem.getProduct().getVATPercent();
|
BigDecimal percent = currentItem.getProduct().getVATPercent();
|
||||||
@@ -174,15 +169,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generateXML(IZUGFeRDExportableTransaction trans) {
|
public void generateXML(IZUGFeRDExportableTransaction trans) {
|
||||||
|
|
||||||
this.trans = trans;
|
this.trans = trans;
|
||||||
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy"); //$NON-NLS-1$
|
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy"); //$NON-NLS-1$
|
||||||
SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd"); //$NON-NLS-1$
|
SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd"); //$NON-NLS-1$
|
||||||
String testBooleanStr = "false";
|
|
||||||
if (isTest) {
|
|
||||||
testBooleanStr = "true";
|
|
||||||
|
|
||||||
}
|
|
||||||
String senderReg = "";
|
String senderReg = "";
|
||||||
if (trans.getOwnOrganisationFullPlaintextInfo() != null) {
|
if (trans.getOwnOrganisationFullPlaintextInfo() != null) {
|
||||||
senderReg = ""
|
senderReg = ""
|
||||||
@@ -331,21 +320,23 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
|||||||
+ " </ram:ApplicableHeaderTradeDelivery>\n"
|
+ " </ram:ApplicableHeaderTradeDelivery>\n"
|
||||||
+ " <ram:ApplicableHeaderTradeSettlement>\n" //$NON-NLS-1$
|
+ " <ram:ApplicableHeaderTradeSettlement>\n" //$NON-NLS-1$
|
||||||
+ " <ram:PaymentReference>" + trans.getNumber() + "</ram:PaymentReference>\n" //$NON-NLS-1$ //$NON-NLS-2$
|
+ " <ram:PaymentReference>" + trans.getNumber() + "</ram:PaymentReference>\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
+ " <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>\n" //$NON-NLS-1$
|
+ " <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>\n"; //$NON-NLS-1$
|
||||||
+ " <ram:SpecifiedTradeSettlementPaymentMeans>\n" //$NON-NLS-1$
|
|
||||||
+ " <ram:TypeCode>42</ram:TypeCode>\n" //$NON-NLS-1$
|
|
||||||
+ " <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$
|
|
||||||
|
|
||||||
|
for(IZUGFeRDTradeSettlementPayment payment : trans.getTradeSettlementPayment()) {
|
||||||
|
xml += " <ram:SpecifiedTradeSettlementPaymentMeans>\n" //$NON-NLS-1$
|
||||||
|
+ " <ram:TypeCode>42</ram:TypeCode>\n" //$NON-NLS-1$
|
||||||
|
+ " <ram:Information>Überweisung</ram:Information>\n" //$NON-NLS-1$
|
||||||
|
+ " <ram:PayeePartyCreditorFinancialAccount>\n" //$NON-NLS-1$
|
||||||
|
+ " <ram:IBANID>" + payment.getOwnIBAN() + "</ram:IBANID>\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ " <ram:ProprietaryID>" + payment.getOwnKto() + "</ram:ProprietaryID>\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ " </ram:PayeePartyCreditorFinancialAccount>\n" //$NON-NLS-1$
|
||||||
|
+ " <ram:PayeeSpecifiedCreditorFinancialInstitution>\n" //$NON-NLS-1$
|
||||||
|
+ " <ram:BICID>" + payment.getOwnBIC() + "</ram:BICID>\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
+ " <ram:GermanBankleitzahlID>" + payment.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$
|
||||||
|
}
|
||||||
|
|
||||||
HashMap<BigDecimal, VATAmount> VATPercentAmountMap = getVATPercentAmountMap();
|
HashMap<BigDecimal, VATAmount> VATPercentAmountMap = getVATPercentAmountMap();
|
||||||
for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType;
|
|||||||
import org.mustangproject.ZUGFeRD.model.DateTimeType;
|
import org.mustangproject.ZUGFeRD.model.DateTimeType;
|
||||||
import org.mustangproject.ZUGFeRD.model.DateTimeTypeConstants;
|
import org.mustangproject.ZUGFeRD.model.DateTimeTypeConstants;
|
||||||
import org.mustangproject.ZUGFeRD.model.DocumentCodeType;
|
import org.mustangproject.ZUGFeRD.model.DocumentCodeType;
|
||||||
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
|
|
||||||
import org.mustangproject.ZUGFeRD.model.DocumentContextParameterType;
|
import org.mustangproject.ZUGFeRD.model.DocumentContextParameterType;
|
||||||
import org.mustangproject.ZUGFeRD.model.DocumentContextParameterTypeConstants;
|
import org.mustangproject.ZUGFeRD.model.DocumentContextParameterTypeConstants;
|
||||||
import org.mustangproject.ZUGFeRD.model.DocumentLineDocumentType;
|
import org.mustangproject.ZUGFeRD.model.DocumentLineDocumentType;
|
||||||
@@ -62,7 +61,6 @@ import org.mustangproject.ZUGFeRD.model.SupplyChainTradeLineItemType;
|
|||||||
import org.mustangproject.ZUGFeRD.model.SupplyChainTradeSettlementType;
|
import org.mustangproject.ZUGFeRD.model.SupplyChainTradeSettlementType;
|
||||||
import org.mustangproject.ZUGFeRD.model.SupplyChainTradeTransactionType;
|
import org.mustangproject.ZUGFeRD.model.SupplyChainTradeTransactionType;
|
||||||
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeType;
|
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeType;
|
||||||
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants;
|
|
||||||
import org.mustangproject.ZUGFeRD.model.TaxRegistrationType;
|
import org.mustangproject.ZUGFeRD.model.TaxRegistrationType;
|
||||||
import org.mustangproject.ZUGFeRD.model.TaxRegistrationTypeConstants;
|
import org.mustangproject.ZUGFeRD.model.TaxRegistrationTypeConstants;
|
||||||
import org.mustangproject.ZUGFeRD.model.TaxTypeCodeType;
|
import org.mustangproject.ZUGFeRD.model.TaxTypeCodeType;
|
||||||
@@ -340,7 +338,7 @@ class ZUGFeRDTransactionModelConverter {
|
|||||||
currencyCode.setValue(currency);
|
currencyCode.setValue(currency);
|
||||||
tradeSettlement.setInvoiceCurrencyCode(currencyCode);
|
tradeSettlement.setInvoiceCurrencyCode(currencyCode);
|
||||||
|
|
||||||
tradeSettlement.getSpecifiedTradeSettlementPaymentMeans().add(
|
tradeSettlement.getSpecifiedTradeSettlementPaymentMeans().addAll(
|
||||||
getPaymentData());
|
getPaymentData());
|
||||||
tradeSettlement.getApplicableTradeTax().addAll(getTradeTax());
|
tradeSettlement.getApplicableTradeTax().addAll(getTradeTax());
|
||||||
tradeSettlement.getSpecifiedTradePaymentTerms().addAll(
|
tradeSettlement.getSpecifiedTradePaymentTerms().addAll(
|
||||||
@@ -364,46 +362,50 @@ class ZUGFeRDTransactionModelConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private TradeSettlementPaymentMeansType getPaymentData() {
|
private List<TradeSettlementPaymentMeansType> getPaymentData() {
|
||||||
TradeSettlementPaymentMeansType paymentData = xmlFactory
|
List<TradeSettlementPaymentMeansType> result = new ArrayList<>();
|
||||||
.createTradeSettlementPaymentMeansType();
|
for (IZUGFeRDTradeSettlementPayment settlementPayment : trans.getTradeSettlementPayment()) {
|
||||||
PaymentMeansCodeType paymentDataType = xmlFactory
|
TradeSettlementPaymentMeansType paymentData = xmlFactory
|
||||||
.createPaymentMeansCodeType();
|
.createTradeSettlementPaymentMeansType();
|
||||||
paymentDataType.setValue(PaymentMeansCodeTypeConstants.BANKACCOUNT);
|
PaymentMeansCodeType paymentDataType = xmlFactory
|
||||||
paymentData.setTypeCode(paymentDataType);
|
.createPaymentMeansCodeType();
|
||||||
|
paymentDataType.setValue(PaymentMeansCodeTypeConstants.BANKACCOUNT);
|
||||||
|
paymentData.setTypeCode(paymentDataType);
|
||||||
|
|
||||||
TextType paymentInfo = xmlFactory.createTextType();
|
TextType paymentInfo = xmlFactory.createTextType();
|
||||||
String paymentInfoText = trans.getOwnPaymentInfoText();
|
String paymentInfoText = settlementPayment.getOwnPaymentInfoText();
|
||||||
if (paymentInfoText == null) {
|
if (paymentInfoText == null) {
|
||||||
paymentInfoText = "";
|
paymentInfoText = "";
|
||||||
|
}
|
||||||
|
paymentInfo.setValue(paymentInfoText);
|
||||||
|
paymentData.getInformation().add(paymentInfo);
|
||||||
|
|
||||||
|
CreditorFinancialAccountType bankAccount = xmlFactory
|
||||||
|
.createCreditorFinancialAccountType();
|
||||||
|
IDType iban = xmlFactory.createIDType();
|
||||||
|
iban.setValue(settlementPayment.getOwnIBAN());
|
||||||
|
bankAccount.setIBANID(iban);
|
||||||
|
IDType kto = xmlFactory.createIDType();
|
||||||
|
kto.setValue(settlementPayment.getOwnKto());
|
||||||
|
bankAccount.setProprietaryID(kto);
|
||||||
|
paymentData.setPayeePartyCreditorFinancialAccount(bankAccount);
|
||||||
|
|
||||||
|
CreditorFinancialInstitutionType bankData = xmlFactory
|
||||||
|
.createCreditorFinancialInstitutionType();
|
||||||
|
IDType bicId = xmlFactory.createIDType();
|
||||||
|
bicId.setValue(settlementPayment.getOwnBIC());
|
||||||
|
bankData.setBICID(bicId);
|
||||||
|
TextType bankName = xmlFactory.createTextType();
|
||||||
|
bankName.setValue(settlementPayment.getOwnBankName());
|
||||||
|
bankData.setName(bankName);
|
||||||
|
IDType blz = xmlFactory.createIDType();
|
||||||
|
blz.setValue(settlementPayment.getOwnBLZ());
|
||||||
|
bankData.setGermanBankleitzahlID(blz);
|
||||||
|
|
||||||
|
paymentData.setPayeeSpecifiedCreditorFinancialInstitution(bankData);
|
||||||
|
result.add(paymentData);
|
||||||
}
|
}
|
||||||
paymentInfo.setValue(paymentInfoText);
|
return result;
|
||||||
paymentData.getInformation().add(paymentInfo);
|
|
||||||
|
|
||||||
CreditorFinancialAccountType bankAccount = xmlFactory
|
|
||||||
.createCreditorFinancialAccountType();
|
|
||||||
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
|
|
||||||
.createCreditorFinancialInstitutionType();
|
|
||||||
IDType bicId = xmlFactory.createIDType();
|
|
||||||
bicId.setValue(trans.getOwnBIC());
|
|
||||||
bankData.setBICID(bicId);
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ package org.mustangproject.ZUGFeRD;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTransaction {
|
public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTransaction {
|
||||||
|
|
||||||
private String number;
|
private String number;
|
||||||
private Date issueDate;
|
private Date issueDate;
|
||||||
private String ownOrganisationFullPlaintextInfo;
|
private String ownOrganisationFullPlaintextInfo;
|
||||||
@@ -30,11 +31,7 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
|
|||||||
private IZUGFeRDAllowanceCharge[] zFLogisticsServiceCharges;
|
private IZUGFeRDAllowanceCharge[] zFLogisticsServiceCharges;
|
||||||
private IZUGFeRDExportableItem[] zFItems;
|
private IZUGFeRDExportableItem[] zFItems;
|
||||||
private IZUGFeRDExportableContact recipient;
|
private IZUGFeRDExportableContact recipient;
|
||||||
private String ownKto;
|
private IZUGFeRDTradeSettlementPayment[] settlementPayments;
|
||||||
private String ownBLZ;
|
|
||||||
private String ownBIC;
|
|
||||||
private String ownBankName;
|
|
||||||
private String ownIBAN;
|
|
||||||
private String ownTaxID;
|
private String ownTaxID;
|
||||||
private String ownVATID;
|
private String ownVATID;
|
||||||
private String ownOrganisationName;
|
private String ownOrganisationName;
|
||||||
@@ -44,7 +41,6 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
|
|||||||
private String ownCountry;
|
private String ownCountry;
|
||||||
private Date deliveryDate;
|
private Date deliveryDate;
|
||||||
private String currency;
|
private String currency;
|
||||||
private String ownPaymentInfoText;
|
|
||||||
private String paymentTermDescription;
|
private String paymentTermDescription;
|
||||||
private String referenceNumber;
|
private String referenceNumber;
|
||||||
|
|
||||||
@@ -94,28 +90,8 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnKto() {
|
public IZUGFeRDTradeSettlementPayment[] getTradeSettlementPayment() {
|
||||||
return ownKto;
|
return settlementPayments;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBLZ() {
|
|
||||||
return ownBLZ;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBIC() {
|
|
||||||
return ownBIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBankName() {
|
|
||||||
return ownBankName;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnIBAN() {
|
|
||||||
return ownIBAN;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -163,11 +139,6 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
|
|||||||
return currency;
|
return currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnPaymentInfoText() {
|
|
||||||
return ownPaymentInfoText;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPaymentTermDescription() {
|
public String getPaymentTermDescription() {
|
||||||
return paymentTermDescription;
|
return paymentTermDescription;
|
||||||
@@ -223,31 +194,6 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IZUGFeRDExportableTransactionImpl setOwnBLZ(String ownBLZ) {
|
|
||||||
this.ownBLZ = ownBLZ;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IZUGFeRDExportableTransactionImpl setOwnBIC(String ownBIC) {
|
|
||||||
this.ownBIC = ownBIC;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IZUGFeRDExportableTransactionImpl setOwnBankName(String ownBankName) {
|
|
||||||
this.ownBankName = ownBankName;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IZUGFeRDExportableTransactionImpl setOwnKto(String ownKto) {
|
|
||||||
this.ownKto = ownKto;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IZUGFeRDExportableTransactionImpl setOwnIBAN(String ownIBAN) {
|
|
||||||
this.ownIBAN = ownIBAN;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IZUGFeRDExportableTransactionImpl setOwnTaxID(String ownTaxID) {
|
public IZUGFeRDExportableTransactionImpl setOwnTaxID(String ownTaxID) {
|
||||||
this.ownTaxID = ownTaxID;
|
this.ownTaxID = ownTaxID;
|
||||||
return this;
|
return this;
|
||||||
@@ -293,11 +239,6 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IZUGFeRDExportableTransactionImpl setOwnPaymentInfoText(String ownPaymentInfoText) {
|
|
||||||
this.ownPaymentInfoText = ownPaymentInfoText;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IZUGFeRDExportableTransactionImpl setPaymentTermDescription(String paymentTermDescription) {
|
public IZUGFeRDExportableTransactionImpl setPaymentTermDescription(String paymentTermDescription) {
|
||||||
this.paymentTermDescription = paymentTermDescription;
|
this.paymentTermDescription = paymentTermDescription;
|
||||||
return this;
|
return this;
|
||||||
@@ -307,4 +248,9 @@ public class IZUGFeRDExportableTransactionImpl implements IZUGFeRDExportableTran
|
|||||||
this.referenceNumber = referenceNumber;
|
this.referenceNumber = referenceNumber;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDExportableTransactionImpl setTradeSettlementPayment(IZUGFeRDTradeSettlementPayment... settlementPayments) {
|
||||||
|
this.settlementPayments = settlementPayments;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,90 @@
|
|||||||
|
/** **********************************************************************
|
||||||
|
*
|
||||||
|
* Copyright 2019 by ak on 12.04.19.
|
||||||
|
*
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy
|
||||||
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*********************************************************************** */
|
||||||
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
public class IZUGFeRDTradeSettlementPaymentImpl implements IZUGFeRDTradeSettlementPayment {
|
||||||
|
|
||||||
|
private String ownKto;
|
||||||
|
private String ownBLZ;
|
||||||
|
private String ownBIC;
|
||||||
|
private String ownBankName;
|
||||||
|
private String ownIBAN;
|
||||||
|
private String ownPaymentInfoText;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnKto() {
|
||||||
|
return ownKto;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnBLZ() {
|
||||||
|
return ownBLZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnBIC() {
|
||||||
|
return ownBIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnBankName() {
|
||||||
|
return ownBankName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnIBAN() {
|
||||||
|
return ownIBAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnPaymentInfoText() {
|
||||||
|
return ownPaymentInfoText;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDTradeSettlementPaymentImpl setOwnBLZ(String ownBLZ) {
|
||||||
|
this.ownBLZ = ownBLZ;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDTradeSettlementPaymentImpl setOwnBIC(String ownBIC) {
|
||||||
|
this.ownBIC = ownBIC;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDTradeSettlementPaymentImpl setOwnBankName(String ownBankName) {
|
||||||
|
this.ownBankName = ownBankName;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDTradeSettlementPaymentImpl setOwnKto(String ownKto) {
|
||||||
|
this.ownKto = ownKto;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDTradeSettlementPaymentImpl setOwnIBAN(String ownIBAN) {
|
||||||
|
this.ownIBAN = ownIBAN;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IZUGFeRDTradeSettlementPaymentImpl setOwnPaymentInfoText(String ownPaymentInfoText) {
|
||||||
|
this.ownPaymentInfoText = ownPaymentInfoText;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,204 @@
|
|||||||
|
/** **********************************************************************
|
||||||
|
*
|
||||||
|
* Copyright 2019 by ak on 12.04.19.
|
||||||
|
*
|
||||||
|
* Use is subject to license terms.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
||||||
|
* use this file except in compliance with the License. You may obtain a copy
|
||||||
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
*
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
*********************************************************************** */
|
||||||
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
public abstract class MustangReaderTestCase extends TestCase implements IZUGFeRDExportableTransaction {
|
||||||
|
|
||||||
|
public MustangReaderTestCase(String testName) {
|
||||||
|
super(testName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IZUGFeRDTradeSettlementPayment[] getTradeSettlementPayment() {
|
||||||
|
Payment[] payments = new Payment[1];
|
||||||
|
payments[0] = new Payment();
|
||||||
|
return payments;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class Payment implements IZUGFeRDTradeSettlementPayment {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnKto() {
|
||||||
|
return "44421800";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnBLZ() {
|
||||||
|
return "41441604";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnBIC() {
|
||||||
|
return "COBADEFFXXX";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnBankName() {
|
||||||
|
return "Commerzbank";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnPaymentInfoText() {
|
||||||
|
return "Überweisung";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getOwnIBAN() {
|
||||||
|
return "DE88 2008 0000 0970 3757 00";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class Contact implements IZUGFeRDExportableContact {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCountry() {
|
||||||
|
return "DE";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLocation() {
|
||||||
|
return "Spielkreis";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Theodor Est";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getStreet() {
|
||||||
|
return "Bahnstr. 42";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getVATID() {
|
||||||
|
return "DE999999999";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getZIP() {
|
||||||
|
return "88802";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class Item implements IZUGFeRDExportableItem {
|
||||||
|
|
||||||
|
public Item(BigDecimal price, BigDecimal quantity, Product product) {
|
||||||
|
super();
|
||||||
|
this.price = price;
|
||||||
|
this.quantity = quantity;
|
||||||
|
this.product = product;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal price, quantity;
|
||||||
|
private Product product;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrice(BigDecimal price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal getQuantity() {
|
||||||
|
return quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQuantity(BigDecimal quantity) {
|
||||||
|
this.quantity = quantity;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Product getProduct() {
|
||||||
|
return product;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProduct(Product product) {
|
||||||
|
this.product = product;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IZUGFeRDAllowanceCharge[] getItemCharges() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class Product implements IZUGFeRDExportableProduct {
|
||||||
|
private String description, name, unit;
|
||||||
|
private BigDecimal VATPercent;
|
||||||
|
|
||||||
|
public Product(String description, String name, String unit, BigDecimal VATPercent) {
|
||||||
|
super();
|
||||||
|
this.description = description;
|
||||||
|
this.name = name;
|
||||||
|
this.unit = unit;
|
||||||
|
this.VATPercent = VATPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnit() {
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUnit(String unit) {
|
||||||
|
this.unit = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BigDecimal getVATPercent() {
|
||||||
|
return VATPercent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVATPercent(BigDecimal VATPercent) {
|
||||||
|
this.VATPercent = VATPercent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,7 +33,7 @@ import java.util.Date;
|
|||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExportableTransaction {
|
public class MustangReaderWriterEdgeTest extends MustangReaderTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getDeliveryDate() {
|
public Date getDeliveryDate() {
|
||||||
@@ -55,36 +55,11 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
return "RE-20170509/505";
|
return "RE-20170509/505";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnKto() {
|
|
||||||
return "44421800";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBLZ() {
|
|
||||||
return "41441604";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBIC() {
|
|
||||||
return "COBADEFFXXX";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBankName() {
|
|
||||||
return "Commerzbank";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnCountry() {
|
public String getOwnCountry() {
|
||||||
return "DE";
|
return "DE";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnIBAN() {
|
|
||||||
return "DE88 2008 0000 0970 3757 00";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnLocation() {
|
public String getOwnLocation() {
|
||||||
return "Stadthausen";
|
return "Stadthausen";
|
||||||
@@ -120,7 +95,6 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
return new Contact();
|
return new Contact();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnOrganisationFullPlaintextInfo() {
|
public String getOwnOrganisationFullPlaintextInfo() {
|
||||||
return null;
|
return null;
|
||||||
@@ -144,11 +118,6 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
return allItems;
|
return allItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnPaymentInfoText() {
|
|
||||||
return "Überweisung";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPaymentTermDescription() {
|
public String getPaymentTermDescription() {
|
||||||
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||||
@@ -175,140 +144,6 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Contact implements IZUGFeRDExportableContact {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCountry() {
|
|
||||||
return "DE";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLocation() {
|
|
||||||
return "Spielkreis";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "Theodor Est";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStreet() {
|
|
||||||
return "Bahnstr. 42";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVATID() {
|
|
||||||
return "DE999999999";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getZIP() {
|
|
||||||
return "88802";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Item implements IZUGFeRDExportableItem {
|
|
||||||
|
|
||||||
public Item(BigDecimal price, BigDecimal quantity, Product product) {
|
|
||||||
super();
|
|
||||||
this.price = price;
|
|
||||||
this.quantity = quantity;
|
|
||||||
this.product = product;
|
|
||||||
}
|
|
||||||
|
|
||||||
private BigDecimal price, quantity;
|
|
||||||
private Product product;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getPrice() {
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrice(BigDecimal price) {
|
|
||||||
this.price = price;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getQuantity() {
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuantity(BigDecimal quantity) {
|
|
||||||
this.quantity = quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Product getProduct() {
|
|
||||||
return product;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProduct(Product product) {
|
|
||||||
this.product = product;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDAllowanceCharge[] getItemCharges() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class Product implements IZUGFeRDExportableProduct {
|
|
||||||
private String description, name, unit;
|
|
||||||
private BigDecimal VATPercent;
|
|
||||||
|
|
||||||
public Product(String description, String name, String unit, BigDecimal VATPercent) {
|
|
||||||
super();
|
|
||||||
this.description = description;
|
|
||||||
this.name = name;
|
|
||||||
this.unit = unit;
|
|
||||||
this.VATPercent = VATPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUnit() {
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnit(String unit) {
|
|
||||||
this.unit = unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getVATPercent() {
|
|
||||||
return VATPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVATPercent(BigDecimal vATPercent) {
|
|
||||||
VATPercent = vATPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the test case
|
* Create the test case
|
||||||
*
|
*
|
||||||
@@ -341,10 +176,10 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals(zi.getAmount(), "571.04");
|
assertEquals(zi.getAmount(), "571.04");
|
||||||
assertEquals(zi.getBIC(), getOwnBIC());
|
assertEquals(zi.getBIC(), getTradeSettlementPayment()[0].getOwnBIC());
|
||||||
assertEquals(zi.getBLZ(), getOwnBLZ());
|
assertEquals(zi.getBLZ(), getTradeSettlementPayment()[0].getOwnBLZ());
|
||||||
assertEquals(zi.getIBAN(), getOwnIBAN());
|
assertEquals(zi.getIBAN(), getTradeSettlementPayment()[0].getOwnIBAN());
|
||||||
assertEquals(zi.getKTO(), getOwnKto());
|
assertEquals(zi.getKTO(), getTradeSettlementPayment()[0].getOwnKto());
|
||||||
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
||||||
assertEquals(zi.getDueDate(), "20170530");
|
assertEquals(zi.getDueDate(), "20170530");
|
||||||
assertEquals(zi.getForeignReference(), getNumber());
|
assertEquals(zi.getForeignReference(), getNumber());
|
||||||
@@ -384,10 +219,10 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
|
|||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals(zi.getAmount(), "571.04");
|
assertEquals(zi.getAmount(), "571.04");
|
||||||
assertEquals(zi.getBIC(), getOwnBIC());
|
assertEquals(zi.getBIC(), getTradeSettlementPayment()[0].getOwnBIC());
|
||||||
assertEquals(zi.getBLZ(), getOwnBLZ());
|
assertEquals(zi.getBLZ(), getTradeSettlementPayment()[0].getOwnBLZ());
|
||||||
assertEquals(zi.getIBAN(), getOwnIBAN());
|
assertEquals(zi.getIBAN(), getTradeSettlementPayment()[0].getOwnIBAN());
|
||||||
assertEquals(zi.getKTO(), getOwnKto());
|
assertEquals(zi.getKTO(), getTradeSettlementPayment()[0].getOwnKto());
|
||||||
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
||||||
assertEquals(zi.getForeignReference(), getNumber());
|
assertEquals(zi.getForeignReference(), getNumber());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,12 +30,10 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
|
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExportableTransaction {
|
public class MustangReaderWriterTest extends MustangReaderTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Date getDeliveryDate() {
|
public Date getDeliveryDate() {
|
||||||
@@ -57,36 +55,11 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
return "RE-20171118/506";
|
return "RE-20171118/506";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnKto() {
|
|
||||||
return "44421800";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBLZ() {
|
|
||||||
return "41441604";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBIC() {
|
|
||||||
return "COBADEFFXXX";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnBankName() {
|
|
||||||
return "Commerzbank";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnCountry() {
|
public String getOwnCountry() {
|
||||||
return "DE";
|
return "DE";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnIBAN() {
|
|
||||||
return "DE88 2008 0000 0970 3757 00";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOwnLocation() {
|
public String getOwnLocation() {
|
||||||
return "Stadthausen";
|
return "Stadthausen";
|
||||||
@@ -146,11 +119,6 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
return allItems;
|
return allItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getOwnPaymentInfoText() {
|
|
||||||
return "Überweisung";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPaymentTermDescription() {
|
public String getPaymentTermDescription() {
|
||||||
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy");
|
||||||
@@ -183,140 +151,6 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
class Contact implements IZUGFeRDExportableContact {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getCountry() {
|
|
||||||
return "DE";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getLocation() {
|
|
||||||
return "Spielkreis";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "Theodor Est";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getStreet() {
|
|
||||||
return "Bahnstr. 42";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getVATID() {
|
|
||||||
return "DE999999999";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getZIP() {
|
|
||||||
return "88802";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Item implements IZUGFeRDExportableItem {
|
|
||||||
|
|
||||||
public Item(BigDecimal price, BigDecimal quantity, Product product) {
|
|
||||||
super();
|
|
||||||
this.price = price;
|
|
||||||
this.quantity = quantity;
|
|
||||||
this.product = product;
|
|
||||||
}
|
|
||||||
|
|
||||||
private BigDecimal price, quantity;
|
|
||||||
private Product product;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getPrice() {
|
|
||||||
return price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPrice(BigDecimal price) {
|
|
||||||
this.price = price;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getQuantity() {
|
|
||||||
return quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setQuantity(BigDecimal quantity) {
|
|
||||||
this.quantity = quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Product getProduct() {
|
|
||||||
return product;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProduct(Product product) {
|
|
||||||
this.product = product;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDAllowanceCharge[] getItemAllowances() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IZUGFeRDAllowanceCharge[] getItemCharges() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class Product implements IZUGFeRDExportableProduct {
|
|
||||||
private String description, name, unit;
|
|
||||||
private BigDecimal VATPercent;
|
|
||||||
|
|
||||||
public Product(String description, String name, String unit, BigDecimal VATPercent) {
|
|
||||||
super();
|
|
||||||
this.description = description;
|
|
||||||
this.name = name;
|
|
||||||
this.unit = unit;
|
|
||||||
this.VATPercent = VATPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getUnit() {
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUnit(String unit) {
|
|
||||||
this.unit = unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public BigDecimal getVATPercent() {
|
|
||||||
return VATPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVATPercent(BigDecimal VATPercent) {
|
|
||||||
this.VATPercent = VATPercent;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the test case
|
* Create the test case
|
||||||
*
|
*
|
||||||
@@ -351,10 +185,10 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals(zi.getAmount(), "571.04");
|
assertEquals(zi.getAmount(), "571.04");
|
||||||
assertEquals(zi.getBLZ(), getOwnBLZ());
|
assertEquals(zi.getBLZ(), getTradeSettlementPayment()[0].getOwnBLZ());
|
||||||
assertEquals(zi.getBIC(), getOwnBIC());
|
assertEquals(zi.getBIC(), getTradeSettlementPayment()[0].getOwnBIC());
|
||||||
assertEquals(zi.getIBAN(), getOwnIBAN());
|
assertEquals(zi.getIBAN(),getTradeSettlementPayment()[0].getOwnIBAN());
|
||||||
assertEquals(zi.getKTO(), getOwnKto());
|
assertEquals(zi.getKTO(), getTradeSettlementPayment()[0].getOwnKto());
|
||||||
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
||||||
assertEquals(zi.getForeignReference(), "RE-20170509/505");
|
assertEquals(zi.getForeignReference(), "RE-20170509/505");
|
||||||
}
|
}
|
||||||
@@ -488,9 +322,9 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
String pdfContent = baos.toString("UTF-8");
|
String pdfContent = baos.toString("UTF-8");
|
||||||
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
|
assertFalse(pdfContent.indexOf("(via mustangproject.org") == -1);
|
||||||
// check for pdf-a schema extension
|
// check for pdf-a schema extension
|
||||||
assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);
|
// assertFalse(pdfContent.indexOf("<zf:ConformanceLevel>EN 16931</zf:ConformanceLevel>") == -1);
|
||||||
assertFalse(pdfContent.indexOf("<pdfaSchema:prefix>zf</pdfaSchema:prefix>") == -1);
|
// assertFalse(pdfContent.indexOf("<pdfaSchema:prefix>zf</pdfaSchema:prefix>") == -1);
|
||||||
assertFalse(pdfContent.indexOf("urn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#") == -1);
|
// assertFalse(pdfContent.indexOf("urn:zugferd:pdfa:CrossIndustryDocument:invoice:2p0#") == -1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,9 +333,9 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals(zi.getAmount(), "571.04");
|
assertEquals(zi.getAmount(), "571.04");
|
||||||
assertEquals(zi.getBIC(), getOwnBIC());
|
assertEquals(zi.getBIC(), getTradeSettlementPayment()[0].getOwnBIC());
|
||||||
assertEquals(zi.getIBAN(), getOwnIBAN());
|
assertEquals(zi.getIBAN(), getTradeSettlementPayment()[0].getOwnIBAN());
|
||||||
assertEquals(zi.getKTO(), getOwnKto());
|
assertEquals(zi.getKTO(), getTradeSettlementPayment()[0].getOwnKto());
|
||||||
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
||||||
assertEquals(zi.getForeignReference(), getNumber());
|
assertEquals(zi.getForeignReference(), getNumber());
|
||||||
}
|
}
|
||||||
@@ -536,9 +370,9 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
|
|||||||
|
|
||||||
// Reading ZUGFeRD
|
// Reading ZUGFeRD
|
||||||
assertEquals(zi.getAmount(), "571.04");
|
assertEquals(zi.getAmount(), "571.04");
|
||||||
assertEquals(zi.getBIC(), getOwnBIC());
|
assertEquals(zi.getBIC(), getTradeSettlementPayment()[0].getOwnBIC());
|
||||||
assertEquals(zi.getIBAN(), getOwnIBAN());
|
assertEquals(zi.getIBAN(), getTradeSettlementPayment()[0].getOwnIBAN());
|
||||||
assertEquals(zi.getKTO(), getOwnKto());
|
assertEquals(zi.getKTO(), getTradeSettlementPayment()[0].getOwnKto());
|
||||||
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
assertEquals(zi.getHolder(), getOwnOrganisationName());
|
||||||
assertEquals(zi.getForeignReference(), getNumber());
|
assertEquals(zi.getForeignReference(), getNumber());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class ZUGFeRDTransactionModelConverterTest {
|
|||||||
.setOwnStreet("own street")
|
.setOwnStreet("own street")
|
||||||
.setOwnCountry("own country")
|
.setOwnCountry("own country")
|
||||||
.setOwnLocation("own city")
|
.setOwnLocation("own city")
|
||||||
.setOwnBankName("own bank")
|
.setTradeSettlementPayment(new IZUGFeRDTradeSettlementPaymentImpl().setOwnBankName("own bank"))
|
||||||
.setZFItems(
|
.setZFItems(
|
||||||
new IZUGFeRDExportableItemImpl()
|
new IZUGFeRDExportableItemImpl()
|
||||||
.setProduct(new IZUGFeRDExportableProductImpl()
|
.setProduct(new IZUGFeRDExportableProductImpl()
|
||||||
|
|||||||
Reference in New Issue
Block a user