switch to new profiles (the old ones did not work)
This commit is contained in:
@@ -25,13 +25,14 @@
|
|||||||
- removal of izugferddate/IZUGFeRDPaymentTerms,IZUGFeRDPaymentDiscountTerms
|
- removal of izugferddate/IZUGFeRDPaymentTerms,IZUGFeRDPaymentDiscountTerms
|
||||||
switch
|
switch
|
||||||
- change from ZUGFeRDExporter to IZUGFeRDExporter
|
- change from ZUGFeRDExporter to IZUGFeRDExporter
|
||||||
|
- switch recipient, shipping address from contact to tradeparty
|
||||||
|
- switch from profiles to profile
|
||||||
- javadoc export
|
- javadoc export
|
||||||
- have visualizer
|
- have visualizer
|
||||||
- validate as library doc
|
- validate as library doc
|
||||||
- unify loggers
|
- unify loggers
|
||||||
- release notes
|
- release notes
|
||||||
- new tradeparty class, Contact getOwnContact superseded by TradeParty getSender
|
- new tradeparty class, Contact getOwnContact superseded by TradeParty getSender
|
||||||
- switch recipient, shipping address from contact to tradeparty
|
|
||||||
- new invoicecorrection class
|
- new invoicecorrection class
|
||||||
- order-x read support
|
- order-x read support
|
||||||
- automated tests zuv/verapdf validate created library test files
|
- automated tests zuv/verapdf validate created library test files
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ public class Main {
|
|||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
int zfIntVersion = ZUGFeRDExporterFromA3.DefaultZUGFeRDVersion;
|
int zfIntVersion = ZUGFeRDExporterFromA3.DefaultZUGFeRDVersion;
|
||||||
Profiles zfConformanceLevelProfile = Profiles.EXTENDED;
|
Profile zfConformanceLevelProfile = Profiles.getByName("EXTENDED");
|
||||||
|
|
||||||
if (pdfName == null) {
|
if (pdfName == null) {
|
||||||
pdfName = getFilenameFromUser("Source PDF", "invoice.pdf", "pdf", true, false);
|
pdfName = getFilenameFromUser("Source PDF", "invoice.pdf", "pdf", true, false);
|
||||||
@@ -493,29 +493,29 @@ public class Main {
|
|||||||
|
|
||||||
if ((format.equals("zf")) && (zfIntVersion == 1)) {
|
if ((format.equals("zf")) && (zfIntVersion == 1)) {
|
||||||
if (zfProfile.equals("b")) {
|
if (zfProfile.equals("b")) {
|
||||||
zfConformanceLevelProfile = Profiles.BASIC;
|
zfConformanceLevelProfile = Profiles.getByName("BASIC", zfIntVersion);
|
||||||
} else if (zfProfile.equals("c")) {
|
} else if (zfProfile.equals("c")) {
|
||||||
zfConformanceLevelProfile = Profiles.COMFORT;
|
zfConformanceLevelProfile = Profiles.getByName("COMFORT", zfIntVersion);
|
||||||
} else if (zfProfile.equals("e")) {
|
} else if (zfProfile.equals("e")) {
|
||||||
zfConformanceLevelProfile = Profiles.EXTENDED;
|
zfConformanceLevelProfile = Profiles.getByName("EXTENDED", zfIntVersion);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(String.format("Unknown ZUGFeRD profile '%s'", zfProfile));
|
throw new Exception(String.format("Unknown ZUGFeRD profile '%s'", zfProfile));
|
||||||
}
|
}
|
||||||
} else if (((format.equals("zf")) && (zfIntVersion == 2)) || (format.equals("fx"))) {
|
} else if (((format.equals("zf")) && (zfIntVersion == 2)) || (format.equals("fx"))) {
|
||||||
if (zfProfile.equals("m")) {
|
if (zfProfile.equals("m")) {
|
||||||
zfConformanceLevelProfile = Profiles.MINIMUM;
|
zfConformanceLevelProfile = Profiles.getByName("MINIMUM", zfIntVersion);
|
||||||
} else if (zfProfile.equals("w")) {
|
} else if (zfProfile.equals("w")) {
|
||||||
zfConformanceLevelProfile = Profiles.BASICWL;
|
zfConformanceLevelProfile = Profiles.getByName("BASICWL", zfIntVersion);
|
||||||
} else if (zfProfile.equals("b")) {
|
} else if (zfProfile.equals("b")) {
|
||||||
zfConformanceLevelProfile = Profiles.BASIC;
|
zfConformanceLevelProfile = Profiles.getByName("BASIC", zfIntVersion);
|
||||||
} else if (zfProfile.equals("c")) {
|
} else if (zfProfile.equals("c")) {
|
||||||
zfConformanceLevelProfile = Profiles.CIUS;
|
zfConformanceLevelProfile = Profiles.getByName("CIUS", zfIntVersion);
|
||||||
} else if (zfProfile.equals("e")) {
|
} else if (zfProfile.equals("e")) {
|
||||||
zfConformanceLevelProfile = Profiles.EN16931;
|
zfConformanceLevelProfile = Profiles.getByName("EN16931", zfIntVersion);
|
||||||
} else if (zfProfile.equals("t")) {
|
} else if (zfProfile.equals("t")) {
|
||||||
zfConformanceLevelProfile = Profiles.EXTENDED;
|
zfConformanceLevelProfile = Profiles.getByName("EXTENDED", zfIntVersion);
|
||||||
} else if (zfProfile.equals("x")) {
|
} else if (zfProfile.equals("x")) {
|
||||||
zfConformanceLevelProfile = Profiles.XRECHNUNG;
|
zfConformanceLevelProfile = Profiles.getByName("XRECHNUNG", zfIntVersion);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception(String.format("Unknown ZUGFeRD profile '%s'", zfProfile));
|
throw new Exception(String.format("Unknown ZUGFeRD profile '%s'", zfProfile));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class Invoice implements IExportableTransaction {
|
|||||||
Charges = new ArrayList<IZUGFeRDAllowanceCharge>(), LogisticsServiceCharges = new ArrayList<IZUGFeRDAllowanceCharge>();
|
Charges = new ArrayList<IZUGFeRDAllowanceCharge>(), LogisticsServiceCharges = new ArrayList<IZUGFeRDAllowanceCharge>();
|
||||||
protected IZUGFeRDTradeSettlement[] getTradeSettlement = null;
|
protected IZUGFeRDTradeSettlement[] getTradeSettlement = null;
|
||||||
protected IZUGFeRDPaymentTerms paymentTerms = null;
|
protected IZUGFeRDPaymentTerms paymentTerms = null;
|
||||||
|
private Profile profile;
|
||||||
|
|
||||||
|
|
||||||
public Invoice() {
|
public Invoice() {
|
||||||
@@ -72,6 +73,7 @@ public class Invoice implements IExportableTransaction {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNumber() {
|
public String getNumber() {
|
||||||
return number;
|
return number;
|
||||||
@@ -482,4 +484,5 @@ public class Invoice implements IExportableTransaction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,9 +18,10 @@
|
|||||||
*********************************************************************** */
|
*********************************************************************** */
|
||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
public class CustomXMLProvider implements IXMLProvider, IProfileProvider {
|
public class CustomXMLProvider implements IXMLProvider {
|
||||||
|
|
||||||
protected byte[] zugferdData;
|
protected byte[] zugferdData;
|
||||||
|
protected Profile profile=Profiles.getByName("EN16931");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] getXML() {
|
public byte[] getXML() {
|
||||||
@@ -49,13 +50,11 @@ public class CustomXMLProvider implements IXMLProvider, IProfileProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getProfile() {
|
public Profile getProfile() {
|
||||||
// TODO Auto-generated method stub
|
return profile;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setProfile(Profile level) {
|
||||||
public void setProfile(Profiles level) {
|
profile=level;
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -435,4 +435,6 @@ public interface IExportableTransaction {
|
|||||||
default Date getOccurrencePeriodTo() {
|
default Date getOccurrencePeriodTo() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
/** **********************************************************************
|
|
||||||
*
|
|
||||||
* 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;
|
|
||||||
|
|
||||||
public interface IProfileProvider {
|
|
||||||
|
|
||||||
public String getProfile();
|
|
||||||
|
|
||||||
public void setProfile(Profiles level);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -26,4 +26,9 @@ public interface IXMLProvider {
|
|||||||
|
|
||||||
public void generateXML(IExportableTransaction trans);
|
public void generateXML(IExportableTransaction trans);
|
||||||
|
|
||||||
|
public void setProfile(Profile p);
|
||||||
|
|
||||||
|
public Profile getProfile();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public interface IZUGFeRDExporter extends Closeable, IExporter {
|
|||||||
public boolean ensurePDFIsValid(final DataSource dataSource) throws IOException;
|
public boolean ensurePDFIsValid(final DataSource dataSource) throws IOException;
|
||||||
public IZUGFeRDExporter setXML(byte[] zugferdData) throws IOException;
|
public IZUGFeRDExporter setXML(byte[] zugferdData) throws IOException;
|
||||||
public IZUGFeRDExporter disableFacturX();
|
public IZUGFeRDExporter disableFacturX();
|
||||||
public IZUGFeRDExporter setProfile(Profiles zugferdConformanceLevel);
|
// public IZUGFeRDExporter setProfile(Profile zugferdConformanceLevel);
|
||||||
public String getNamespaceForVersion(int ver);
|
public String getNamespaceForVersion(int ver);
|
||||||
public String getPrefixForVersion(int ver) ;
|
public String getPrefixForVersion(int ver) ;
|
||||||
public IZUGFeRDExporter disableAutoClose(boolean disableAutoClose);
|
public IZUGFeRDExporter disableAutoClose(boolean disableAutoClose);
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
|
public class Profile {
|
||||||
|
protected String name, id;
|
||||||
|
|
||||||
|
public Profile(String name, String ID) {
|
||||||
|
this.name = name;
|
||||||
|
this.id = ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getID() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getXMPName() {
|
||||||
|
if (name.equals("BASICWL")) {
|
||||||
|
return "BASIC WL";
|
||||||
|
} else if (name.equals("EN16931")) {
|
||||||
|
return "EN 16931";
|
||||||
|
} else {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +1,59 @@
|
|||||||
/** **********************************************************************
|
/**
|
||||||
*
|
* *********************************************************************
|
||||||
|
* <p>
|
||||||
* Copyright 2018 Jochen Staerk
|
* Copyright 2018 Jochen Staerk
|
||||||
*
|
* <p>
|
||||||
* Use is subject to license terms.
|
* Use is subject to license terms.
|
||||||
*
|
* <p>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
* 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
|
* 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.
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
*
|
* <p>
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
*
|
* <p>
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*
|
* <p>
|
||||||
*********************************************************************** */
|
* **********************************************************************
|
||||||
|
*/
|
||||||
package org.mustangproject.ZUGFeRD;
|
package org.mustangproject.ZUGFeRD;
|
||||||
|
|
||||||
public enum Profiles {
|
import java.util.ArrayList;
|
||||||
BASIC, COMFORT, EXTENDED, EN16931/*=Comfort*/, MINIMUM, BASICWL /*basic without lines, less than basic*/, CIUS, XRECHNUNG
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class Profiles {
|
||||||
|
static Map<String, Profile> zf2Map = Stream.of(new Object[][]{
|
||||||
|
{"MINIMUM", new Profile("MINIMUM", "urn:factur-x.eu:1p0:minimum")},
|
||||||
|
{"BASICWL", new Profile("BASICWL", "urn:factur-x.eu:1p0:basicwl")},
|
||||||
|
{"BASIC", new Profile("BASIC", "urn:cen.eu:en16931:2017#compliant#urn:factur-x.eu:1p0:basic")},
|
||||||
|
{"EN16931", new Profile("EN16931", "urn:cen.eu:en16931:2017")},
|
||||||
|
{"EXTENDED", new Profile("EXTENDED", "urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended")},
|
||||||
|
{"XRECHNUNG", new Profile("XRECHNUNG", "XRECHNUNG")}
|
||||||
|
|
||||||
|
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
|
||||||
|
static Map<String, Profile> zf1Map = Stream.of(new Object[][]{
|
||||||
|
{"BASIC", new Profile("BASIC", "urn:ferd:CrossIndustryDocument:invoice:1p0:basic")},
|
||||||
|
{"COMFORT", new Profile("COMFORT", "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort")},
|
||||||
|
{"EXTENDED", new Profile("EXTENDED", "urn:ferd:CrossIndustryDocument:invoice:1p0:extended")},
|
||||||
|
|
||||||
|
|
||||||
|
}).collect(Collectors.toMap(data -> (String) data[0], data -> (Profile) data[1]));
|
||||||
|
|
||||||
|
|
||||||
|
public static Profile getByName(String name, int version) {
|
||||||
|
if (version==1) {
|
||||||
|
return zf1Map.get(name);
|
||||||
|
} else {
|
||||||
|
return zf2Map.get(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static Profile getByName(String name) {
|
||||||
|
return getByName(name, ZUGFeRDExporterFromA3.DefaultZUGFeRDVersion);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,17 +41,12 @@ public class XMPSchemaZugferd extends XMPSchema {
|
|||||||
* @param prefix the xml namespace prefix for the XMP, zf for ZUGFeRD, fx for Factur-X
|
* @param prefix the xml namespace prefix for the XMP, zf for ZUGFeRD, fx for Factur-X
|
||||||
* @param filename the filename of the invoice
|
* @param filename the filename of the invoice
|
||||||
*/
|
*/
|
||||||
public XMPSchemaZugferd(XMPMetadata metadata, int zfVersion, boolean isFacturX, Profiles conformanceLevel, String URN, String prefix, String filename) {
|
public XMPSchemaZugferd(XMPMetadata metadata, int zfVersion, boolean isFacturX, Profile conformanceLevel, String URN, String prefix, String filename) {
|
||||||
super(metadata, URN, prefix, "ZUGFeRD Schema");
|
super(metadata, URN, prefix, "ZUGFeRD Schema");
|
||||||
|
|
||||||
setAboutAsSimple("");
|
setAboutAsSimple("");
|
||||||
|
|
||||||
String conformanceLevelValue = conformanceLevel.name();
|
String conformanceLevelValue = conformanceLevel.getXMPName();
|
||||||
if (conformanceLevelValue.equals("BASICWL")) {
|
|
||||||
conformanceLevelValue = "BASIC WL";
|
|
||||||
} else if (conformanceLevelValue.equals("EN16931")) {
|
|
||||||
conformanceLevelValue = "EN 16931";
|
|
||||||
}
|
|
||||||
setTextPropertyValue("ConformanceLevel", conformanceLevelValue);
|
setTextPropertyValue("ConformanceLevel", conformanceLevelValue);
|
||||||
setTextPropertyValue("DocumentType", "INVOICE");
|
setTextPropertyValue("DocumentType", "INVOICE");
|
||||||
setTextPropertyValue("DocumentFileName", filename);
|
setTextPropertyValue("DocumentFileName", filename);
|
||||||
|
|||||||
@@ -35,21 +35,17 @@ import java.util.HashMap;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
public class ZUGFeRD1PullProvider implements IXMLProvider {
|
||||||
|
|
||||||
|
|
||||||
//// MAIN CLASS
|
//// MAIN CLASS
|
||||||
|
|
||||||
protected byte[] zugferdData;
|
protected byte[] zugferdData;
|
||||||
private IExportableTransaction trans;
|
private IExportableTransaction trans;
|
||||||
private Profiles level;
|
|
||||||
private String paymentTermsDescription;
|
private String paymentTermsDescription;
|
||||||
SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd");
|
SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||||
|
protected Profile profile=Profiles.getByName("COMFORT",1);
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setProfile(Profiles level) {
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enables the flag to indicate a test invoice in the XML structure
|
* enables the flag to indicate a test invoice in the XML structure
|
||||||
@@ -73,6 +69,12 @@ public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
return XMLTools.nDigitFormat(value, 4);
|
return XMLTools.nDigitFormat(value, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Profile getProfile() {
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public byte[] getXML() {
|
public byte[] getXML() {
|
||||||
|
|
||||||
@@ -152,11 +154,6 @@ public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
return hm;
|
return hm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getProfile() {
|
|
||||||
return "urn:ferd:CrossIndustryDocument:invoice:1p0:comfort";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected String getTradePartyAsXML(IZUGFeRDExportableTradeParty contact) {
|
protected String getTradePartyAsXML(IZUGFeRDExportableTradeParty contact) {
|
||||||
String xml = " <ram:Name>" + XMLTools.encodeXML(contact.getName()) + "</ram:Name>\n" //$NON-NLS-2$
|
String xml = " <ram:Name>" + XMLTools.encodeXML(contact.getName()) + "</ram:Name>\n" //$NON-NLS-2$
|
||||||
// + " <DefinedTradeContact>\n"
|
// + " <DefinedTradeContact>\n"
|
||||||
@@ -242,7 +239,7 @@ public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>\n"
|
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>\n"
|
||||||
//
|
//
|
||||||
+ " <ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
+ " <ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||||
+ " <ram:ID>" + getProfile() + "</ram:ID>\n"
|
+ " <ram:ID>" + getProfile().getID() + "</ram:ID>\n"
|
||||||
+ " </ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
+ " </ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||||
+ " </rsm:SpecifiedExchangedDocumentContext>\n"
|
+ " </rsm:SpecifiedExchangedDocumentContext>\n"
|
||||||
+ " <rsm:HeaderExchangedDocument>\n"
|
+ " <rsm:HeaderExchangedDocument>\n"
|
||||||
@@ -541,6 +538,11 @@ public class ZUGFeRD1PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
} // $NON-NLS-1$
|
} // $NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProfile(Profile p) {
|
||||||
|
profile=p;
|
||||||
|
}
|
||||||
|
|
||||||
private String buildPaymentTermsXml() {
|
private String buildPaymentTermsXml() {
|
||||||
String paymentTermsXml = "<ram:SpecifiedTradePaymentTerms>";
|
String paymentTermsXml = "<ram:SpecifiedTradePaymentTerms>";
|
||||||
|
|
||||||
|
|||||||
@@ -38,19 +38,15 @@ import org.dom4j.io.XMLWriter;
|
|||||||
import org.mustangproject.Invoice;
|
import org.mustangproject.Invoice;
|
||||||
import org.mustangproject.XMLTools;
|
import org.mustangproject.XMLTools;
|
||||||
|
|
||||||
public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
|
public class ZUGFeRD2PullProvider implements IXMLProvider {
|
||||||
|
|
||||||
//// MAIN CLASS
|
//// MAIN CLASS
|
||||||
protected SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd");
|
protected SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd");
|
||||||
protected byte[] zugferdData;
|
protected byte[] zugferdData;
|
||||||
private IExportableTransaction trans;
|
private IExportableTransaction trans;
|
||||||
private Profiles level;
|
|
||||||
private String paymentTermsDescription;
|
private String paymentTermsDescription;
|
||||||
|
protected Profile profile=Profiles.getByName("EN16931");
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setProfile(Profiles level) {
|
|
||||||
this.level = level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enables the flag to indicate a test invoice in the XML structure
|
* enables the flag to indicate a test invoice in the XML structure
|
||||||
@@ -155,9 +151,8 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getProfile() {
|
public Profile getProfile() {
|
||||||
// return "urn:cen.eu:en16931:2017#compliant#urn:xoev-de:kosit:standard:xrechnung_1.2";
|
return profile;
|
||||||
return "urn:cen.eu:en16931:2017";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getTradePartyAsXML(IZUGFeRDExportableTradeParty party) {
|
protected String getTradePartyAsXML(IZUGFeRDExportableTradeParty party) {
|
||||||
@@ -272,7 +267,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>\n"
|
// <ram:TestIndicator><udt:Indicator>"+testBooleanStr+"</udt:Indicator></ram:TestIndicator>\n"
|
||||||
//
|
//
|
||||||
+ " <ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
+ " <ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||||
+ " <ram:ID>" + getProfile() + "</ram:ID>\n"
|
+ " <ram:ID>" + getProfile().getID() + "</ram:ID>\n"
|
||||||
+ " </ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
+ " </ram:GuidelineSpecifiedDocumentContextParameter>\n"
|
||||||
+ " </rsm:ExchangedDocumentContext>\n"
|
+ " </rsm:ExchangedDocumentContext>\n"
|
||||||
+ " <rsm:ExchangedDocument>\n"
|
+ " <rsm:ExchangedDocument>\n"
|
||||||
@@ -539,6 +534,11 @@ public class ZUGFeRD2PullProvider implements IXMLProvider, IProfileProvider {
|
|||||||
} // $NON-NLS-1$
|
} // $NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setProfile(Profile p) {
|
||||||
|
profile=p;
|
||||||
|
}
|
||||||
|
|
||||||
private String buildPaymentTermsXml() {
|
private String buildPaymentTermsXml() {
|
||||||
String paymentTermsXml = "<ram:SpecifiedTradePaymentTerms>";
|
String paymentTermsXml = "<ram:SpecifiedTradePaymentTerms>";
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,14 @@ public class ZUGFeRDExporterFromA1 extends ZUGFeRDExporterFromA3 implements IZUG
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ZUGFeRDExporterFromA1 setProfile(Profile p) {
|
||||||
|
return (ZUGFeRDExporterFromA1)super.setProfile(p);
|
||||||
|
}
|
||||||
|
public ZUGFeRDExporterFromA1 setProfile(String profileName) {
|
||||||
|
return (ZUGFeRDExporterFromA1)super.setProfile(profileName);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean ensurePDFIsValid(final DataSource dataSource) throws IOException {
|
public boolean ensurePDFIsValid(final DataSource dataSource) throws IOException {
|
||||||
if (!ignorePDFAErrors && !isValidA1(dataSource)) {
|
if (!ignorePDFAErrors && !isValidA1(dataSource)) {
|
||||||
throw new IOException("File is not a valid PDF/A input file");
|
throw new IOException("File is not a valid PDF/A input file");
|
||||||
@@ -106,9 +114,6 @@ public class ZUGFeRDExporterFromA1 extends ZUGFeRDExporterFromA3 implements IZUG
|
|||||||
return (ZUGFeRDExporterFromA1) super.setXML(zugferdData);
|
return (ZUGFeRDExporterFromA1) super.setXML(zugferdData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ZUGFeRDExporterFromA1 setProfile(Profiles zugferdConformanceLevel){
|
|
||||||
return (ZUGFeRDExporterFromA1) super.setProfile(zugferdConformanceLevel);
|
|
||||||
}
|
|
||||||
public ZUGFeRDExporterFromA1 disableAutoClose(boolean disableAutoClose){
|
public ZUGFeRDExporterFromA1 disableAutoClose(boolean disableAutoClose){
|
||||||
return (ZUGFeRDExporterFromA1) super.disableAutoClose(disableAutoClose);
|
return (ZUGFeRDExporterFromA1) super.disableAutoClose(disableAutoClose);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
|
|
||||||
public static final int DefaultZUGFeRDVersion = 2;
|
public static final int DefaultZUGFeRDVersion = 2;
|
||||||
|
|
||||||
protected Profiles profile = Profiles.EXTENDED;
|
|
||||||
protected PDFAConformanceLevel conformanceLevel = PDFAConformanceLevel.UNICODE;
|
protected PDFAConformanceLevel conformanceLevel = PDFAConformanceLevel.UNICODE;
|
||||||
protected ArrayList<FileAttachment> fileAttachments = new ArrayList<FileAttachment>();
|
protected ArrayList<FileAttachment> fileAttachments = new ArrayList<FileAttachment>();
|
||||||
|
|
||||||
@@ -62,7 +61,7 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
|
|
||||||
private boolean disableAutoClose;
|
private boolean disableAutoClose;
|
||||||
private boolean fileAttached = false;
|
private boolean fileAttached = false;
|
||||||
|
private Profile profile = null;
|
||||||
private boolean documentPrepared = false;
|
private boolean documentPrepared = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -113,6 +112,23 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
return xmlProvider;
|
return xmlProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ZUGFeRDExporterFromA3 setProfile(Profile p) {
|
||||||
|
this.profile=p;
|
||||||
|
if (xmlProvider!=null) {
|
||||||
|
xmlProvider.setProfile(p);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ZUGFeRDExporterFromA3 setProfile(String profilename) {
|
||||||
|
this.profile=Profiles.getByName(profilename);
|
||||||
|
|
||||||
|
if (xmlProvider!=null) {
|
||||||
|
xmlProvider.setProfile(this.profile);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public ZUGFeRDExporterFromA3 addAdditionalFile(String name, byte[] content) {
|
public ZUGFeRDExporterFromA3 addAdditionalFile(String name, byte[] content) {
|
||||||
fileAttachments.add(new FileAttachment(name, "text/xml", "Supplement", content).setDescription("ZUGFeRD extension/additional data"));
|
fileAttachments.add(new FileAttachment(name, "text/xml", "Supplement", content).setDescription("ZUGFeRD extension/additional data"));
|
||||||
return this;
|
return this;
|
||||||
@@ -154,14 +170,14 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
* @param ver the zf/fx version
|
* @param ver the zf/fx version
|
||||||
* @return the filename of the file to be embedded
|
* @return the filename of the file to be embedded
|
||||||
*/
|
*/
|
||||||
public String getFilenameForVersion(int ver, Profiles profile) {
|
public String getFilenameForVersion(int ver, Profile profile) {
|
||||||
if (isFacturX) {
|
if (isFacturX) {
|
||||||
return "factur-x.xml";
|
return "factur-x.xml";
|
||||||
} else {
|
} else {
|
||||||
if (ver == 1) {
|
if (ver == 1) {
|
||||||
return "ZUGFeRD-invoice.xml";
|
return "ZUGFeRD-invoice.xml";
|
||||||
} else {
|
} else {
|
||||||
if (profile == Profiles.XRECHNUNG) {
|
if (profile.getName().equals("XRECHNUNG")) {
|
||||||
return "xrechnung.xml";
|
return "xrechnung.xml";
|
||||||
} else {
|
} else {
|
||||||
return "zugferd-invoice.xml";
|
return "zugferd-invoice.xml";
|
||||||
@@ -190,6 +206,7 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes A PDF/A3a-compliant document from a PDF-A1 compliant document (on the
|
* Makes A PDF/A3a-compliant document from a PDF-A1 compliant document (on the
|
||||||
* metadata level, this will not e.g. convert graphics to JPG-2000)
|
* metadata level, this will not e.g. convert graphics to JPG-2000)
|
||||||
@@ -207,6 +224,9 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
ensurePDFisUpgraded = false;
|
ensurePDFisUpgraded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void attachFile(FileAttachment file) {
|
||||||
|
fileAttachments.add(file);
|
||||||
|
}
|
||||||
public void attachFile(String filename, byte[] data, String mimetype, String relation) {
|
public void attachFile(String filename, byte[] data, String mimetype, String relation) {
|
||||||
FileAttachment fa=new FileAttachment(filename, mimetype, relation, data);
|
FileAttachment fa=new FileAttachment(filename, mimetype, relation, data);
|
||||||
fileAttachments.add(fa);
|
fileAttachments.add(fa);
|
||||||
@@ -349,8 +369,8 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
public ZUGFeRDExporterFromA3 setXML(byte[] zugferdData) throws IOException {
|
public ZUGFeRDExporterFromA3 setXML(byte[] zugferdData) throws IOException {
|
||||||
CustomXMLProvider cus = new CustomXMLProvider();
|
CustomXMLProvider cus = new CustomXMLProvider();
|
||||||
cus.setXML(zugferdData);
|
cus.setXML(zugferdData);
|
||||||
this.xmlProvider = cus;
|
this.setXMLProvider(cus);
|
||||||
setTransaction(null);
|
prepare();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -375,15 +395,6 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
return buffer.toByteArray();
|
return buffer.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the ZUGFeRD conformance level (override).
|
|
||||||
*
|
|
||||||
* @param zugferdConformanceLevel the new conformance level
|
|
||||||
*/
|
|
||||||
public ZUGFeRDExporterFromA3 setProfile(Profiles zugferdConformanceLevel) {
|
|
||||||
this.profile = zugferdConformanceLevel;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All files are PDF/A-3, setConformance refers to the level conformance.
|
* All files are PDF/A-3, setConformance refers to the level conformance.
|
||||||
@@ -434,9 +445,9 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
protected void addXMP(XMPMetadata metadata) {
|
protected void addXMP(XMPMetadata metadata) {
|
||||||
|
|
||||||
if (attachZUGFeRDHeaders) {
|
if (attachZUGFeRDHeaders) {
|
||||||
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, ZFVersion, isFacturX, profile,
|
XMPSchemaZugferd zf = new XMPSchemaZugferd(metadata, ZFVersion, isFacturX, xmlProvider.getProfile(),
|
||||||
getNamespaceForVersion(ZFVersion), getPrefixForVersion(ZFVersion),
|
getNamespaceForVersion(ZFVersion), getPrefixForVersion(ZFVersion),
|
||||||
getFilenameForVersion(ZFVersion, profile));
|
getFilenameForVersion(ZFVersion, xmlProvider.getProfile()));
|
||||||
|
|
||||||
metadata.addSchema(zf);
|
metadata.addSchema(zf);
|
||||||
}
|
}
|
||||||
@@ -513,10 +524,13 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
*/
|
*/
|
||||||
public IExporter setTransaction(IExportableTransaction trans) throws IOException {
|
public IExporter setTransaction(IExportableTransaction trans) throws IOException {
|
||||||
this.trans = trans;
|
this.trans = trans;
|
||||||
|
return prepare();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IExporter prepare() throws IOException{
|
||||||
prepareDocument();
|
prepareDocument();
|
||||||
((IProfileProvider) xmlProvider).setProfile(profile);
|
|
||||||
xmlProvider.generateXML(trans);
|
xmlProvider.generateXML(trans);
|
||||||
String filename = getFilenameForVersion(ZFVersion, profile);
|
String filename = getFilenameForVersion(ZFVersion, xmlProvider.getProfile());
|
||||||
PDFAttachGenericFile(doc, filename, "Alternative",
|
PDFAttachGenericFile(doc, filename, "Alternative",
|
||||||
"Invoice metadata conforming to ZUGFeRD standard (http://www.ferd-net.de/front_content.php?idcat=231&lang=4)",
|
"Invoice metadata conforming to ZUGFeRD standard (http://www.ferd-net.de/front_content.php?idcat=231&lang=4)",
|
||||||
"text/xml", xmlProvider.getXML());
|
"text/xml", xmlProvider.getXML());
|
||||||
@@ -563,16 +577,22 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void setXMLProvider(IXMLProvider p) {
|
||||||
|
this.xmlProvider = p;
|
||||||
|
if (profile!=null) {
|
||||||
|
xmlProvider.setProfile(profile);
|
||||||
|
}
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public ZUGFeRDExporterFromA3 setZUGFeRDVersion(int version) {
|
public ZUGFeRDExporterFromA3 setZUGFeRDVersion(int version) {
|
||||||
this.ZFVersion = version;
|
this.ZFVersion = version;
|
||||||
if (version == 1) {
|
if (version == 1) {
|
||||||
ZUGFeRD1PullProvider z1p = new ZUGFeRD1PullProvider();
|
ZUGFeRD1PullProvider z1p = new ZUGFeRD1PullProvider();
|
||||||
disableFacturX();
|
disableFacturX();
|
||||||
this.xmlProvider = z1p;
|
setXMLProvider(z1p);
|
||||||
} else if (version == 2) {
|
} else if (version == 2) {
|
||||||
ZUGFeRD2PullProvider z2p = new ZUGFeRD2PullProvider();
|
ZUGFeRD2PullProvider z2p = new ZUGFeRD2PullProvider();
|
||||||
this.xmlProvider = z2p;
|
setXMLProvider(z2p);
|
||||||
} else {
|
} else {
|
||||||
throw new IllegalArgumentException("Version not supported");
|
throw new IllegalArgumentException("Version not supported");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
|
|||||||
try (InputStream SOURCE_PDF = this.getClass()
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
|
||||||
|
|
||||||
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(1).setProfile(Profiles.EN16931).load(SOURCE_PDF)) {
|
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(1).setProfile("EN16931").load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(this);
|
ze.setTransaction(this);
|
||||||
ze.disableAutoClose(true);
|
ze.disableAutoClose(true);
|
||||||
@@ -96,7 +96,7 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
|
|||||||
try (InputStream SOURCE_PDF = this.getClass()
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
|
||||||
|
|
||||||
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.EN16931).load(SOURCE_PDF)) {
|
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile("EN16931").load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(this);
|
ze.setTransaction(this);
|
||||||
ze.disableAutoClose(true);
|
ze.disableAutoClose(true);
|
||||||
@@ -134,7 +134,7 @@ public class BackwardCompatibilityTest extends TestCase implements IExportableTr
|
|||||||
try (InputStream SOURCE_PDF = this.getClass()
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
|
||||||
|
|
||||||
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.EN16931).load(SOURCE_PDF)) {
|
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile("EN16931").load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(this);
|
ze.setTransaction(this);
|
||||||
ze.disableAutoClose(true);
|
ze.disableAutoClose(true);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ public class IExportableTransactionImpl implements IExportableTransaction {
|
|||||||
private String currency;
|
private String currency;
|
||||||
private String paymentTermDescription;
|
private String paymentTermDescription;
|
||||||
private String referenceNumber;
|
private String referenceNumber;
|
||||||
|
private Profile profile;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getNumber() {
|
public String getNumber() {
|
||||||
@@ -149,7 +150,6 @@ public class IExportableTransactionImpl implements IExportableTransaction {
|
|||||||
return referenceNumber;
|
return referenceNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IExportableTransactionImpl setNumber(String number) {
|
public IExportableTransactionImpl setNumber(String number) {
|
||||||
this.number = number;
|
this.number = number;
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -31,13 +31,13 @@ import java.nio.charset.StandardCharsets;
|
|||||||
|
|
||||||
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
|
||||||
public class MustangReaderWriterCustomXMLTest extends TestCase {
|
public class MustangReaderWriterCustomXMLTest extends TestCase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the test case
|
* Create the test case
|
||||||
*
|
*
|
||||||
* @param testName name of the test case
|
* @param testName name of the test case
|
||||||
*/
|
*/
|
||||||
public MustangReaderWriterCustomXMLTest(String testName) {
|
public MustangReaderWriterCustomXMLTest(String testName) {
|
||||||
|
|
||||||
super(testName);
|
super(testName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
|||||||
try {
|
try {
|
||||||
InputStream SOURCE_PDF = this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
InputStream SOURCE_PDF = this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
||||||
|
|
||||||
IZUGFeRDExporter zea1 = new ZUGFeRDExporterFromA1().setProducer("My Application").setCreator("Test").setProfile(Profiles.EN16931)
|
IZUGFeRDExporter zea1 = new ZUGFeRDExporterFromA1().setProducer("My Application").setCreator("Test").setProfile(Profiles.getByName("EN16931"))
|
||||||
.load(SOURCE_PDF);
|
.load(SOURCE_PDF);
|
||||||
|
|
||||||
final byte[] UTF8ByteOrderMark = new byte[]{(byte) 0xef, (byte) 0xbb, (byte) 0xbf};
|
final byte[] UTF8ByteOrderMark = new byte[]{(byte) 0xef, (byte) 0xbb, (byte) 0xbf};
|
||||||
@@ -301,7 +301,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
|
|||||||
.setProducer("My Application")
|
.setProducer("My Application")
|
||||||
.setCreator("Test")
|
.setCreator("Test")
|
||||||
.setZUGFeRDVersion(1)
|
.setZUGFeRDVersion(1)
|
||||||
.setProfile(Profiles.BASIC)
|
.setProfile(Profiles.getByName("BASIC",1))
|
||||||
.load(SOURCE_PDF);
|
.load(SOURCE_PDF);
|
||||||
/* we have much more information than just in the basic profile (comfort or extended) but it's perfectly valid to provide more information, just not less. */
|
/* we have much more information than just in the basic profile (comfort or extended) but it's perfectly valid to provide more information, just not less. */
|
||||||
String ownZUGFeRDXML = "<rsm:CrossIndustryDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15\" xmlns:rsm=\"urn:ferd:CrossIndustryDocument:invoice:1p0\">\n"
|
String ownZUGFeRDXML = "<rsm:CrossIndustryDocument xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ram=\"urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12\" xmlns:udt=\"urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15\" xmlns:rsm=\"urn:ferd:CrossIndustryDocument:invoice:1p0\">\n"
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ public class MustangReaderWriterEdgeTest extends MustangReaderTestCase {
|
|||||||
return "AB321";
|
return "AB321";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the test case
|
* Create the test case
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
|
|||||||
try (InputStream SOURCE_PDF = this.getClass()
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
|
||||||
|
|
||||||
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.EN16931).load(SOURCE_PDF)) {
|
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.getByName("EN16931")).load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(this);
|
ze.setTransaction(this);
|
||||||
ze.disableAutoClose(true);
|
ze.disableAutoClose(true);
|
||||||
@@ -402,7 +402,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
|
|||||||
try (InputStream SOURCE_PDF = this.getClass()
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20190610_507blanko.pdf");
|
||||||
|
|
||||||
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(1).setProfile(Profiles.COMFORT).load(SOURCE_PDF)) {
|
IZUGFeRDExporter ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(1).setProfile(Profiles.getByName("COMFORT",1)).load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(this);
|
ze.setTransaction(this);
|
||||||
ze.disableAutoClose(true);
|
ze.disableAutoClose(true);
|
||||||
@@ -430,7 +430,7 @@ public class MustangReaderWriterTest extends MustangReaderTestCase {
|
|||||||
try (InputStream SOURCE_PDF = this.getClass()
|
try (InputStream SOURCE_PDF = this.getClass()
|
||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20171118_506blanko.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20171118_506blanko.pdf");
|
||||||
|
|
||||||
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.EN16931).load(SOURCE_PDF)) {
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setZUGFeRDVersion(2).setProfile(Profiles.getByName("EN16931")).load(SOURCE_PDF)) {
|
||||||
ByteArrayOutputStream result = new ByteArrayOutputStream();
|
ByteArrayOutputStream result = new ByteArrayOutputStream();
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int length;
|
int length;
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ public class ZF2PushTest extends TestCase {
|
|||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505blanko.pdf");
|
||||||
|
|
||||||
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
ZUGFeRDExporterFromA1 ze = new ZUGFeRDExporterFromA1().setProducer("My Application")
|
||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).ignorePDFAErrors()
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile("EXTENDED").ignorePDFAErrors()
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
// ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
// ze.setTransaction(new Invoice().setDueDate(new Date()).setIssueDate(new Date()).setDeliveryDate(new Date()).setSender(new TradeParty(orgname,"teststr", "55232","teststadt","DE")).setOwnTaxID("4711").setOwnVATID("DE0815").setRecipient(new TradeParty("Franz Müller", "teststr.12", "55232", "Entenhausen", "DE")).setNumber(number)
|
||||||
// .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50)))));
|
// .addItem(new Item(new Product("Testprodukt", "", "C62", new BigDecimal(19)), amount, new BigDecimal(1.0)).addAllowance(new Allowance().setPercent(new BigDecimal(50)))));
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ public class ZF2Test extends MustangReaderTestCase {
|
|||||||
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505PDFA3.pdf");
|
.getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505PDFA3.pdf");
|
||||||
|
|
||||||
ZUGFeRDExporterFromA3 ze = new ZUGFeRDExporterFromA3().setProducer("My Application")
|
ZUGFeRDExporterFromA3 ze = new ZUGFeRDExporterFromA3().setProducer("My Application")
|
||||||
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile(Profiles.EN16931)
|
.setCreator(System.getProperty("user.name")).setZUGFeRDVersion(2).setProfile("EN16931")
|
||||||
.load(SOURCE_PDF)) {
|
.load(SOURCE_PDF)) {
|
||||||
|
|
||||||
ze.setTransaction(this);
|
ze.setTransaction(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user