support specifiedlegalorganization

This commit is contained in:
Jochen Stärk
2019-06-09 16:07:04 +02:00
parent d5122364dc
commit 513040558c
4 changed files with 57 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
/** **********************************************************************
*
* Copyright 2019 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;
public interface IZUGFeRDExportableOrganization {
public String getID();
public String getName();
}

View File

@@ -83,6 +83,10 @@ public interface IZUGFeRDExportableTransaction {
return null;
}
default IZUGFeRDExportableOrganization getOwnOrganization() {
return null;
}
/**
* who processed the order
*

View File

@@ -292,6 +292,14 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
xml = xml + " <ram:SellerTradeParty>\n" //$NON-NLS-1$
// + " <GlobalID schemeID=\"0088\">4000001123452</GlobalID>\n"
+ " <ram:Name>" + trans.getOwnOrganisationName() + "</ram:Name>\n"; //$NON-NLS-1$ //$NON-NLS-2$
if (trans.getOwnOrganization()!=null) {
xml = xml + " <ram:SpecifiedLegalOrganization>\n" +
" <ram:ID>"+trans.getOwnOrganization().getID()+"</ram:ID>\n" +
" <ram:TradingBusinessName>"+trans.getOwnOrganization().getName()+"</ram:TradingBusinessName>\n" +
" </ram:SpecifiedLegalOrganization>";
}
if (trans.getOwnContact() != null) {
xml = xml + "<ram:DefinedTradeContact>\n" + " <ram:PersonName>" + trans.getOwnContact().getName()
+ "</ram:PersonName>\n";

View File

@@ -28,6 +28,10 @@ public abstract class MustangReaderTestCase extends TestCase implements IZUGFeRD
super(testName);
}
@Override public IZUGFeRDExportableOrganization getOwnOrganization() {
return new SenderOrganization();
}
@Override
public IZUGFeRDTradeSettlementPayment[] getTradeSettlementPayment() {
Payment[] payments = new Payment[1];
@@ -101,6 +105,21 @@ public abstract class MustangReaderTestCase extends TestCase implements IZUGFeRD
}
}
protected class SenderOrganization implements IZUGFeRDExportableOrganization {
@Override
public String getID() {
return "HRA-555123456";
}
@Override
public String getName() {
return "Bei Spiel GmbH";
}
}
protected class SenderContact implements IZUGFeRDExportableContact {