added the possibility to specify legalorganisation

This commit is contained in:
jstaerk
2022-02-16 20:27:18 +01:00
parent a8512cf0f2
commit ddb71f9ed5
7 changed files with 157 additions and 8 deletions

View File

@@ -6,10 +6,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableContact;
import org.mustangproject.ZUGFeRD.IZUGFeRDExportableTradeParty;
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlement;
import org.mustangproject.ZUGFeRD.IZUGFeRDTradeSettlementDebit;
import org.mustangproject.ZUGFeRD.*;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -26,6 +23,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
protected List<BankDetails> bankDetails = new ArrayList<>();
protected List<IZUGFeRDTradeSettlementDebit> debitDetails = new ArrayList<>();
protected Contact contact = null;
protected LegalOrganisation legalOrg = null;
/**
* Default constructor.
@@ -195,6 +193,16 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
return this;
}
@Override
public IZUGFeRDLegalOrganisation getLegalOrganisation() {
return legalOrg;
}
public TradeParty setLegalOrganisation(LegalOrganisation legalOrganisation) {
legalOrg=legalOrganisation;
return this;
}
public List<BankDetails> getBankDetails() {
return bankDetails;
}

View File

@@ -49,6 +49,13 @@ public interface IZUGFeRDExportableTradeParty {
return null;
}
/***
* gets the official representation
* @return the interface with the attributes of the legal organisation
*/
default IZUGFeRDLegalOrganisation getLegalOrganisation() {
return null;
}
/**
* customer global identification scheme
*

View File

@@ -0,0 +1,39 @@
/** **********************************************************************
*
* Copyright 2018 Jochen Staerk
*
* 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 javax.activation.DataSource;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
public interface IZUGFeRDLegalOrganisation {
/***
*
* @return the ID of the legal organisation
*/
public String getID();
/**
*
* @return the scheme attribute of the legal organization=the type of the identification, e.g. 0002=Siren
*/
public String getSchemeID();
}

View File

@@ -130,6 +130,12 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
}
xml += " <ram:Name>" + XMLTools.encodeXML(party.getName()) + "</ram:Name>\n";
if (party.getLegalOrganisation()!=null) {
xml += "<ram:SpecifiedLegalOrganization> ";
xml += " <ram:ID schemeID=\""+XMLTools.encodeXML(party.getLegalOrganisation().getSchemeID())+"\">"+XMLTools.encodeXML(party.getLegalOrganisation().getID())+"</ram:ID>";
xml += "</ram:SpecifiedLegalOrganization>";
}
if ((party.getContact() != null) && (isSender || profile == Profiles.getByName("Extended") || profile == Profiles.getByName("XRechnung"))) {
xml = xml + "<ram:DefinedTradeContact>\n";
if (party.getContact().getName() != null) {