Merge branch 'master' of github.com:ZUGFeRD/mustangproject
This commit is contained in:
@@ -105,53 +105,9 @@ public interface IZUGFeRDExportableTransaction {
|
||||
|
||||
|
||||
/**
|
||||
* BIC of the sender
|
||||
*
|
||||
* @return the BIC code of the recipient sender's bank
|
||||
* the creditors payment informations
|
||||
*/
|
||||
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;
|
||||
}
|
||||
IZUGFeRDTradeSettlementPayment[] getTradeSettlementPayment();
|
||||
|
||||
|
||||
/**
|
||||
@@ -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
|
||||
*
|
||||
|
||||
@@ -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 {
|
||||
|
||||
private class LineCalc {
|
||||
private IZUGFeRDExportableItem currentItem = null;
|
||||
private BigDecimal totalGross;
|
||||
private BigDecimal itemTotalNetAmount;
|
||||
private BigDecimal itemTotalVATAmount;
|
||||
|
||||
public LineCalc(IZUGFeRDExportableItem currentItem) {
|
||||
this.currentItem = currentItem;
|
||||
BigDecimal multiplicator = currentItem.getProduct().getVATPercent().divide(new BigDecimal(100)).add(new BigDecimal(1));
|
||||
// priceGross=currentItem.getPrice().multiply(multiplicator);
|
||||
totalGross = currentItem.getPrice().multiply(multiplicator).multiply(currentItem.getQuantity());
|
||||
@@ -58,14 +56,11 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
protected byte[] zugferdData;
|
||||
private IZUGFeRDExportableTransaction trans;
|
||||
private boolean isTest;
|
||||
|
||||
/**
|
||||
* enables the flag to indicate a test invoice in the XML structure
|
||||
*/
|
||||
public void setTest() {
|
||||
isTest = true;
|
||||
}
|
||||
public void setTest() {}
|
||||
|
||||
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
|
||||
*/
|
||||
private HashMap<BigDecimal, VATAmount> getVATPercentAmountMap() {
|
||||
HashMap<BigDecimal, VATAmount> hm = new HashMap<BigDecimal, VATAmount>();
|
||||
HashMap<BigDecimal, VATAmount> hm = new HashMap<>();
|
||||
|
||||
for (IZUGFeRDExportableItem currentItem : trans.getZFItems()) {
|
||||
BigDecimal percent = currentItem.getProduct().getVATPercent();
|
||||
@@ -174,15 +169,9 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
|
||||
@Override
|
||||
public void generateXML(IZUGFeRDExportableTransaction trans) {
|
||||
|
||||
this.trans = trans;
|
||||
SimpleDateFormat germanDateFormat = new SimpleDateFormat("dd.MM.yyyy"); //$NON-NLS-1$
|
||||
SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd"); //$NON-NLS-1$
|
||||
String testBooleanStr = "false";
|
||||
if (isTest) {
|
||||
testBooleanStr = "true";
|
||||
|
||||
}
|
||||
String senderReg = "";
|
||||
if (trans.getOwnOrganisationFullPlaintextInfo() != null) {
|
||||
senderReg = ""
|
||||
@@ -331,21 +320,23 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||
+ " </ram:ApplicableHeaderTradeDelivery>\n"
|
||||
+ " <ram:ApplicableHeaderTradeSettlement>\n" //$NON-NLS-1$
|
||||
+ " <ram:PaymentReference>" + trans.getNumber() + "</ram:PaymentReference>\n" //$NON-NLS-1$ //$NON-NLS-2$
|
||||
+ " <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$
|
||||
+ " <ram:InvoiceCurrencyCode>EUR</ram:InvoiceCurrencyCode>\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();
|
||||
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.DateTimeTypeConstants;
|
||||
import org.mustangproject.ZUGFeRD.model.DocumentCodeType;
|
||||
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
|
||||
import org.mustangproject.ZUGFeRD.model.DocumentContextParameterType;
|
||||
import org.mustangproject.ZUGFeRD.model.DocumentContextParameterTypeConstants;
|
||||
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.SupplyChainTradeTransactionType;
|
||||
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeType;
|
||||
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants;
|
||||
import org.mustangproject.ZUGFeRD.model.TaxRegistrationType;
|
||||
import org.mustangproject.ZUGFeRD.model.TaxRegistrationTypeConstants;
|
||||
import org.mustangproject.ZUGFeRD.model.TaxTypeCodeType;
|
||||
@@ -340,7 +338,7 @@ class ZUGFeRDTransactionModelConverter {
|
||||
currencyCode.setValue(currency);
|
||||
tradeSettlement.setInvoiceCurrencyCode(currencyCode);
|
||||
|
||||
tradeSettlement.getSpecifiedTradeSettlementPaymentMeans().add(
|
||||
tradeSettlement.getSpecifiedTradeSettlementPaymentMeans().addAll(
|
||||
getPaymentData());
|
||||
tradeSettlement.getApplicableTradeTax().addAll(getTradeTax());
|
||||
tradeSettlement.getSpecifiedTradePaymentTerms().addAll(
|
||||
@@ -364,46 +362,50 @@ class ZUGFeRDTransactionModelConverter {
|
||||
}
|
||||
|
||||
|
||||
private TradeSettlementPaymentMeansType getPaymentData() {
|
||||
TradeSettlementPaymentMeansType paymentData = xmlFactory
|
||||
.createTradeSettlementPaymentMeansType();
|
||||
PaymentMeansCodeType paymentDataType = xmlFactory
|
||||
.createPaymentMeansCodeType();
|
||||
paymentDataType.setValue(PaymentMeansCodeTypeConstants.BANKACCOUNT);
|
||||
paymentData.setTypeCode(paymentDataType);
|
||||
private List<TradeSettlementPaymentMeansType> getPaymentData() {
|
||||
List<TradeSettlementPaymentMeansType> result = new ArrayList<>();
|
||||
for (IZUGFeRDTradeSettlementPayment settlementPayment : trans.getTradeSettlementPayment()) {
|
||||
TradeSettlementPaymentMeansType paymentData = xmlFactory
|
||||
.createTradeSettlementPaymentMeansType();
|
||||
PaymentMeansCodeType paymentDataType = xmlFactory
|
||||
.createPaymentMeansCodeType();
|
||||
paymentDataType.setValue(PaymentMeansCodeTypeConstants.BANKACCOUNT);
|
||||
paymentData.setTypeCode(paymentDataType);
|
||||
|
||||
TextType paymentInfo = xmlFactory.createTextType();
|
||||
String paymentInfoText = trans.getOwnPaymentInfoText();
|
||||
if (paymentInfoText == null) {
|
||||
paymentInfoText = "";
|
||||
TextType paymentInfo = xmlFactory.createTextType();
|
||||
String paymentInfoText = settlementPayment.getOwnPaymentInfoText();
|
||||
if (paymentInfoText == null) {
|
||||
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);
|
||||
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;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user