diff --git a/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableOrganization.java b/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableOrganization.java new file mode 100644 index 00000000..312b4666 --- /dev/null +++ b/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableOrganization.java @@ -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(); +} diff --git a/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableTransaction.java b/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableTransaction.java index 6addf89f..31847027 100644 --- a/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableTransaction.java +++ b/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableTransaction.java @@ -83,6 +83,10 @@ public interface IZUGFeRDExportableTransaction { return null; } + default IZUGFeRDExportableOrganization getOwnOrganization() { + return null; + } + /** * who processed the order * diff --git a/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java b/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java index a1d4a842..f8d01465 100644 --- a/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java +++ b/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java @@ -292,6 +292,14 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider { xml = xml + " \n" //$NON-NLS-1$ // + " 4000001123452\n" + " " + trans.getOwnOrganisationName() + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ + if (trans.getOwnOrganization()!=null) { + + xml = xml + " \n" + + " "+trans.getOwnOrganization().getID()+"\n" + + " "+trans.getOwnOrganization().getName()+"\n" + + " "; + + } if (trans.getOwnContact() != null) { xml = xml + "\n" + " " + trans.getOwnContact().getName() + "\n"; diff --git a/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderTestCase.java b/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderTestCase.java index bf9877f0..8ae406a5 100644 --- a/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderTestCase.java +++ b/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderTestCase.java @@ -27,6 +27,10 @@ public abstract class MustangReaderTestCase extends TestCase implements IZUGFeRD public MustangReaderTestCase(String testName) { super(testName); } + + @Override public IZUGFeRDExportableOrganization getOwnOrganization() { + return new SenderOrganization(); + } @Override public IZUGFeRDTradeSettlementPayment[] getTradeSettlementPayment() { @@ -100,6 +104,21 @@ public abstract class MustangReaderTestCase extends TestCase implements IZUGFeRD return "88802"; } } + + 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 {