Add URIUniversalCommunication to TradeParty

This commit is contained in:
Sebastian Sieber
2023-04-18 14:53:59 +02:00
parent 610745a211
commit 6970279764
3 changed files with 53 additions and 5 deletions

View File

@@ -31,6 +31,7 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
protected Contact contact = null;
protected LegalOrganisation legalOrg = null;
protected SchemedID globalId=null;
protected SchemedID uriUniversalCommunicationId=null;
/**
* Default constructor.
@@ -192,6 +193,27 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
}
@Override
public String getUriUniversalCommunicationID() {
if (uriUniversalCommunicationId!=null) {
return uriUniversalCommunicationId.getID();
}
return null;
}
@Override
public String getUriUniversalCommunicationIDScheme() {
if (uriUniversalCommunicationId!=null) {
return uriUniversalCommunicationId.getScheme();
}
return null;
}
/**
* if it's a customer, this can e.g. be the customer ID
@@ -219,6 +241,11 @@ public class TradeParty implements IZUGFeRDExportableTradeParty {
globalId=schemedID;
return this;
}
public TradeParty addUriUniversalCommunicationID(SchemedID schemedID) {
uriUniversalCommunicationId=schemedID;
return this;
}
/***
* required (for senders, if payment is not debit): the BIC and IBAN

View File

@@ -49,7 +49,8 @@ public interface IZUGFeRDExportableTradeParty {
return null;
}
/***
/***
* gets the official representation
* @return the interface with the attributes of the legal organisation
*/
@@ -66,6 +67,23 @@ public interface IZUGFeRDExportableTradeParty {
}
/**
* URIUniversalCommunication scheme (see EAS code list of the ZUGFeRD documentation)
*
*/
default String getUriUniversalCommunicationIDScheme() {
return null;
}
/**
* The URIID of URIUniversalCommunicationID
* It is used by some countries, i.e. Luxembourg
*
*/
default String getUriUniversalCommunicationID() {
return null;
}
default IZUGFeRDExportableContact getContact() {
return null;
}

View File

@@ -157,14 +157,11 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ "</ram:FaxUniversalCommunication>";
}
if (party.getContact().getEMail() != null) {
xml += "<ram:EmailURIUniversalCommunication><ram:URIID>"
+ XMLTools.encodeXML(party.getContact().getEMail()) + "</ram:URIID>"
+ "</ram:EmailURIUniversalCommunication>";
}
xml += "</ram:DefinedTradeContact>";
}
xml += "<ram:PostalTradeAddress>";
@@ -188,11 +185,17 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
xml += "<ram:CityName>" + XMLTools.encodeXML(party.getLocation())
+ "</ram:CityName>";
}
;
//country IS mandatory
xml += "<ram:CountryID>" + XMLTools.encodeXML(party.getCountry())
+ "</ram:CountryID>"
+ "</ram:PostalTradeAddress>";
if (party.getUriUniversalCommunicationID() != null && party.getUriUniversalCommunicationIDScheme()!=null) {
xml += "<ram:URIUniversalCommunication>" +
"<ram:URIID schemeID=\"" + party.getUriUniversalCommunicationIDScheme() + "\">" +
XMLTools.encodeXML(party.getUriUniversalCommunicationID())
+ "</ram:URIID></ram:URIUniversalCommunication>";
}
if ((party.getVATID() != null) && (!isShipToTradeParty)) {
xml += "<ram:SpecifiedTaxRegistration>"