Merge pull request #79 from HardyLoppmann/master

Syntax sugar, simplify test and use editorconfig
This commit is contained in:
Jochen Staerk
2019-04-08 06:54:53 +02:00
committed by GitHub
60 changed files with 4951 additions and 5012 deletions

19
.editorconfig Normal file
View File

@@ -0,0 +1,19 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# Tab indentation (no size specified)
[*.java]
indent_style = tab
# 2 all x** Files
[*.xsd,*.xsl,*.xml]
indent_style = space
indent_size = 2

View File

@@ -4,7 +4,8 @@
xmlns:qdt="urn:un:unece:uncefact:data:Standard:QualifiedDataType:100" xmlns:qdt="urn:un:unece:uncefact:data:Standard:QualifiedDataType:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"><!-- xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"><!--
Migrated by Mustangproject XSLT Migrated by Mustangproject XSLT
--><rsm:ExchangedDocumentContext> -->
<rsm:ExchangedDocumentContext>
<ram:TestIndicator> <ram:TestIndicator>
<udt:Indicator>false</udt:Indicator> <udt:Indicator>false</udt:Indicator>
</ram:TestIndicator> </ram:TestIndicator>

View File

@@ -36,6 +36,7 @@ public class MustangWriter implements IZUGFeRDExportableTransaction {
e.printStackTrace(); e.printStackTrace();
} }
} }
@Override @Override
public String getCurrency() { public String getCurrency() {
// TODO Auto-generated method stub // TODO Auto-generated method stub

18
pom.xml
View File

@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.mustangproject.ZUGFeRD</groupId> <groupId>org.mustangproject.ZUGFeRD</groupId>
<artifactId>mustang</artifactId> <artifactId>mustang</artifactId>
<version>1.6.1-SNAPSHOT</version> <version>1.6.1-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Mustang</name> <name>Mustang</name>
<description>The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs</description> <description>The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs
</description>
<url>http://www.mustangproject.org/</url> <url>http://www.mustangproject.org/</url>
<scm> <scm>
<connection>scm:git:https://github.com/ZUGFeRD/mustangproject.git</connection> <connection>scm:git:https://github.com/ZUGFeRD/mustangproject.git</connection>
@@ -86,6 +88,12 @@
<version>5.0.4</version> <version>5.0.4</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>2.6.2</version>
<scope>test</scope>
</dependency>
<!-- For Toecount --> <!-- For Toecount -->
<dependency> <dependency>
<groupId>com.sanityinc</groupId> <groupId>com.sanityinc</groupId>
@@ -147,7 +155,8 @@
<artifactId>maven-deploy-plugin</artifactId> <artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version> <version>2.8.2</version>
<configuration> <configuration>
<altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo</altDeploymentRepository> <altDeploymentRepository>internal.repo::default::file://${project.build.directory}/mvn-repo
</altDeploymentRepository>
</configuration> </configuration>
</plugin> </plugin>
<plugin> <plugin>
@@ -189,7 +198,8 @@
<version>2.4.3</version> <version>2.4.3</version>
<configuration> <configuration>
<transformers> <transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.mustangproject.toecount.Toecount</mainClass> <mainClass>org.mustangproject.toecount.Toecount</mainClass>
</transformer> </transformer>
</transformers> </transformers>

View File

@@ -23,29 +23,34 @@ import java.io.InputStream;
public interface IExporterFactory { public interface IExporterFactory {
public ZUGFeRDExporter load(String pdfFilename) throws IOException; public ZUGFeRDExporter load(String pdfFilename) throws IOException;
/** /**
* 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)
* *
* @param pdfBinary * @param pdfBinary binary of a PDF/A1 compliant document
* binary of a PDF/A1 compliant document
*/ */
public ZUGFeRDExporter load(byte[] pdfBinary) throws IOException; public ZUGFeRDExporter load(byte[] pdfBinary) throws IOException;
/** /**
* 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)
* *
* @param pdfSource * @param pdfSource source to read a PDF/A1 compliant document from
* source to read a PDF/A1 compliant document from
* @throws IOException * @throws IOException
*/ */
public ZUGFeRDExporter load(InputStream pdfSource) throws IOException; public ZUGFeRDExporter load(InputStream pdfSource) throws IOException;
public IExporterFactory setCreator(String creator); public IExporterFactory setCreator(String creator);
public IExporterFactory setConformanceLevel(PDFAConformanceLevel newLevel); public IExporterFactory setConformanceLevel(PDFAConformanceLevel newLevel);
public IExporterFactory setProducer(String producer); public IExporterFactory setProducer(String producer);
public IExporterFactory setZUGFeRDVersion(int version); public IExporterFactory setZUGFeRDVersion(int version);
public IExporterFactory ignorePDFAErrors(); public IExporterFactory ignorePDFAErrors();
public IExporterFactory setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel zugferdConformanceLevel); public IExporterFactory setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel zugferdConformanceLevel);
} }

View File

@@ -21,6 +21,7 @@ package org.mustangproject.ZUGFeRD;
public interface IXMLProvider { public interface IXMLProvider {
public byte[] getXML(); public byte[] getXML();
public void setTest(); public void setTest();
public void generateXML(IZUGFeRDExportableTransaction trans); public void generateXML(IZUGFeRDExportableTransaction trans);

View File

@@ -18,7 +18,6 @@ package org.mustangproject.ZUGFeRD;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
*
* @author AlexanderSchmidt * @author AlexanderSchmidt
*/ */
public interface IZUGFeRDAllowanceCharge { public interface IZUGFeRDAllowanceCharge {

View File

@@ -17,50 +17,58 @@
* *
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
/** /**
* Mustangproject's ZUGFeRD implementation * Mustangproject's ZUGFeRD implementation
* Neccessary interface for ZUGFeRD exporter * Neccessary interface for ZUGFeRD exporter
* Licensed under the APLv2 * Licensed under the APLv2
* @date 2014-05-10 *
* @version 1.2.0
* @author jstaerk * @author jstaerk
* */ * @version 1.2.0
* @date 2014-05-10
*/
public interface IZUGFeRDExportableContact { public interface IZUGFeRDExportableContact {
/** /**
* First and last name of the recipient * First and last name of the recipient
*
* @return First and last name of the recipient * @return First and last name of the recipient
*/ */
String getName(); String getName();
/** /**
* Postal code of the recipient * Postal code of the recipient
*
* @return Postal code of the recipient * @return Postal code of the recipient
*/ */
String getZIP(); String getZIP();
/** /**
* VAT ID (Umsatzsteueridentifikationsnummer) of the contact * VAT ID (Umsatzsteueridentifikationsnummer) of the contact
*
* @return VAT ID (Umsatzsteueridentifikationsnummer) of the contact * @return VAT ID (Umsatzsteueridentifikationsnummer) of the contact
*/ */
String getVATID(); String getVATID();
/** /**
* two-letter country code of the contact * two-letter country code of the contact
*
* @return two-letter iso country code of the contact * @return two-letter iso country code of the contact
*/ */
String getCountry(); String getCountry();
/*** /**
* Returns the city of the contact * Returns the city of the contact
*
* @return Returns the city of the recipient * @return Returns the city of the recipient
*/ */
String getLocation(); String getLocation();
/*** /**
* Returns the street address (street+number) of the contact * Returns the street address (street+number) of the contact
*
* @return street address (street+number) of the contact * @return street address (street+number) of the contact
*/ */
String getStreet(); String getStreet();

View File

@@ -31,22 +31,25 @@ import java.math.BigDecimal;
public interface IZUGFeRDExportableItem { public interface IZUGFeRDExportableItem {
IZUGFeRDExportableProduct getProduct(); IZUGFeRDExportableProduct getProduct();
IZUGFeRDAllowanceCharge[] getItemAllowances(); IZUGFeRDAllowanceCharge[] getItemAllowances();
IZUGFeRDAllowanceCharge[] getItemCharges(); IZUGFeRDAllowanceCharge[] getItemCharges();
/** /**
* The price of one item excl. taxes * The price of one item excl. taxes
*
* @return The price of one item excl. taxes * @return The price of one item excl. taxes
*/ */
BigDecimal getPrice(); BigDecimal getPrice();
/*** /**
* how many * how many
*
* @return the quantity of the item * @return the quantity of the item
*/ */
BigDecimal getQuantity(); BigDecimal getQuantity();
} }

View File

@@ -17,61 +17,67 @@
* *
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* Mustangproject's ZUGFeRD implementation * Mustangproject's ZUGFeRD implementation
* Necessary interface for ZUGFeRD exporter * Necessary interface for ZUGFeRD exporter
* Licensed under the APLv2 * Licensed under the APLv2
* @date 2014-05-10 *
* @version 1.2.0
* @author jstaerk * @author jstaerk
* */ * @version 1.2.0
* @date 2014-05-10
*/
public interface IZUGFeRDExportableProduct { public interface IZUGFeRDExportableProduct {
/** /**
* Unit code of the product * Unit code of the product
* Most common ones are * Most common ones are
C62 one (piece) * C62 one (piece)
DAY day * DAY day
HAR hectare * HAR hectare
HUR hour * HUR hour
KGM kilogram * KGM kilogram
KTM kilometre * KTM kilometre
KWH kilowatt hour * KWH kilowatt hour
LS lump sum * LS lump sum
LTR litre * LTR litre
MIN minute * MIN minute
MMK square millimetre * MMK square millimetre
MMT millimetre * MMT millimetre
MTK square metre * MTK square metre
MTQ cubic metre * MTQ cubic metre
MTR metre * MTR metre
NAR number of articles * NAR number of articles
NPR number of pairs * NPR number of pairs
P1 percent * P1 percent
SET set * SET set
TNE tonne (metric ton) * TNE tonne (metric ton)
WEE week * WEE week
*
* @return a UN/ECE rec 20 unit code see https://www.unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex2e.pdf * @return a UN/ECE rec 20 unit code see https://www.unece.org/fileadmin/DAM/cefact/recommendations/rec20/rec20_rev3_Annex2e.pdf
*/ */
String getUnit(); String getUnit();
/** /**
* Short name of the product * Short name of the product
*
* @return Short name of the product * @return Short name of the product
*/ */
String getName(); String getName();
/** /**
* long description of the product * long description of the product
*
* @return long description of the product * @return long description of the product
*/ */
String getDescription(); String getDescription();
/** /**
* VAT percent of the product (e.g. 19, or 5.1 if you like) * VAT percent of the product (e.g. 19, or 5.1 if you like)
*
* @return VAT percent of the product * @return VAT percent of the product
*/ */
BigDecimal getVATPercent(); BigDecimal getVATPercent();

View File

@@ -27,19 +27,20 @@ package org.mustangproject.ZUGFeRD;
* */ * */
import java.util.Date; import java.util.Date;
public interface IZUGFeRDExportableTransaction { public interface IZUGFeRDExportableTransaction {
/** /**
* Number, typically invoice number of the invoice * Number, typically invoice number of the invoice
*
* @return invoice number * @return invoice number
*/ */
String getNumber(); String getNumber();
/** /**
* the date when the invoice was created * the date when the invoice was created
*
* @return when the invoice was created * @return when the invoice was created
*/ */
Date getIssueDate(); Date getIssueDate();
@@ -48,121 +49,141 @@ public interface IZUGFeRDExportableTransaction {
* this should be the full sender institution name, details, manager and tax registration. * this should be the full sender institution name, details, manager and tax registration.
* It is one of the few functions which may return null. * It is one of the few functions which may return null.
* e.g. * e.g.
* <p/>
* Lieferant GmbH
* Lieferantenstraße 20
* 80333 München
* Deutschland
* Geschäftsführer: Hans Muster
* Handelsregisternummer: H A 123
* *
Lieferant GmbH
Lieferantenstraße 20
80333 München
Deutschland
Geschäftsführer: Hans Muster
Handelsregisternummer: H A 123
* @return null or full sender institution name, details, manager and tax registration * @return null or full sender institution name, details, manager and tax registration
*/ */
String getOwnOrganisationFullPlaintextInfo(); String getOwnOrganisationFullPlaintextInfo();
/** /**
* when the invoice is to be paid * when the invoice is to be paid
*
* @return when the invoice is to be paid * @return when the invoice is to be paid
*/ */
Date getDueDate(); Date getDueDate();
IZUGFeRDAllowanceCharge[] getZFAllowances(); IZUGFeRDAllowanceCharge[] getZFAllowances();
IZUGFeRDAllowanceCharge[] getZFCharges(); IZUGFeRDAllowanceCharge[] getZFCharges();
IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges(); IZUGFeRDAllowanceCharge[] getZFLogisticsServiceCharges();
IZUGFeRDExportableItem[] getZFItems(); IZUGFeRDExportableItem[] getZFItems();
/*** /**
* the recipient * the recipient
*
* @return the recipient of the invoice * @return the recipient of the invoice
*/ */
IZUGFeRDExportableContact getRecipient(); IZUGFeRDExportableContact getRecipient();
/*** /**
* BIC of the sender * BIC of the sender
*
* @return the BIC code of the recipient sender's bank * @return the BIC code of the recipient sender's bank
*/ */
String getOwnBIC(); String getOwnBIC();
/*** /**
* BLZ of the sender * BLZ of the sender
*
* @return the BLZ code of the recipient sender's bank * @return the BLZ code of the recipient sender's bank
*/ */
String getOwnBLZ(); String getOwnBLZ();
/*** /**
* Bank name of the sender * Bank name of the sender
*
* @return the name of the sender's bank * @return the name of the sender's bank
*/ */
String getOwnBankName(); String getOwnBankName();
/** /**
* IBAN of the sender * IBAN of the sender
*
* @return the IBAN of the invoice sender's bank account * @return the IBAN of the invoice sender's bank account
*/ */
String getOwnIBAN(); String getOwnIBAN();
/** /**
* IBAN of the sender * IBAN of the sender
*
* @return the Account Number of the invoice sender's bank account * @return the Account Number of the invoice sender's bank account
*/ */
String getOwnKto(); String getOwnKto();
/** /**
* Tax ID (not VAT ID) of the sender * Tax ID (not VAT ID) of the sender
*
* @return Tax ID (not VAT ID) of the sender * @return Tax ID (not VAT ID) of the sender
*/ */
String getOwnTaxID(); String getOwnTaxID();
/** /**
* VAT ID (Umsatzsteueridentifikationsnummer) of the sender * VAT ID (Umsatzsteueridentifikationsnummer) of the sender
*
* @return VAT ID (Umsatzsteueridentifikationsnummer) of the sender * @return VAT ID (Umsatzsteueridentifikationsnummer) of the sender
*/ */
String getOwnVATID(); String getOwnVATID();
/** /**
* own name * own name
*
* @return the sender's organisation name * @return the sender's organisation name
*/ */
String getOwnOrganisationName(); String getOwnOrganisationName();
/** /**
* own street address * own street address
*
* @return sender street address * @return sender street address
*/ */
String getOwnStreet(); String getOwnStreet();
/** /**
* own street postal code * own street postal code
*
* @return sender postal code * @return sender postal code
*/ */
String getOwnZIP(); String getOwnZIP();
/** /**
* own city * own city
*
* @return the invoice sender's city * @return the invoice sender's city
*/ */
String getOwnLocation(); String getOwnLocation();
/** /**
* own two digit country code * own two digit country code
*
* @return the invoice senders two character country iso code * @return the invoice senders two character country iso code
*/ */
String getOwnCountry(); String getOwnCountry();
/** /**
* get delivery date * get delivery date
*
* @return the day the goods have been delivered * @return the day the goods have been delivered
*/ */
Date getDeliveryDate(); Date getDeliveryDate();
/** /**
* get main invoice currency used on the invoice * get main invoice currency used on the invoice
*
* @return three character currency of this invoice * @return three character currency of this invoice
*/ */
String getCurrency(); String getCurrency();
/** /**
* get payment information text. e.g. Bank transfer * get payment information text. e.g. Bank transfer
*
* @return payment information text * @return payment information text
*/ */
String getOwnPaymentInfoText(); String getOwnPaymentInfoText();
@@ -170,6 +191,7 @@ public interface IZUGFeRDExportableTransaction {
/** /**
* get payment term descriptional text * get payment term descriptional text
* e.g. Bis zum 22.10.2015 ohne Abzug * e.g. Bis zum 22.10.2015 ohne Abzug
*
* @return get payment terms * @return get payment terms
*/ */
String getPaymentTermDescription(); String getPaymentTermDescription();
@@ -178,6 +200,7 @@ public interface IZUGFeRDExportableTransaction {
* get reference document number * get reference document number
* typically used for Invoice Corrections * typically used for Invoice Corrections
* Will be added as IncludedNote in comfort profile * Will be added as IncludedNote in comfort profile
*
* @return the ID of the document this document refers to * @return the ID of the document this document refers to
*/ */
String getReferenceNumber(); String getReferenceNumber();

View File

@@ -19,14 +19,16 @@
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import java.math.BigDecimal; import java.math.BigDecimal;
/** /**
* Mustangproject's ZUGFeRD implementation * Mustangproject's ZUGFeRD implementation
* ZUGFeRD exporter helper class * ZUGFeRD exporter helper class
* Licensed under the APLv2 * Licensed under the APLv2
* @date 2015-10-29 *
* @version 1.2.0
* @author jstaerk * @author jstaerk
* */ * @version 1.2.0
* @date 2015-10-29
*/
public class VATAmount { public class VATAmount {
public VATAmount(BigDecimal basis, BigDecimal calculated) { public VATAmount(BigDecimal basis, BigDecimal calculated) {

View File

@@ -26,18 +26,11 @@ package org.mustangproject.ZUGFeRD;
* @version 1.2.0 * @version 1.2.0
* @author jstaerk * @author jstaerk
* */ * */
import org.apache.xmpbox.XMPMetadata; import org.apache.xmpbox.XMPMetadata;
import org.apache.xmpbox.XmpConstants; import org.apache.xmpbox.XmpConstants;
import org.apache.xmpbox.schema.PDFAExtensionSchema; import org.apache.xmpbox.schema.PDFAExtensionSchema;
import org.apache.xmpbox.type.ArrayProperty; import org.apache.xmpbox.type.*;
import org.apache.xmpbox.type.Attribute;
import org.apache.xmpbox.type.Cardinality;
import org.apache.xmpbox.type.ChoiceType;
import org.apache.xmpbox.type.DefinedStructuredType;
import org.apache.xmpbox.type.PDFAPropertyType;
import org.apache.xmpbox.type.PDFASchemaType;
import org.apache.xmpbox.type.StructuredType;
import org.apache.xmpbox.type.TextType;
/** /**
* Additionally to adding a RDF namespace with a indication which file * Additionally to adding a RDF namespace with a indication which file

View File

@@ -25,6 +25,7 @@ package org.mustangproject.ZUGFeRD;
* @version 1.2.0s * @version 1.2.0s
* @author jstaerk * @author jstaerk
* */ * */
import org.apache.xmpbox.XMPMetadata; import org.apache.xmpbox.XMPMetadata;
import org.apache.xmpbox.schema.XMPSchema; import org.apache.xmpbox.schema.XMPSchema;

View File

@@ -18,13 +18,14 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import java.io.ByteArrayOutputStream; import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType;
import org.mustangproject.ZUGFeRD.model.ZFNamespacePrefixMapper;
import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBElement;
import javax.xml.bind.JAXBException; import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller; import javax.xml.bind.Marshaller;
import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType; import java.io.ByteArrayOutputStream;
import org.mustangproject.ZUGFeRD.model.ZFNamespacePrefixMapper;
public class ZUGFeRD1PullProvider implements IXMLProvider { public class ZUGFeRD1PullProvider implements IXMLProvider {
@@ -35,14 +36,13 @@ public class ZUGFeRD1PullProvider implements IXMLProvider {
private boolean isTest; private boolean isTest;
/** /**
* enables the flag to indicate a test invoice in the XML structure * enables the flag to indicate a test invoice in the XML structure
*
*/ */
public void setTest() { public void setTest() {
isTest = true; isTest = true;
} }
public ZUGFeRD1PullProvider() { public ZUGFeRD1PullProvider() {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
try { try {
@@ -101,5 +101,4 @@ public class ZUGFeRD1PullProvider implements IXMLProvider {
} }
} }

View File

@@ -54,7 +54,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
} }
//// MAIN CLASS //// MAIN CLASS
protected byte[] zugferdData; protected byte[] zugferdData;
@@ -63,7 +62,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
/** /**
* enables the flag to indicate a test invoice in the XML structure * enables the flag to indicate a test invoice in the XML structure
*
*/ */
public void setTest() { public void setTest() {
isTest = true; isTest = true;
@@ -118,6 +116,7 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
private String priceFormat(BigDecimal value) { private String priceFormat(BigDecimal value) {
return nDigitFormat(value, 4); return nDigitFormat(value, 4);
} }
private String quantityFormat(BigDecimal value) { private String quantityFormat(BigDecimal value) {
return nDigitFormat(value, 4); return nDigitFormat(value, 4);
} }
@@ -154,8 +153,8 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
* empty for no taxes, or e.g. 19=>190 and 7=>14 if 1000 Eur were applicable * empty for no taxes, or e.g. 19=>190 and 7=>14 if 1000 Eur were applicable
* to 19% VAT (=>190 EUR VAT) and 200 EUR were applicable to 7% (=>14 EUR VAT) * to 19% VAT (=>190 EUR VAT) and 200 EUR were applicable to 7% (=>14 EUR VAT)
* 190 Eur * 190 Eur
* @return which taxes have been used with which amounts in this invoice
* *
* @return which taxes have been used with which amounts in this invoice
*/ */
private HashMap<BigDecimal, VATAmount> getVATPercentAmountMap() { private HashMap<BigDecimal, VATAmount> getVATPercentAmountMap() {
HashMap<BigDecimal, VATAmount> hm = new HashMap<BigDecimal, VATAmount>(); HashMap<BigDecimal, VATAmount> hm = new HashMap<BigDecimal, VATAmount>();
@@ -201,7 +200,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
} }
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" //$NON-NLS-1$ String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" //$NON-NLS-1$
+ "<rsm:CrossIndustryInvoice xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\"" + "<rsm:CrossIndustryInvoice xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:rsm=\"urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100\""
@@ -283,7 +281,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ " </ram:IncludedSupplyChainTradeLineItem>\n"; //$NON-NLS-1$ + " </ram:IncludedSupplyChainTradeLineItem>\n"; //$NON-NLS-1$
} }
xml = xml + " <ram:ApplicableHeaderTradeAgreement>\n" //$NON-NLS-1$ xml = xml + " <ram:ApplicableHeaderTradeAgreement>\n" //$NON-NLS-1$
@@ -354,7 +351,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ " </ram:SpecifiedTradeSettlementPaymentMeans>\n"; //$NON-NLS-1$ + " </ram:SpecifiedTradeSettlementPaymentMeans>\n"; //$NON-NLS-1$
HashMap<BigDecimal, VATAmount> VATPercentAmountMap = getVATPercentAmountMap(); HashMap<BigDecimal, VATAmount> VATPercentAmountMap = getVATPercentAmountMap();
for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) { for (BigDecimal currentTaxPercent : VATPercentAmountMap.keySet()) {
VATAmount amount = VATPercentAmountMap.get(currentTaxPercent); VATAmount amount = VATPercentAmountMap.get(currentTaxPercent);
@@ -368,7 +364,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
+ " </ram:ApplicableTradeTax>\n"; //$NON-NLS-1$ + " </ram:ApplicableTradeTax>\n"; //$NON-NLS-1$
} }
} }
/* xml+= " /* xml+= "
@@ -430,8 +425,6 @@ public class ZUGFeRD2PullProvider implements IXMLProvider {
// + " </IncludedSupplyChainTradeLineItem>\n"; // + " </IncludedSupplyChainTradeLineItem>\n";
xml = xml + " </rsm:SupplyChainTradeTransaction>\n" //$NON-NLS-1$ xml = xml + " </rsm:SupplyChainTradeTransaction>\n" //$NON-NLS-1$
+ "</rsm:CrossIndustryInvoice>"; //$NON-NLS-1$ + "</rsm:CrossIndustryInvoice>"; //$NON-NLS-1$

View File

@@ -20,5 +20,4 @@ package org.mustangproject.ZUGFeRD;
public enum ZUGFeRDConformanceLevel { public enum ZUGFeRDConformanceLevel {
BASIC, COMFORT, EXTENDED, EN16931/*=Comfort*/, MINIMUM, BASICWL /*basic without lines, less than basic*/, CIUS BASIC, COMFORT, EXTENDED, EN16931/*=Comfort*/, MINIMUM, BASICWL /*basic without lines, less than basic*/, CIUS
;
} }

View File

@@ -29,27 +29,11 @@ package org.mustangproject.ZUGFeRD;
* *
*/ */
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.Closeable;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
import javax.xml.transform.TransformerException;
import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSArray;
import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSBase;
import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSDictionary;
import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.*;
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import org.apache.pdfbox.pdmodel.PDDocumentInformation;
import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary;
import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode;
import org.apache.pdfbox.pdmodel.common.PDMetadata; import org.apache.pdfbox.pdmodel.common.PDMetadata;
import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification; import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification;
import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile; import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile;
@@ -61,6 +45,12 @@ import org.apache.xmpbox.schema.XMPBasicSchema;
import org.apache.xmpbox.type.BadFieldValueException; import org.apache.xmpbox.type.BadFieldValueException;
import org.apache.xmpbox.xml.XmpSerializer; import org.apache.xmpbox.xml.XmpSerializer;
import javax.xml.transform.TransformerException;
import java.io.*;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
public class ZUGFeRDExporter implements Closeable { public class ZUGFeRDExporter implements Closeable {
public static final int DefaultZUGFeRDVersion = 1; public static final int DefaultZUGFeRDVersion = 1;
@@ -75,14 +65,13 @@ public class ZUGFeRDExporter implements Closeable {
* ze.PDFmakeA3compliant(doc, "Your application name", * ze.PDFmakeA3compliant(doc, "Your application name",
* System.getProperty("user.name"), true); ze.PDFattachZugferdFile(doc, * System.getProperty("user.name"), true); ze.PDFattachZugferdFile(doc,
* yourTransaction); * yourTransaction);
* * <p/>
* doc.save(PDFfilename); * doc.save(PDFfilename);
* *
* @author jstaerk * @author jstaerk
* @deprecated Use the factory methods {@link #createFromPDFA3(String)}, * @deprecated Use the factory methods {@link #createFromPDFA3(String)},
* {@link #createFromPDFA3(InputStream)} or the * {@link #createFromPDFA3(InputStream)} or the
* {@link ZUGFeRDExporterFromA1Factory} instead * {@link ZUGFeRDExporterFromA1Factory} instead
*
*/ */
// // MAIN CLASS // // MAIN CLASS
@Deprecated @Deprecated
@@ -102,11 +91,17 @@ public class ZUGFeRDExporter implements Closeable {
protected PDMetadata metadata = null; protected PDMetadata metadata = null;
protected PDFAIdentificationSchema pdfaid = null; protected PDFAIdentificationSchema pdfaid = null;
protected XMPMetadata xmp = null; protected XMPMetadata xmp = null;
/** Producer attribute for PDF */ /**
* Producer attribute for PDF
*/
protected String producer = "mustangproject"; protected String producer = "mustangproject";
/** Author/Creator attribute for PDF for PDF */ /**
* Author/Creator attribute for PDF for PDF
*/
protected String creator = "mustangproject"; protected String creator = "mustangproject";
/** CreatorTool */ /**
* CreatorTool
*/
protected String creatorTool = "mustangproject"; protected String creatorTool = "mustangproject";
@Deprecated @Deprecated
@@ -197,14 +192,14 @@ public class ZUGFeRDExporter implements Closeable {
/** /**
* All files are PDF/A-3, setConformance refers to the level conformance. * All files are PDF/A-3, setConformance refers to the level conformance.
* * <p/>
* PDF/A-3 has three conformance levels, called "A", "U" and "B". * PDF/A-3 has three conformance levels, called "A", "U" and "B".
* * <p/>
* PDF/A-3-B where B means only visually preservable, U -standard for Mustang- * PDF/A-3-B where B means only visually preservable, U -standard for Mustang-
* means visually and unicode preservable and A means full compliance, i.e. * means visually and unicode preservable and A means full compliance, i.e.
* visually, unicode and structurally preservable and tagged PDF, i.e. useful * visually, unicode and structurally preservable and tagged PDF, i.e. useful
* metainformation for blind people. * metainformation for blind people.
* * <p/>
* Feel free to pass "A" as new level if you know what you are doing :-) * Feel free to pass "A" as new level if you know what you are doing :-)
* *
* @deprecated Use {@link ZUGFeRDExporterFromA1Factory} instead * @deprecated Use {@link ZUGFeRDExporterFromA1Factory} instead
@@ -219,14 +214,14 @@ public class ZUGFeRDExporter implements Closeable {
/** /**
* All files are PDF/A-3, setConformance refers to the level conformance. * All files are PDF/A-3, setConformance refers to the level conformance.
* * <p/>
* PDF/A-3 has three conformance levels, called "A", "U" and "B". * PDF/A-3 has three conformance levels, called "A", "U" and "B".
* * <p/>
* PDF/A-3-B where B means only visually preservable, U -standard for Mustang- * PDF/A-3-B where B means only visually preservable, U -standard for Mustang-
* means visually and unicode preservable and A means full compliance, i.e. * means visually and unicode preservable and A means full compliance, i.e.
* visually, unicode and structurally preservable and tagged PDF, i.e. useful * visually, unicode and structurally preservable and tagged PDF, i.e. useful
* metainformation for blind people. * metainformation for blind people.
* * <p/>
* Feel free to pass "A" as new level if you know what you are doing :-) * Feel free to pass "A" as new level if you know what you are doing :-)
* *
* @deprecated Use * @deprecated Use
@@ -240,7 +235,6 @@ public class ZUGFeRDExporter implements Closeable {
/** /**
* enables the flag to indicate a test invoice in the XML structure * enables the flag to indicate a test invoice in the XML structure
*
*/ */
public void setTest() { public void setTest() {
xmlProvider.setTest(); xmlProvider.setTest();
@@ -284,7 +278,6 @@ public class ZUGFeRDExporter implements Closeable {
* metadata level, this will not e.g. convert graphics to JPG-2000) * metadata level, this will not e.g. convert graphics to JPG-2000)
* *
* @deprecated use the {@link ZUGFeRDExporterFromA1Factory} instead * @deprecated use the {@link ZUGFeRDExporterFromA1Factory} instead
*
*/ */
@Deprecated @Deprecated
public PDDocumentCatalog PDFmakeA3compliant(String filename, String producer, String creator, public PDDocumentCatalog PDFmakeA3compliant(String filename, String producer, String creator,
@@ -325,8 +318,7 @@ public class ZUGFeRDExporter implements Closeable {
/** /**
* Embeds the Zugferd XML structure in a file named ZUGFeRD-invoice.xml. * Embeds the Zugferd XML structure in a file named ZUGFeRD-invoice.xml.
* *
* @param trans * @param trans a IZUGFeRDExportableTransaction that provides the data-model to
* a IZUGFeRDExportableTransaction that provides the data-model to
* populate the XML. This parameter may be null, if so the XML data * populate the XML. This parameter may be null, if so the XML data
* should hav ebeen set via * should hav ebeen set via
* <code>setZUGFeRDXMLData(byte[] zugferdData)</code> * <code>setZUGFeRDXMLData(byte[] zugferdData)</code>
@@ -372,18 +364,12 @@ public class ZUGFeRDExporter implements Closeable {
/** /**
* Embeds an external file (generic - any type allowed) in the PDF. * Embeds an external file (generic - any type allowed) in the PDF.
* *
* @param doc * @param doc PDDocument to attach the file to.
* PDDocument to attach the file to. * @param filename name of the file that will become attachment name in the PDF
* @param filename * @param relationship how the file relates to the content, e.g. "Alternative"
* name of the file that will become attachment name in the PDF * @param description Human-readable description of the file content
* @param relationship * @param subType type of the data e.g. could be "text/xml" - mime like
* how the file relates to the content, e.g. "Alternative" * @param data the binary data of the file/attachment
* @param description
* Human-readable description of the file content
* @param subType
* type of the data e.g. could be "text/xml" - mime like
* @param data
* the binary data of the file/attachment
* @throws java.io.IOException * @throws java.io.IOException
*/ */
public void PDFAttachGenericFile(PDDocument doc, String filename, String relationship, String description, public void PDFAttachGenericFile(PDDocument doc, String filename, String relationship, String description,
@@ -453,8 +439,7 @@ public class ZUGFeRDExporter implements Closeable {
* useful for use-cases where the XML has already been produced by some external * useful for use-cases where the XML has already been produced by some external
* API or component. * API or component.
* *
* @param zugferdData * @param zugferdData XML data to be set as a byte array (XML file in raw form).
* XML data to be set as a byte array (XML file in raw form).
*/ */
public void setZUGFeRDXMLData(byte[] zugferdData) throws IOException { public void setZUGFeRDXMLData(byte[] zugferdData) throws IOException {
CustomXMLProvider cus = new CustomXMLProvider(); CustomXMLProvider cus = new CustomXMLProvider();
@@ -467,9 +452,7 @@ public class ZUGFeRDExporter implements Closeable {
/** /**
* Sets the ZUGFeRD conformance level (override). * Sets the ZUGFeRD conformance level (override).
* *
* @param zUGFeRDConformanceLevel * @param zUGFeRDConformanceLevel the new conformance level
* the new conformance level
*
* @deprecated Use {@link ZUGFeRDExporterFromA1Factory} instead * @deprecated Use {@link ZUGFeRDExporterFromA1Factory} instead
*/ */
@Deprecated @Deprecated
@@ -483,9 +466,7 @@ public class ZUGFeRDExporter implements Closeable {
/** /**
* Sets the ZUGFeRD conformance level (override). * Sets the ZUGFeRD conformance level (override).
* *
* @param zUGFeRDConformanceLevel * @param zUGFeRDConformanceLevel the new conformance level
* the new conformance level
*
* @deprecated Use {@link #setConformanceLevel(PDFAConformanceLevel)} instead * @deprecated Use {@link #setConformanceLevel(PDFAConformanceLevel)} instead
*/ */
@Deprecated @Deprecated
@@ -493,7 +474,8 @@ public class ZUGFeRDExporter implements Closeable {
this.profile = ZUGFeRDConformanceLevel.valueOf(zUGFeRDConformanceLevel); this.profile = ZUGFeRDConformanceLevel.valueOf(zUGFeRDConformanceLevel);
} }
/**** /**
* *
* Returns the PDFBox PDF Document * Returns the PDFBox PDF Document
* *
* @return PDDocument the PDFBox PDF * @return PDDocument the PDFBox PDF
@@ -603,7 +585,6 @@ public class ZUGFeRDExporter implements Closeable {
} }
/** /**
*
* @return if pdf file will be automatically closed after adding ZF * @return if pdf file will be automatically closed after adding ZF
*/ */
public boolean isAutoCloseDisabled() { public boolean isAutoCloseDisabled() {
@@ -611,7 +592,6 @@ public class ZUGFeRDExporter implements Closeable {
} }
/** /**
*
* @param disableAutoClose prevent PDF file from being closed after adding ZF * @param disableAutoClose prevent PDF file from being closed after adding ZF
*/ */
public void disableAutoClose(boolean disableAutoClose) { public void disableAutoClose(boolean disableAutoClose) {
@@ -620,14 +600,17 @@ public class ZUGFeRDExporter implements Closeable {
/** /**
* the human author (use factory method instead) * the human author (use factory method instead)
*
* @param creator * @param creator
*/ */
@Deprecated @Deprecated
public void setCreator(String creator) { public void setCreator(String creator) {
this.creator = creator; this.creator = creator;
} }
/** /**
* the CreatorTool attribute for the PDF * the CreatorTool attribute for the PDF
*
* @param creator * @param creator
*/ */
protected void setCreatorTool(String creatorTool) { protected void setCreatorTool(String creatorTool) {
@@ -636,6 +619,7 @@ public class ZUGFeRDExporter implements Closeable {
/** /**
* the authoring software (use factory method instead) * the authoring software (use factory method instead)
*
* @param producer * @param producer
*/ */
@Deprecated @Deprecated
@@ -644,7 +628,6 @@ public class ZUGFeRDExporter implements Closeable {
} }
/** /**
*
* @param ensurePDFisUpgraded if not set the PDF/A won't be relabelled A/3, e.g. if it already is one * @param ensurePDFisUpgraded if not set the PDF/A won't be relabelled A/3, e.g. if it already is one
*/ */
public void setPDFA3(boolean ensurePDFisUpgraded) { public void setPDFA3(boolean ensurePDFisUpgraded) {
@@ -652,7 +635,6 @@ public class ZUGFeRDExporter implements Closeable {
} }
/** /**
*
* @param attachZUGFeRDHeaders if false the ZUGFeRD XMP metadata won't be added, e.g. if it's not the first file * @param attachZUGFeRDHeaders if false the ZUGFeRD XMP metadata won't be added, e.g. if it's not the first file
*/ */
public void setAttachZUGFeRDHeaders(boolean attachZUGFeRDHeaders) { public void setAttachZUGFeRDHeaders(boolean attachZUGFeRDHeaders) {

View File

@@ -18,15 +18,6 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import org.apache.pdfbox.io.IOUtils; import org.apache.pdfbox.io.IOUtils;
import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.preflight.PreflightDocument; import org.apache.pdfbox.preflight.PreflightDocument;
@@ -34,15 +25,26 @@ import org.apache.pdfbox.preflight.exception.ValidationException;
import org.apache.pdfbox.preflight.parser.PreflightParser; import org.apache.pdfbox.preflight.parser.PreflightParser;
import org.apache.pdfbox.preflight.utils.ByteArrayDataSource; import org.apache.pdfbox.preflight.utils.ByteArrayDataSource;
import javax.activation.DataSource;
import javax.activation.FileDataSource;
import java.io.*;
import java.util.HashMap;
public class ZUGFeRDExporterFromA3Factory implements IExporterFactory { public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
protected boolean ignorePDFAErrors = false; protected boolean ignorePDFAErrors = false;
protected ZUGFeRDConformanceLevel zugferdConformanceLevel = ZUGFeRDConformanceLevel.EXTENDED; protected ZUGFeRDConformanceLevel zugferdConformanceLevel = ZUGFeRDConformanceLevel.EXTENDED;
protected PDFAConformanceLevel conformanceLevel = PDFAConformanceLevel.UNICODE; protected PDFAConformanceLevel conformanceLevel = PDFAConformanceLevel.UNICODE;
/** Producer (attribute for PDF */ /**
* Producer (attribute for PDF
*/
protected String producer = "mustangproject"; protected String producer = "mustangproject";
/** Human creator (attribute for PDF) */ /**
* Human creator (attribute for PDF)
*/
protected String creator = "mustangproject"; protected String creator = "mustangproject";
/** Creator tool (attribute for PDF) */ /**
* Creator tool (attribute for PDF)
*/
protected String creatorTool = null; protected String creatorTool = null;
private HashMap<String, byte[]> additionalXMLs = new HashMap<String, byte[]>(); private HashMap<String, byte[]> additionalXMLs = new HashMap<String, byte[]>();
@@ -51,12 +53,12 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
protected int ZFVersion = ZUGFeRDExporter.DefaultZUGFeRDVersion; protected int ZFVersion = ZUGFeRDExporter.DefaultZUGFeRDVersion;
protected boolean ensurePDFisUpgraded = false; protected boolean ensurePDFisUpgraded = false;
private boolean attachZUGFeRDHeaders = true; private boolean attachZUGFeRDHeaders = true;
/** /**
* 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)
* *
* @param pdfFilename * @param pdfFilename filename of an PDF/A1 compliant document
* filename of an PDF/A1 compliant document
*/ */
public ZUGFeRDExporter load(String pdfFilename) throws IOException { public ZUGFeRDExporter load(String pdfFilename) throws IOException {
@@ -78,13 +80,11 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
} }
/** /**
* 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)
* *
* @param pdfBinary * @param pdfBinary binary of a PDF/A1 compliant document
* binary of a PDF/A1 compliant document
*/ */
public ZUGFeRDExporter load(byte[] pdfBinary) throws IOException { public ZUGFeRDExporter load(byte[] pdfBinary) throws IOException {
ensurePDFIsValidPDFA(new ByteArrayDataSource(new ByteArrayInputStream(pdfBinary))); ensurePDFIsValidPDFA(new ByteArrayDataSource(new ByteArrayInputStream(pdfBinary)));
@@ -110,8 +110,7 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
* 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)
* *
* @param pdfSource * @param pdfSource source to read a PDF/A1 compliant document from
* source to read a PDF/A1 compliant document from
*/ */
public ZUGFeRDExporter load(InputStream pdfSource) throws IOException { public ZUGFeRDExporter load(InputStream pdfSource) throws IOException {
return load(readAllBytes(pdfSource)); return load(readAllBytes(pdfSource));
@@ -128,6 +127,7 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
IOUtils.copy(in, buffer); IOUtils.copy(in, buffer);
return buffer.toByteArray(); return buffer.toByteArray();
} }
private static boolean isValidA1(DataSource dataSource) throws IOException { private static boolean isValidA1(DataSource dataSource) throws IOException {
return getPDFAParserValidationResult(new PreflightParser(dataSource)); return getPDFAParserValidationResult(new PreflightParser(dataSource));
} }
@@ -135,8 +135,7 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
/** /**
* Sets the ZUGFeRD conformance level (override). * Sets the ZUGFeRD conformance level (override).
* *
* @param zugferdConformanceLevel * @param zugferdConformanceLevel the new conformance level
* the new conformance level
*/ */
public IExporterFactory setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel zugferdConformanceLevel) { public IExporterFactory setZUGFeRDConformanceLevel(ZUGFeRDConformanceLevel zugferdConformanceLevel) {
this.zugferdConformanceLevel = zugferdConformanceLevel; this.zugferdConformanceLevel = zugferdConformanceLevel;
@@ -174,17 +173,15 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
/** /**
* All files are PDF/A-3, setConformance refers to the level conformance. * All files are PDF/A-3, setConformance refers to the level conformance.
* * <p/>
* PDF/A-3 has three coformance levels, called "A", "U" and "B". * PDF/A-3 has three coformance levels, called "A", "U" and "B".
* * <p/>
* PDF/A-3-B where B means only visually preservable, U -standard for Mustang- * PDF/A-3-B where B means only visually preservable, U -standard for Mustang-
* means visually and unicode preservable and A means full compliance, i.e. * means visually and unicode preservable and A means full compliance, i.e.
* visually, unicode and structurally preservable and tagged PDF, i.e. useful * visually, unicode and structurally preservable and tagged PDF, i.e. useful
* metainformation for blind people. * metainformation for blind people.
* * <p/>
* Feel free to pass "A" as new level if you know what you are doing :-) * Feel free to pass "A" as new level if you know what you are doing :-)
*
*
*/ */
public IExporterFactory setConformanceLevel(PDFAConformanceLevel newLevel) { public IExporterFactory setConformanceLevel(PDFAConformanceLevel newLevel) {
conformanceLevel = newLevel; conformanceLevel = newLevel;
@@ -211,6 +208,7 @@ public class ZUGFeRDExporterFromA3Factory implements IExporterFactory {
this.producer = producer; this.producer = producer;
return this; return this;
} }
public IExporterFactory setAttachZUGFeRDHeaders(boolean attachHeaders) { public IExporterFactory setAttachZUGFeRDHeaders(boolean attachHeaders) {
this.attachZUGFeRDHeaders = attachHeaders; this.attachZUGFeRDHeaders = attachHeaders;
return this; return this;

View File

@@ -26,19 +26,6 @@ package org.mustangproject.ZUGFeRD;
* @author jstaerk * @author jstaerk
* */ * */
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary; import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary;
import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode; import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode;
@@ -50,6 +37,15 @@ import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
//root.setNamespace(Namespace.getNamespace("http://www.energystar.gov/manageBldgs/req")); //root.setNamespace(Namespace.getNamespace("http://www.energystar.gov/manageBldgs/req"));
public class ZUGFeRDImporter { public class ZUGFeRDImporter {
@@ -59,9 +55,13 @@ public class ZUGFeRDImporter {
* *
*/ */
/** @var if metadata has been found */ /**
* @var if metadata has been found
*/
private boolean containsMeta = false; private boolean containsMeta = false;
/** @var the reference (i.e. invoice number) of the sender */ /**
* @var the reference (i.e. invoice number) of the sender
*/
private String foreignReference; private String foreignReference;
private String BLZ; private String BLZ;
private String BIC; private String BIC;
@@ -71,7 +71,9 @@ public class ZUGFeRDImporter {
private String amount; private String amount;
private String dueDate; private String dueDate;
private HashMap<String, byte[]> additionalXMLs = new HashMap<String, byte[]>(); private HashMap<String, byte[]> additionalXMLs = new HashMap<String, byte[]>();
/** Raw XML form of the extracted data - may be directly obtained. */ /**
* Raw XML form of the extracted data - may be directly obtained.
*/
private byte[] rawXML = null; private byte[] rawXML = null;
private String bankName; private String bankName;
private boolean amountFound; private boolean amountFound;
@@ -84,8 +86,7 @@ public class ZUGFeRDImporter {
* Extracts a ZUGFeRD invoice from a PDF document represented by a file name. * Extracts a ZUGFeRD invoice from a PDF document represented by a file name.
* Errors are just logged to STDOUT. * Errors are just logged to STDOUT.
* *
* @param pdfFilename * @param pdfFilename the filename of the pdf
* the filename of the pdf
*/ */
public void extract(String pdfFilename) { public void extract(String pdfFilename) {
try { try {
@@ -105,8 +106,9 @@ public class ZUGFeRDImporter {
return s.hasNext() ? s.next() : ""; return s.hasNext() ? s.next() : "";
} }
/*** /**
* get xmp metadata of the PDF, null if not available * get xmp metadata of the PDF, null if not available
*
* @return string * @return string
*/ */
public String getXMP() { public String getXMP() {
@@ -117,8 +119,7 @@ public class ZUGFeRDImporter {
* Extracts a ZUGFeRD invoice from a PDF document represented by an input * Extracts a ZUGFeRD invoice from a PDF document represented by an input
* stream. Errors are reported via exception handling. * stream. Errors are reported via exception handling.
* *
* @param pdfStream * @param pdfStream a inputstream of a pdf file
* a inputstream of a pdf file
*/ */
public void extractLowLevel(InputStream pdfStream) throws IOException { public void extractLowLevel(InputStream pdfStream) throws IOException {
PDEmbeddedFilesNameTreeNode etn; PDEmbeddedFilesNameTreeNode etn;
@@ -376,7 +377,6 @@ public class ZUGFeRDImporter {
} }
/** /**
*
* @return if export found parseable ZUGFeRD data * @return if export found parseable ZUGFeRD data
*/ */
public boolean containsMeta() { public boolean containsMeta() {
@@ -384,7 +384,6 @@ public class ZUGFeRDImporter {
} }
/** /**
*
* @return the reference (purpose) the sender specified for this invoice * @return the reference (purpose) the sender specified for this invoice
*/ */
public String getForeignReference() { public String getForeignReference() {
@@ -402,7 +401,6 @@ public class ZUGFeRDImporter {
} }
/** /**
*
* @return the sender's bank's BLZ code * @return the sender's bank's BLZ code
*/ */
public String getBLZ() { public String getBLZ() {
@@ -420,7 +418,6 @@ public class ZUGFeRDImporter {
} }
/** /**
*
* @return the sender's bank's BIC code * @return the sender's bank's BIC code
*/ */
public String getBIC() { public String getBIC() {
@@ -446,7 +443,6 @@ public class ZUGFeRDImporter {
} }
/** /**
*
* @return the sender's IBAN * @return the sender's IBAN
*/ */
public String getIBAN() { public String getIBAN() {
@@ -460,7 +456,6 @@ public class ZUGFeRDImporter {
} }
/** /**
*
* @return the sender's KTO * @return the sender's KTO
*/ */
public String getKTO() { public String getKTO() {
@@ -474,7 +469,6 @@ public class ZUGFeRDImporter {
} }
/** /**
*
* @return the sender's bank name * @return the sender's bank name
*/ */
public String getBankName() { public String getBankName() {
@@ -496,7 +490,6 @@ public class ZUGFeRDImporter {
} }
/** /**
*
* @return the name of the owner of the sender's bank account * @return the name of the owner of the sender's bank account
*/ */
public String getHolder() { public String getHolder() {
@@ -514,7 +507,6 @@ public class ZUGFeRDImporter {
} }
/** /**
*
* @return the total payable amount * @return the total payable amount
*/ */
public String getAmount() { public String getAmount() {
@@ -528,7 +520,6 @@ public class ZUGFeRDImporter {
} }
/** /**
*
* @return when the payment is due * @return when the payment is due
*/ */
public String getDueDate() { public String getDueDate() {
@@ -546,16 +537,13 @@ public class ZUGFeRDImporter {
} }
/** /**
* * @param meta raw XML to be set
* @param meta
* raw XML to be set
*/ */
public void setMeta(String meta) { public void setMeta(String meta) {
this.rawXML = meta.getBytes(); this.rawXML = meta.getBytes();
} }
/** /**
*
* @return raw XML of the invoice * @return raw XML of the invoice
*/ */
public String getMeta() { public String getMeta() {
@@ -568,7 +556,6 @@ public class ZUGFeRDImporter {
/** /**
*
* @return return UTF8 XML (without BOM) of the invoice * @return return UTF8 XML (without BOM) of the invoice
*/ */
public String getUTF8() { public String getUTF8() {

View File

@@ -18,23 +18,12 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import java.io.ByteArrayOutputStream; import javax.xml.transform.*;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.transform.Source;
import javax.xml.transform.Templates;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.URIResolver;
import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource; import javax.xml.transform.stream.StreamSource;
import java.io.*;
import java.util.logging.Level;
import java.util.logging.Logger;
public class ZUGFeRDMigrator { public class ZUGFeRDMigrator {

View File

@@ -18,63 +18,14 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import org.mustangproject.ZUGFeRD.model.*;
import javax.xml.bind.JAXBElement;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols; import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import javax.xml.bind.JAXBElement;
import org.mustangproject.ZUGFeRD.model.AmountType;
import org.mustangproject.ZUGFeRD.model.CodeType;
import org.mustangproject.ZUGFeRD.model.CountryIDType;
import org.mustangproject.ZUGFeRD.model.CreditorFinancialAccountType;
import org.mustangproject.ZUGFeRD.model.CreditorFinancialInstitutionType;
import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType;
import org.mustangproject.ZUGFeRD.model.DateTimeType;
import org.mustangproject.ZUGFeRD.model.DateTimeTypeConstants;
import org.mustangproject.ZUGFeRD.model.DocumentCodeType;
import org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants;
import org.mustangproject.ZUGFeRD.model.DocumentContextParameterType;
import org.mustangproject.ZUGFeRD.model.DocumentContextParameterTypeConstants;
import org.mustangproject.ZUGFeRD.model.DocumentLineDocumentType;
import org.mustangproject.ZUGFeRD.model.ExchangedDocumentContextType;
import org.mustangproject.ZUGFeRD.model.ExchangedDocumentType;
import org.mustangproject.ZUGFeRD.model.IDType;
import org.mustangproject.ZUGFeRD.model.IndicatorType;
import org.mustangproject.ZUGFeRD.model.LogisticsServiceChargeType;
import org.mustangproject.ZUGFeRD.model.NoteType;
import org.mustangproject.ZUGFeRD.model.NoteTypeConstants;
import org.mustangproject.ZUGFeRD.model.ObjectFactory;
import org.mustangproject.ZUGFeRD.model.PaymentMeansCodeType;
import org.mustangproject.ZUGFeRD.model.PaymentMeansCodeTypeConstants;
import org.mustangproject.ZUGFeRD.model.PercentType;
import org.mustangproject.ZUGFeRD.model.QuantityType;
import org.mustangproject.ZUGFeRD.model.SupplyChainEventType;
import org.mustangproject.ZUGFeRD.model.SupplyChainTradeAgreementType;
import org.mustangproject.ZUGFeRD.model.SupplyChainTradeDeliveryType;
import org.mustangproject.ZUGFeRD.model.SupplyChainTradeLineItemType;
import org.mustangproject.ZUGFeRD.model.SupplyChainTradeSettlementType;
import org.mustangproject.ZUGFeRD.model.SupplyChainTradeTransactionType;
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeType;
import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants;
import org.mustangproject.ZUGFeRD.model.TaxRegistrationType;
import org.mustangproject.ZUGFeRD.model.TaxRegistrationTypeConstants;
import org.mustangproject.ZUGFeRD.model.TaxTypeCodeType;
import org.mustangproject.ZUGFeRD.model.TaxTypeCodeTypeConstants;
import org.mustangproject.ZUGFeRD.model.TextType;
import org.mustangproject.ZUGFeRD.model.TradeAddressType;
import org.mustangproject.ZUGFeRD.model.TradeAllowanceChargeType;
import org.mustangproject.ZUGFeRD.model.TradePartyType;
import org.mustangproject.ZUGFeRD.model.TradePaymentTermsType;
import org.mustangproject.ZUGFeRD.model.TradePriceType;
import org.mustangproject.ZUGFeRD.model.TradeProductType;
import org.mustangproject.ZUGFeRD.model.TradeSettlementMonetarySummationType;
import org.mustangproject.ZUGFeRD.model.TradeSettlementPaymentMeansType;
import org.mustangproject.ZUGFeRD.model.TradeTaxType;
class ZUGFeRDTransactionModelConverter { class ZUGFeRDTransactionModelConverter {
private static final SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd"); private static final SimpleDateFormat zugferdDateFormat = new SimpleDateFormat("yyyyMMdd");
@@ -893,7 +844,6 @@ class ZUGFeRDTransactionModelConverter {
* 190 Eur * 190 Eur
* *
* @return HashMap<BigDecimal, VATAmount> which taxes have been used with which amounts * @return HashMap<BigDecimal, VATAmount> which taxes have been used with which amounts
*
*/ */
private HashMap<BigDecimal, VATAmount> getVATPercentAmountMap() { private HashMap<BigDecimal, VATAmount> getVATPercentAmountMap() {
return getVATPercentAmountMap(false); return getVATPercentAmountMap(false);

View File

@@ -19,6 +19,7 @@
package org.mustangproject.ZUGFeRD.model; package org.mustangproject.ZUGFeRD.model;
import com.sun.xml.bind.marshaller.NamespacePrefixMapper; import com.sun.xml.bind.marshaller.NamespacePrefixMapper;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

View File

@@ -20,20 +20,22 @@ package org.mustangproject.toecount;
import java.io.IOException; import java.io.IOException;
import java.nio.file.FileVisitResult; import java.nio.file.FileVisitResult;
import static java.nio.file.FileVisitResult.CONTINUE;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor; import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes; import java.nio.file.attribute.BasicFileAttributes;
import static java.nio.file.FileVisitResult.CONTINUE;
public class FileTraverser extends SimpleFileVisitor<Path> { public class FileTraverser extends SimpleFileVisitor<Path> {
private StatRun thisRun; private StatRun thisRun;
public FileTraverser(StatRun statistics) { public FileTraverser(StatRun statistics) {
this.thisRun = statistics; this.thisRun = statistics;
} }
/*** /**
* check each file * check each file
*/ */
@Override @Override
@@ -50,7 +52,7 @@ public class FileTraverser extends SimpleFileVisitor<Path> {
return CONTINUE; return CONTINUE;
} }
/*** /**
* for each directory * for each directory
*/ */
@Override @Override
@@ -61,7 +63,7 @@ public class FileTraverser extends SimpleFileVisitor<Path> {
} }
/*** /**
* show errors like file permission stacktraces * show errors like file permission stacktraces
*/ */
@Override @Override

View File

@@ -32,6 +32,7 @@ public class StatRun {
public boolean shallIgnoreFileExt() { public boolean shallIgnoreFileExt() {
return !checkFileExt; return !checkFileExt;
} }
public void incFileCount() { public void incFileCount() {
fileCount++; fileCount++;
} }
@@ -64,8 +65,9 @@ public class StatRun {
return dirCount; return dirCount;
} }
/*** /**
* returns final statistics * returns final statistics
*
* @return english string with linefeeds detailling number of files, directories, number of pdfs and of zugferd files * @return english string with linefeeds detailling number of files, directories, number of pdfs and of zugferd files
*/ */
public String getSummaryLine() { public String getSummaryLine() {
@@ -75,8 +77,10 @@ public class StatRun {
getFileCount(), getDirCount(), getPDFCount(), getZUGFeRDCount()); getFileCount(), getDirCount(), getPDFCount(), getZUGFeRDCount());
} }
/***
/**
* show that something is happening * show that something is happening
*
* @return String, usually a dot * @return String, usually a dot
*/ */
public String getOutputLine() { public String getOutputLine() {

View File

@@ -25,24 +25,18 @@ package org.mustangproject.toecount;
import com.sanityinc.jargs.CmdLineParser; import com.sanityinc.jargs.CmdLineParser;
import com.sanityinc.jargs.CmdLineParser.Option; import com.sanityinc.jargs.CmdLineParser.Option;
import org.mustangproject.ZUGFeRD.*;
import javax.xml.transform.TransformerException;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import javax.xml.transform.TransformerException;
import org.mustangproject.ZUGFeRD.ZUGFeRDConformanceLevel;
import org.mustangproject.ZUGFeRD.ZUGFeRDExporter;
import org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromA1Factory;
import org.mustangproject.ZUGFeRD.ZUGFeRDExporterFromA3Factory;
import org.mustangproject.ZUGFeRD.ZUGFeRDImporter;
import org.mustangproject.ZUGFeRD.ZUGFeRDMigrator;
public class Toecount { public class Toecount {
// build with: /opt/local/bin/mvn clean compile assembly:single // build with: /opt/local/bin/mvn clean compile assembly:single
@@ -114,19 +108,15 @@ public class Toecount {
+ "\t\t\tFor ZUGFeRD v2: <M>INIMUM, BASIC <W>L, <B>ASIC, <C>IUS, <E>N16931, E<X>TENDED\r\n"); + "\t\t\tFor ZUGFeRD v2: <M>INIMUM, BASIC <W>L, <B>ASIC, <C>IUS, <E>N16931, E<X>TENDED\r\n");
} }
/*** /**
* Asks the user (repeatedly, if neccessary) on the command line for a String * Asks the user (repeatedly, if neccessary) on the command line for a String
* (offering a defaultValue) conforming to a Regex pattern * (offering a defaultValue) conforming to a Regex pattern
* *
* @param prompt * @param prompt the question to be asked to the user
* the question to be asked to the user * @param defaultValue the default return value if user hits enter
* @param defaultValue * @param pattern a regex of acceptable values
* the default return value if user hits enter
* @param pattern
* a regex of acceptable values
* @return the user answer conforming to pattern * @return the user answer conforming to pattern
* @throws Exception * @throws Exception if pattern not compielable or IOexception on input
* if pattern not compielable or IOexception on input
*/ */
protected static String getStringFromUser(String prompt, String defaultValue, String pattern) throws Exception { protected static String getStringFromUser(String prompt, String defaultValue, String pattern) throws Exception {
String input = ""; String input = "";
@@ -162,20 +152,14 @@ public class Toecount {
return input; return input;
} }
/*** /**
* Prompts the user for a input or output filename * Prompts the user for a input or output filename
* *
* @param the * @param the text the user is asked
* text the user is asked * @param a default Filename
* @param a * @param expectedExtension will warn if filename does not match expected file extension
* default Filename * @param ensureFileExists will warn if file does NOT exist (for input files)
* @param expectedExtension * @param ensureFileNotExists will warn if file DOES exist (for output files)
* will warn if filename does not match expected file extension
* @param ensureFileExists
* will warn if file does NOT exist (for input files)
* @param ensureFileNotExists
* will warn if file DOES exist (for output files)
*
* @return String * @return String
*/ */
protected static String getFilenameFromUser(String prompt, String defaultFilename, String expectedExtension, protected static String getFilenameFromUser(String prompt, String defaultFilename, String expectedExtension,
@@ -322,9 +306,7 @@ public class Toecount {
if (helpRequested) { if (helpRequested) {
printHelp(); printHelp();
} } else if (((directoryName != null) && (directoryName.length() > 0)) || filesFromStdIn.booleanValue()) {
else if (((directoryName != null) && (directoryName.length() > 0)) || filesFromStdIn.booleanValue()) {
performMetrics(directoryName, filesFromStdIn, ignoreFileExt); performMetrics(directoryName, filesFromStdIn, ignoreFileExt);
} else if (combineRequested) { } else if (combineRequested) {
performCombine(sourceName, sourceXMLName, outName, zugferdVersion, zugferdProfile); performCombine(sourceName, sourceXMLName, outName, zugferdVersion, zugferdProfile);

View File

@@ -6,9 +6,12 @@
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15" xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
targetNamespace="urn:ferd:CrossIndustryDocument:invoice:1p0" targetNamespace="urn:ferd:CrossIndustryDocument:invoice:1p0"
elementFormDefault="qualified"> elementFormDefault="qualified">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_QualifiedDataType_12.xsd"/> <xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
<xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_12.xsd"/> schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_QualifiedDataType_12.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/> <xs:import namespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12"
schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_ReusableAggregateBusinessInformationEntity_12.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/>
<xs:element name="CrossIndustryDocument" type="rsm:CrossIndustryDocumentType"/> <xs:element name="CrossIndustryDocument" type="rsm:CrossIndustryDocumentType"/>
<xs:complexType name="CrossIndustryDocumentType"> <xs:complexType name="CrossIndustryDocumentType">
<xs:sequence> <xs:sequence>

View File

@@ -5,7 +5,8 @@
targetNamespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12" targetNamespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
elementFormDefault="qualified" elementFormDefault="qualified"
version="12.0"> version="12.0">
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/> <xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/>
<xs:simpleType name="AllowanceChargeReasonCodeContentType"> <xs:simpleType name="AllowanceChargeReasonCodeContentType">
<xs:restriction base="xs:token"/> <xs:restriction base="xs:token"/>
</xs:simpleType> </xs:simpleType>

View File

@@ -6,8 +6,10 @@
targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12" targetNamespace="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:12"
elementFormDefault="qualified" elementFormDefault="qualified"
version="12.0"> version="12.0">
<xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_QualifiedDataType_12.xsd"/> <xs:import namespace="urn:un:unece:uncefact:data:standard:QualifiedDataType:12"
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15" schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/> schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_QualifiedDataType_12.xsd"/>
<xs:import namespace="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:15"
schemaLocation="ZUGFeRD1p0_urn_un_unece_uncefact_data_standard_UnqualifiedDataType_15.xsd"/>
<xs:complexType name="CreditorFinancialAccountType"> <xs:complexType name="CreditorFinancialAccountType">
<xs:sequence> <xs:sequence>
<xs:element name="IBANID" type="udt:IDType" minOccurs="0"/> <xs:element name="IBANID" type="udt:IDType" minOccurs="0"/>
@@ -49,8 +51,10 @@
<xs:complexType name="ExchangedDocumentContextType"> <xs:complexType name="ExchangedDocumentContextType">
<xs:sequence> <xs:sequence>
<xs:element name="TestIndicator" type="udt:IndicatorType" minOccurs="0"/> <xs:element name="TestIndicator" type="udt:IndicatorType" minOccurs="0"/>
<xs:element name="BusinessProcessSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="BusinessProcessSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType"
<xs:element name="GuidelineSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType" minOccurs="0" maxOccurs="unbounded"/> minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="GuidelineSpecifiedDocumentContextParameter" type="ram:DocumentContextParameterType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="ExchangedDocumentType"> <xs:complexType name="ExchangedDocumentType">
@@ -127,7 +131,8 @@
</xs:complexType> </xs:complexType>
<xs:complexType name="SupplyChainConsignmentType"> <xs:complexType name="SupplyChainConsignmentType">
<xs:sequence> <xs:sequence>
<xs:element name="SpecifiedLogisticsTransportMovement" type="ram:LogisticsTransportMovementType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="SpecifiedLogisticsTransportMovement" type="ram:LogisticsTransportMovementType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="SupplyChainEventType"> <xs:complexType name="SupplyChainEventType">
@@ -142,12 +147,17 @@
<xs:element name="BuyerTradeParty" type="ram:TradePartyType" minOccurs="0"/> <xs:element name="BuyerTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ProductEndUserTradeParty" type="ram:TradePartyType" minOccurs="0"/> <xs:element name="ProductEndUserTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ApplicableTradeDeliveryTerms" type="ram:TradeDeliveryTermsType" minOccurs="0"/> <xs:element name="ApplicableTradeDeliveryTerms" type="ram:TradeDeliveryTermsType" minOccurs="0"/>
<xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="BuyerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"
<xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/> maxOccurs="unbounded"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ContractReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"
<xs:element name="GrossPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0" maxOccurs="unbounded"/> maxOccurs="unbounded"/>
<xs:element name="AdditionalReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="GrossPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="NetPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="NetPriceProductTradePrice" type="ram:TradePriceType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="CustomerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="CustomerOrderReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="SupplyChainTradeDeliveryType"> <xs:complexType name="SupplyChainTradeDeliveryType">
@@ -155,22 +165,27 @@
<xs:element name="BilledQuantity" type="udt:QuantityType" minOccurs="0"/> <xs:element name="BilledQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="ChargeFreeQuantity" type="udt:QuantityType" minOccurs="0"/> <xs:element name="ChargeFreeQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="PackageQuantity" type="udt:QuantityType" minOccurs="0"/> <xs:element name="PackageQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="RelatedSupplyChainConsignment" type="ram:SupplyChainConsignmentType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="RelatedSupplyChainConsignment" type="ram:SupplyChainConsignmentType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/> <xs:element name="ShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="UltimateShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/> <xs:element name="UltimateShipToTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ShipFromTradeParty" type="ram:TradePartyType" minOccurs="0"/> <xs:element name="ShipFromTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ActualDeliverySupplyChainEvent" type="ram:SupplyChainEventType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/> <xs:element name="DespatchAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
<xs:element name="ReceivingAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ReceivingAdviceReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="DeliveryNoteReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/> <xs:element name="DeliveryNoteReferencedDocument" type="ram:ReferencedDocumentType" minOccurs="0"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="SupplyChainTradeLineItemType"> <xs:complexType name="SupplyChainTradeLineItemType">
<xs:sequence> <xs:sequence>
<xs:element name="AssociatedDocumentLineDocument" type="ram:DocumentLineDocumentType" minOccurs="0"/> <xs:element name="AssociatedDocumentLineDocument" type="ram:DocumentLineDocumentType" minOccurs="0"/>
<xs:element name="SpecifiedSupplyChainTradeAgreement" type="ram:SupplyChainTradeAgreementType" minOccurs="0"/> <xs:element name="SpecifiedSupplyChainTradeAgreement" type="ram:SupplyChainTradeAgreementType"
minOccurs="0"/>
<xs:element name="SpecifiedSupplyChainTradeDelivery" type="ram:SupplyChainTradeDeliveryType" minOccurs="0"/> <xs:element name="SpecifiedSupplyChainTradeDelivery" type="ram:SupplyChainTradeDeliveryType" minOccurs="0"/>
<xs:element name="SpecifiedSupplyChainTradeSettlement" type="ram:SupplyChainTradeSettlementType" minOccurs="0"/> <xs:element name="SpecifiedSupplyChainTradeSettlement" type="ram:SupplyChainTradeSettlementType"
minOccurs="0"/>
<xs:element name="SpecifiedTradeProduct" type="ram:TradeProductType" minOccurs="0"/> <xs:element name="SpecifiedTradeProduct" type="ram:TradeProductType" minOccurs="0"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
@@ -180,23 +195,35 @@
<xs:element name="InvoiceCurrencyCode" type="udt:CodeType" minOccurs="0"/> <xs:element name="InvoiceCurrencyCode" type="udt:CodeType" minOccurs="0"/>
<xs:element name="InvoiceeTradeParty" type="ram:TradePartyType" minOccurs="0"/> <xs:element name="InvoiceeTradeParty" type="ram:TradePartyType" minOccurs="0"/>
<xs:element name="PayeeTradeParty" type="ram:TradePartyType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="PayeeTradeParty" type="ram:TradePartyType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeSettlementPaymentMeans" type="ram:TradeSettlementPaymentMeansType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="SpecifiedTradeSettlementPaymentMeans" type="ram:TradeSettlementPaymentMeansType"
minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ApplicableTradeTax" type="ram:TradeTaxType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="BillingSpecifiedPeriod" type="ram:SpecifiedPeriodType" minOccurs="0"
<xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/> maxOccurs="unbounded"/>
<xs:element name="SpecifiedLogisticsServiceCharge" type="ram:LogisticsServiceChargeType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="SpecifiedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0"
<xs:element name="SpecifiedTradePaymentTerms" type="ram:TradePaymentTermsType" minOccurs="0" maxOccurs="unbounded"/> maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="SpecifiedLogisticsServiceCharge" type="ram:LogisticsServiceChargeType" minOccurs="0"
<xs:element name="SpecifiedTradeSettlementMonetarySummation" type="ram:TradeSettlementMonetarySummationType" minOccurs="0"/> maxOccurs="unbounded"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="SpecifiedTradePaymentTerms" type="ram:TradePaymentTermsType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="SpecifiedTradeSettlementMonetarySummation" type="ram:TradeSettlementMonetarySummationType"
minOccurs="0"/>
<xs:element name="ReceivableSpecifiedTradeAccountingAccount" type="ram:TradeAccountingAccountType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="SupplyChainTradeTransactionType"> <xs:complexType name="SupplyChainTradeTransactionType">
<xs:sequence> <xs:sequence>
<xs:element name="ApplicableSupplyChainTradeAgreement" type="ram:SupplyChainTradeAgreementType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ApplicableSupplyChainTradeAgreement" type="ram:SupplyChainTradeAgreementType"
<xs:element name="ApplicableSupplyChainTradeDelivery" type="ram:SupplyChainTradeDeliveryType" minOccurs="0"/> minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableSupplyChainTradeSettlement" type="ram:SupplyChainTradeSettlementType" minOccurs="0"/> <xs:element name="ApplicableSupplyChainTradeDelivery" type="ram:SupplyChainTradeDeliveryType"
<xs:element name="IncludedSupplyChainTradeLineItem" type="ram:SupplyChainTradeLineItemType" minOccurs="0" maxOccurs="unbounded"/> minOccurs="0"/>
<xs:element name="ApplicableSupplyChainTradeSettlement" type="ram:SupplyChainTradeSettlementType"
minOccurs="0"/>
<xs:element name="IncludedSupplyChainTradeLineItem" type="ram:SupplyChainTradeLineItemType" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="TaxRegistrationType"> <xs:complexType name="TaxRegistrationType">
@@ -235,8 +262,10 @@
<xs:sequence> <xs:sequence>
<xs:element name="PersonName" type="udt:TextType" minOccurs="0"/> <xs:element name="PersonName" type="udt:TextType" minOccurs="0"/>
<xs:element name="DepartmentName" type="udt:TextType" minOccurs="0"/> <xs:element name="DepartmentName" type="udt:TextType" minOccurs="0"/>
<xs:element name="TelephoneUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="TelephoneUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"
<xs:element name="FaxUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0" maxOccurs="unbounded"/> maxOccurs="unbounded"/>
<xs:element name="FaxUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="EmailURIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/> <xs:element name="EmailURIUniversalCommunication" type="ram:UniversalCommunicationType" minOccurs="0"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
@@ -257,7 +286,8 @@
<xs:element name="Name" type="udt:TextType" minOccurs="0"/> <xs:element name="Name" type="udt:TextType" minOccurs="0"/>
<xs:element name="DefinedTradeContact" type="ram:TradeContactType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="DefinedTradeContact" type="ram:TradeContactType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/> <xs:element name="PostalTradeAddress" type="ram:TradeAddressType" minOccurs="0"/>
<xs:element name="SpecifiedTaxRegistration" type="ram:TaxRegistrationType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="SpecifiedTaxRegistration" type="ram:TaxRegistrationType" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="TradePaymentDiscountTermsType"> <xs:complexType name="TradePaymentDiscountTermsType">
@@ -283,15 +313,18 @@
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="DueDateDateTime" type="udt:DateTimeType" minOccurs="0"/> <xs:element name="DueDateDateTime" type="udt:DateTimeType" minOccurs="0"/>
<xs:element name="PartialPaymentAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="PartialPaymentAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableTradePaymentPenaltyTerms" type="ram:TradePaymentPenaltyTermsType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ApplicableTradePaymentPenaltyTerms" type="ram:TradePaymentPenaltyTermsType" minOccurs="0"
<xs:element name="ApplicableTradePaymentDiscountTerms" type="ram:TradePaymentDiscountTermsType" minOccurs="0" maxOccurs="unbounded"/> maxOccurs="unbounded"/>
<xs:element name="ApplicableTradePaymentDiscountTerms" type="ram:TradePaymentDiscountTermsType"
minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="TradePriceType"> <xs:complexType name="TradePriceType">
<xs:sequence> <xs:sequence>
<xs:element name="ChargeAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ChargeAmount" type="udt:AmountType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/> <xs:element name="BasisQuantity" type="udt:QuantityType" minOccurs="0"/>
<xs:element name="AppliedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="AppliedTradeAllowanceCharge" type="ram:TradeAllowanceChargeType" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="TradeProductType"> <xs:complexType name="TradeProductType">
@@ -301,10 +334,13 @@
<xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/> <xs:element name="BuyerAssignedID" type="udt:IDType" minOccurs="0"/>
<xs:element name="Name" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="Name" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="Description" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ApplicableProductCharacteristic" type="ram:ProductCharacteristicType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ApplicableProductCharacteristic" type="ram:ProductCharacteristicType" minOccurs="0"
<xs:element name="DesignatedProductClassification" type="ram:ProductClassificationType" minOccurs="0" maxOccurs="unbounded"/> maxOccurs="unbounded"/>
<xs:element name="DesignatedProductClassification" type="ram:ProductClassificationType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="OriginTradeCountry" type="ram:TradeCountryType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="OriginTradeCountry" type="ram:TradeCountryType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="IncludedReferencedProduct" type="ram:ReferencedProductType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="IncludedReferencedProduct" type="ram:ReferencedProductType" minOccurs="0"
maxOccurs="unbounded"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="TradeSettlementMonetarySummationType"> <xs:complexType name="TradeSettlementMonetarySummationType">
@@ -326,9 +362,12 @@
<xs:element name="Information" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="Information" type="udt:TextType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ID" type="udt:IDType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="PayerPartyDebtorFinancialAccount" type="ram:DebtorFinancialAccountType" minOccurs="0"/> <xs:element name="PayerPartyDebtorFinancialAccount" type="ram:DebtorFinancialAccountType" minOccurs="0"/>
<xs:element name="PayeePartyCreditorFinancialAccount" type="ram:CreditorFinancialAccountType" minOccurs="0"/> <xs:element name="PayeePartyCreditorFinancialAccount" type="ram:CreditorFinancialAccountType"
<xs:element name="PayerSpecifiedDebtorFinancialInstitution" type="ram:DebtorFinancialInstitutionType" minOccurs="0"/> minOccurs="0"/>
<xs:element name="PayeeSpecifiedCreditorFinancialInstitution" type="ram:CreditorFinancialInstitutionType" minOccurs="0"/> <xs:element name="PayerSpecifiedDebtorFinancialInstitution" type="ram:DebtorFinancialInstitutionType"
minOccurs="0"/>
<xs:element name="PayeeSpecifiedCreditorFinancialInstitution" type="ram:CreditorFinancialInstitutionType"
minOccurs="0"/>
</xs:sequence> </xs:sequence>
</xs:complexType> </xs:complexType>
<xs:complexType name="TradeTaxType"> <xs:complexType name="TradeTaxType">

View File

@@ -18,23 +18,23 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestCase; import junit.framework.TestCase;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.junit.FixMethodOrder; import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters; import org.junit.runners.MethodSorters;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
@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 * @param testName name of the test case
* name of the test case
*/ */
public MustangReaderWriterCustomXMLTest(String testName) { public MustangReaderWriterCustomXMLTest(String testName) {
super(testName); super(testName);
@@ -303,6 +303,7 @@ public class MustangReaderWriterCustomXMLTest extends TestCase {
assertEquals(holder, "Bei Spiel GmbH"); assertEquals(holder, "Bei Spiel GmbH");
assertEquals(ref, "RE-20171118/506"); assertEquals(ref, "RE-20171118/506");
} }
/** /**
* The exporter test bases on @{code * The exporter test bases on @{code
* ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds * ./src/test/MustangGnuaccountingBeispielRE-20140703_502blanko.pdf}, adds

View File

@@ -18,6 +18,12 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -25,134 +31,108 @@ import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExportableTransaction public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExportableTransaction {
{
@Override @Override
public Date getDeliveryDate() public Date getDeliveryDate() {
{
return new GregorianCalendar(2017, Calendar.MAY, 7).getTime(); return new GregorianCalendar(2017, Calendar.MAY, 7).getTime();
} }
@Override @Override
public Date getDueDate() public Date getDueDate() {
{
return new GregorianCalendar(2017, Calendar.MAY, 30).getTime(); return new GregorianCalendar(2017, Calendar.MAY, 30).getTime();
} }
@Override @Override
public Date getIssueDate() public Date getIssueDate() {
{
return new GregorianCalendar(2017, Calendar.MAY, 9).getTime(); return new GregorianCalendar(2017, Calendar.MAY, 9).getTime();
} }
@Override @Override
public String getNumber() public String getNumber() {
{
return "RE-20170509/505"; return "RE-20170509/505";
} }
@Override @Override
public String getOwnKto() public String getOwnKto() {
{
return "44421800"; return "44421800";
} }
@Override @Override
public String getOwnBLZ() public String getOwnBLZ() {
{
return "41441604"; return "41441604";
} }
@Override @Override
public String getOwnBIC() public String getOwnBIC() {
{
return "COBADEFFXXX"; return "COBADEFFXXX";
} }
@Override @Override
public String getOwnBankName() public String getOwnBankName() {
{
return "Commerzbank"; return "Commerzbank";
} }
@Override @Override
public String getOwnCountry() public String getOwnCountry() {
{
return "DE"; return "DE";
} }
@Override @Override
public String getOwnIBAN() public String getOwnIBAN() {
{
return "DE88 2008 0000 0970 3757 00"; return "DE88 2008 0000 0970 3757 00";
} }
@Override @Override
public String getOwnLocation() public String getOwnLocation() {
{
return "Stadthausen"; return "Stadthausen";
} }
@Override @Override
public String getOwnOrganisationName() public String getOwnOrganisationName() {
{
return "Bei Spiel GmbH"; return "Bei Spiel GmbH";
} }
@Override @Override
public String getOwnStreet() public String getOwnStreet() {
{
return "Ecke 12"; return "Ecke 12";
} }
@Override @Override
public String getOwnTaxID() public String getOwnTaxID() {
{
return "22/815/0815/4"; return "22/815/0815/4";
} }
@Override @Override
public String getOwnVATID() public String getOwnVATID() {
{
return "DE136695976"; return "DE136695976";
} }
@Override @Override
public String getOwnZIP() public String getOwnZIP() {
{
return "12345"; return "12345";
} }
@Override @Override
public IZUGFeRDExportableContact getRecipient() public IZUGFeRDExportableContact getRecipient() {
{
return new Contact(); return new Contact();
} }
@Override @Override
public String getOwnOrganisationFullPlaintextInfo() public String getOwnOrganisationFullPlaintextInfo() {
{
return null; return null;
} }
@Override @Override
public String getCurrency() public String getCurrency() {
{
return "EUR"; return "EUR";
} }
@Override @Override
public IZUGFeRDExportableItem[] getZFItems() public IZUGFeRDExportableItem[] getZFItems() {
{
Item[] allItems = new Item[3]; Item[] allItems = new Item[3];
Product designProduct = new Product("", "Künstlerische Gestaltung (Stunde): Einer Beispielrechnung", "HUR", new BigDecimal("7.000000")); Product designProduct = new Product("", "Künstlerische Gestaltung (Stunde): Einer Beispielrechnung", "HUR", new BigDecimal("7.000000"));
Product balloonProduct = new Product("", "Luftballon: Bunt, ca. 500ml", "C62", new BigDecimal("19.000000")); Product balloonProduct = new Product("", "Luftballon: Bunt, ca. 500ml", "C62", new BigDecimal("19.000000"));
@@ -195,51 +175,42 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
return null; return null;
} }
class Contact implements IZUGFeRDExportableContact class Contact implements IZUGFeRDExportableContact {
{
@Override @Override
public String getCountry() public String getCountry() {
{
return "DE"; return "DE";
} }
@Override @Override
public String getLocation() public String getLocation() {
{
return "Spielkreis"; return "Spielkreis";
} }
@Override @Override
public String getName() public String getName() {
{
return "Theodor Est"; return "Theodor Est";
} }
@Override @Override
public String getStreet() public String getStreet() {
{
return "Bahnstr. 42"; return "Bahnstr. 42";
} }
@Override @Override
public String getVATID() public String getVATID() {
{
return "DE999999999"; return "DE999999999";
} }
@Override @Override
public String getZIP() public String getZIP() {
{
return "88802"; return "88802";
} }
} }
class Item implements IZUGFeRDExportableItem class Item implements IZUGFeRDExportableItem {
{
public Item(BigDecimal price, BigDecimal quantity, Product product) public Item(BigDecimal price, BigDecimal quantity, Product product) {
{
super(); super();
this.price = price; this.price = price;
this.quantity = quantity; this.quantity = quantity;
@@ -250,35 +221,29 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
private Product product; private Product product;
@Override @Override
public BigDecimal getPrice() public BigDecimal getPrice() {
{
return price; return price;
} }
public void setPrice(BigDecimal price) public void setPrice(BigDecimal price) {
{
this.price = price; this.price = price;
} }
@Override @Override
public BigDecimal getQuantity() public BigDecimal getQuantity() {
{
return quantity; return quantity;
} }
public void setQuantity(BigDecimal quantity) public void setQuantity(BigDecimal quantity) {
{
this.quantity = quantity; this.quantity = quantity;
} }
@Override @Override
public Product getProduct() public Product getProduct() {
{
return product; return product;
} }
public void setProduct(Product product) public void setProduct(Product product) {
{
this.product = product; this.product = product;
} }
@@ -294,13 +259,11 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
} }
class Product implements IZUGFeRDExportableProduct class Product implements IZUGFeRDExportableProduct {
{
private String description, name, unit; private String description, name, unit;
private BigDecimal VATPercent; private BigDecimal VATPercent;
public Product(String description, String name, String unit, BigDecimal VATPercent) public Product(String description, String name, String unit, BigDecimal VATPercent) {
{
super(); super();
this.description = description; this.description = description;
this.name = name; this.name = name;
@@ -309,46 +272,38 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
} }
@Override @Override
public String getDescription() public String getDescription() {
{
return description; return description;
} }
public void setDescription(String description) public void setDescription(String description) {
{
this.description = description; this.description = description;
} }
@Override @Override
public String getName() public String getName() {
{
return name; return name;
} }
public void setName(String name) public void setName(String name) {
{
this.name = name; this.name = name;
} }
@Override @Override
public String getUnit() public String getUnit() {
{
return unit; return unit;
} }
public void setUnit(String unit) public void setUnit(String unit) {
{
this.unit = unit; this.unit = unit;
} }
@Override @Override
public BigDecimal getVATPercent() public BigDecimal getVATPercent() {
{
return VATPercent; return VATPercent;
} }
public void setVATPercent(BigDecimal vATPercent) public void setVATPercent(BigDecimal vATPercent) {
{
VATPercent = vATPercent; VATPercent = vATPercent;
} }
@@ -357,19 +312,16 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
/** /**
* Create the test case * Create the test case
* *
* @param testName * @param testName name of the test case
* name of the test case
*/ */
public MustangReaderWriterEdgeTest(String testName) public MustangReaderWriterEdgeTest(String testName) {
{
super(testName); super(testName);
} }
/** /**
* @return the suite of tests being tested * @return the suite of tests being tested
*/ */
public static Test suite() public static Test suite() {
{
return new TestSuite(MustangReaderWriterEdgeTest.class); return new TestSuite(MustangReaderWriterEdgeTest.class);
} }
@@ -383,8 +335,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
* @throws IOException * @throws IOException
*/ */
public void testAImport() throws IOException public void testAImport() throws IOException {
{
ZUGFeRDImporter zi = new ZUGFeRDImporter(); ZUGFeRDImporter zi = new ZUGFeRDImporter();
zi.extractLowLevel(this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf")); zi.extractLowLevel(this.getClass().getResourceAsStream("/MustangGnuaccountingBeispielRE-20170509_505.pdf"));
// Reading ZUGFeRD // Reading ZUGFeRD
@@ -398,8 +349,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
String ref = null; String ref = null;
String dueDate = null; String dueDate = null;
if (zi.canParse()) if (zi.canParse()) {
{
zi.parse(); zi.parse();
amount = zi.getAmount(); amount = zi.getAmount();
bic = zi.getBIC(); bic = zi.getBIC();
@@ -463,8 +413,7 @@ public class MustangReaderWriterEdgeTest extends TestCase implements IZUGFeRDExp
String holder = null; String holder = null;
String ref = null; String ref = null;
if (zi.canParse()) if (zi.canParse()) {
{
zi.parse(); zi.parse();
amount = zi.getAmount(); amount = zi.getAmount();
bic = zi.getBIC(); bic = zi.getBIC();

View File

@@ -18,6 +18,12 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@@ -27,11 +33,6 @@ import java.text.SimpleDateFormat;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
@FixMethodOrder(MethodSorters.NAME_ASCENDING) @FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExportableTransaction { public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExportableTransaction {
@@ -319,8 +320,7 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
/** /**
* Create the test case * Create the test case
* *
* @param testName * @param testName name of the test case
* name of the test case
*/ */
public MustangReaderWriterTest(String testName) { public MustangReaderWriterTest(String testName) {
super(testName); super(testName);
@@ -475,7 +475,6 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
} }
public void testMigratePDFA1ToA3() throws IOException { public void testMigratePDFA1ToA3() throws IOException {
// just make sure there is no Exception // just make sure there is no Exception
InputStream SOURCE_PDF = this.getClass() InputStream SOURCE_PDF = this.getClass()
@@ -553,8 +552,8 @@ public class MustangReaderWriterTest extends TestCase implements IZUGFeRDExporta
} }
/** /**
* @Test(expected = IndexOutOfBoundsException.class)
* @throws Exception * @throws Exception
* @Test(expected = IndexOutOfBoundsException.class)
*/ */
public void testExceptionOnPDF14() throws Exception { public void testExceptionOnPDF14() throws Exception {

View File

@@ -16,13 +16,7 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import java.io.File; import java.io.*;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.nio.charset.Charset; import java.nio.charset.Charset;
@@ -32,18 +26,23 @@ import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
/**
/** This test utility class is providing usability functions for test file resources */ * This test utility class is providing usability functions for test file resources
*/
public class ResourceUtilities { public class ResourceUtilities {
private static final Logger LOG = Logger.getLogger(ResourceUtilities.class.getName()); private static final Logger LOG = Logger.getLogger(ResourceUtilities.class.getName());
/** Loading a File into a String using a certain encoding and file path */ /**
* Loading a File into a String using a certain encoding and file path
*/
public static String readFile(Charset encoding, String path) throws IOException { public static String readFile(Charset encoding, String path) throws IOException {
byte[] content = Files.readAllBytes(Paths.get(path)); byte[] content = Files.readAllBytes(Paths.get(path));
return new String(content, encoding); return new String(content, encoding);
} }
/** Saving a String as a file to a certain file path */ /**
* Saving a String as a file to a certain file path
*/
public static void saveFile(Charset encoding, String path, String content) throws FileNotFoundException { public static void saveFile(Charset encoding, String path, String content) throws FileNotFoundException {
// resources will be released automatically // resources will be released automatically
@@ -53,7 +52,9 @@ public class ResourceUtilities {
} }
/** The relative path of the test file will be resolved and the absolute will be returned /**
* The relative path of the test file will be resolved and the absolute will be returned
*
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>. * @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
* @return the absolute path of the test file * @return the absolute path of the test file
* @throws FileNotFoundException If the file could not be found * @throws FileNotFoundException If the file could not be found
@@ -72,7 +73,9 @@ public class ResourceUtilities {
return uri.getPath(); return uri.getPath();
} }
/** The relative path of the test file will be resolved and the absolute will be returned /**
* The relative path of the test file will be resolved and the absolute will be returned
*
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>. * @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
* @return the URI created based on the relativeFilePath * @return the URI created based on the relativeFilePath
* @throws URISyntaxException if no URI could be created from the given relative path * @throws URISyntaxException if no URI could be created from the given relative path
@@ -83,8 +86,10 @@ public class ResourceUtilities {
return new URI(filePath); return new URI(filePath);
} }
/** The relative path of the test file will be used to determine an absolute /**
* The relative path of the test file will be used to determine an absolute
* path to a temporary directory in the output directory. * path to a temporary directory in the output directory.
*
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>. * @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
* @return absolute path to a test output * @return absolute path to a test output
* @throws IOException if no absolute Path could be created. * @throws IOException if no absolute Path could be created.
@@ -95,7 +100,9 @@ public class ResourceUtilities {
return tempFile.getAbsolutePath(); return tempFile.getAbsolutePath();
} }
/** The Input of the test file will be resolved and the absolute will be returned /**
* The Input of the test file will be resolved and the absolute will be returned
*
* @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>. * @param relativeFilePath Path of the test resource relative to <code>src/test/resource/</code>.
* @return the absolute path of the test file * @return the absolute path of the test file
*/ */
@@ -103,7 +110,9 @@ public class ResourceUtilities {
return ResourceUtilities.class.getClassLoader().getResourceAsStream(relativeFilePath); return ResourceUtilities.class.getClassLoader().getResourceAsStream(relativeFilePath);
} }
/** Relative to the test output directory a test file will be returned dependent on the relativeFilePath provided. /**
* Relative to the test output directory a test file will be returned dependent on the relativeFilePath provided.
*
* @param relativeFilePath Path of the test output resource relative to <code>target/test-classes/</code>. * @param relativeFilePath Path of the test output resource relative to <code>target/test-classes/</code>.
* @return the empty <code>File</code> of the test output (to be filled) * @return the empty <code>File</code> of the test output (to be filled)
*/ */
@@ -193,6 +202,7 @@ public class ResourceUtilities {
} }
return ret; return ret;
} }
private ResourceUtilities() { private ResourceUtilities() {
} }
} }

View File

@@ -16,20 +16,24 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.transform.TransformerException;
import org.junit.Assert; import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.junit.runners.Parameterized; import org.junit.runners.Parameterized;
import org.xmlunit.builder.DiffBuilder;
import org.xmlunit.diff.Diff;
import javax.xml.transform.TransformerException;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import static org.junit.Assert.assertFalse;
/** /**
@@ -37,7 +41,7 @@ import org.junit.runners.Parameterized;
* will be migrated to <code>src/test/resources/migration/output</code>. * will be migrated to <code>src/test/resources/migration/output</code>.
* If there is a similar named file as test reference <code>src/test/resources/migration/reference</code> a test * If there is a similar named file as test reference <code>src/test/resources/migration/reference</code> a test
* will be triggered for every single file. * will be triggered for every single file.
* * <p/>
* Note: Any 'ZUGFeRD1' will be exchanged to 'ZUGFeRD2' during migration and adequate reference will be searched for. * Note: Any 'ZUGFeRD1' will be exchanged to 'ZUGFeRD2' during migration and adequate reference will be searched for.
*/ */
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@@ -68,9 +72,8 @@ public class VersionMigrationTest {
} }
private static void addFilesFromFolder(final File folder, Collection<Object[]> testSuiteData) { private static void addFilesFromFolder(final File folder, Collection<Object[]> testSuiteData) {
String filePath = null;
for (final File fileEntry : folder.listFiles()) { for (final File fileEntry : folder.listFiles()) {
filePath = fileEntry.getAbsolutePath(); String filePath = fileEntry.getAbsolutePath();
if (fileEntry.isDirectory()) { if (fileEntry.isDirectory()) {
LOG.log(Level.INFO, "*** testDirectory:{0}", filePath); LOG.log(Level.INFO, "*** testDirectory:{0}", filePath);
addFilesFromFolder(fileEntry, testSuiteData); addFilesFromFolder(fileEntry, testSuiteData);
@@ -99,20 +102,8 @@ public class VersionMigrationTest {
// we need to save the string and reload it otherwise two bytes are missing (likely EOF related) // we need to save the string and reload it otherwise two bytes are missing (likely EOF related)
String outXML = ResourceUtilities.readFile(StandardCharsets.UTF_8, OUTPUT_DIR + newName); String outXML = ResourceUtilities.readFile(StandardCharsets.UTF_8, OUTPUT_DIR + newName);
String refXML = ResourceUtilities.readFile(StandardCharsets.UTF_8, REFERENCE_DIR + newName); String refXML = ResourceUtilities.readFile(StandardCharsets.UTF_8, REFERENCE_DIR + newName);
int t = outXML.length(); Diff myDiff = DiffBuilder.compare(refXML).withTest(outXML).checkForSimilar().ignoreComments().ignoreWhitespace().build();
int r = refXML.length(); assertFalse(myDiff.toString(), myDiff.hasDifferences());
if (t != r || !(outXML.equals(refXML))) {
LOG.info("There are differences between:"
+ "\nZUGFeRD 2.0 Test Output @ " + OUTPUT_DIR + newName
+ "\nZUGFeRD 2.0 Test Reference @ " + REFERENCE_DIR + newName);
LOG.info("\n\nFile sizes:\n "
+ "\nZUGFeRD 2.0 Test Output character count: " + t
+ "\nZUGFeRD 2.0 Test Refer. character count: " + r);
findLineDiffs(outXML, refXML);
Assert.fail("Version update failed, as test result and reference are different!");
}else{
LOG.log(Level.INFO,"\n*** Tested successfull migration from ZUGFeRD 1.0 to 2.0: '" + newName + "'' ***\n", OUTPUT_DIR);
}
} else { } else {
LOG.log(Level.INFO, "\n*** Migrated from ZUGFeRD 1.0 to 2.0 invoice: '" + newName + "'' ***\n", OUTPUT_DIR); LOG.log(Level.INFO, "\n*** Migrated from ZUGFeRD 1.0 to 2.0 invoice: '" + newName + "'' ***\n", OUTPUT_DIR);
} }
@@ -122,23 +113,4 @@ public class VersionMigrationTest {
} }
} }
private static void findLineDiffs(String outXML, String refXML){
Scanner outScanner = new Scanner(outXML);
Scanner refScanner = new Scanner(refXML);
String outLine = null;
String refLine = null;
while (outScanner.hasNextLine() && refScanner.hasNextLine()) {
outLine = outScanner.nextLine();
refLine = refScanner.nextLine();
if(!outLine.equals(refLine)){
LOG.info("First line difference between reference and output file:" +
"\nRefLine: " + refLine +
"\nOutLine: " + outLine + "\n");
}
}
refScanner.close();
outScanner.close();
}
} }

View File

@@ -18,12 +18,13 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import org.junit.Test;
import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType;
import javax.xml.bind.JAXBElement;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import javax.xml.bind.JAXBElement;
import org.junit.Test;
import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType;
public class ZUGFeRDTransactionModelConverterTest { public class ZUGFeRDTransactionModelConverterTest {
@Test @Test

View File

@@ -18,17 +18,17 @@
*********************************************************************** */ *********************************************************************** */
package org.mustangproject.ZUGFeRD; package org.mustangproject.ZUGFeRD;
import com.helger.commons.state.EValidity;
import com.helger.schematron.ISchematronResource; import com.helger.schematron.ISchematronResource;
import com.helger.schematron.pure.SchematronResourcePure; import com.helger.schematron.pure.SchematronResourcePure;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.parsers.DocumentBuilderFactory;
import org.junit.Assert; import org.junit.Assert;
import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType; import org.mustangproject.ZUGFeRD.model.CrossIndustryDocumentType;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.parsers.DocumentBuilderFactory;
public class ZUGFeRDXMLAssert { public class ZUGFeRDXMLAssert {
private static final ISchematronResource SCHEMATRON = loadSchematron(); private static final ISchematronResource SCHEMATRON = loadSchematron();

View File

@@ -15,7 +15,10 @@
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.
--> -->
<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"> <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">
<rsm:SpecifiedExchangedDocumentContext> <rsm:SpecifiedExchangedDocumentContext>
<ram:TestIndicator> <ram:TestIndicator>
<udt:Indicator>false</udt:Indicator> <udt:Indicator>false</udt:Indicator>

View File

@@ -15,7 +15,10 @@
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.
--> -->
<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"> <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">
<rsm:SpecifiedExchangedDocumentContext> <rsm:SpecifiedExchangedDocumentContext>
<ram:TestIndicator> <ram:TestIndicator>
<udt:Indicator>false</udt:Indicator> <udt:Indicator>false</udt:Indicator>

View File

@@ -18,9 +18,9 @@
<rsm:CrossIndustryInvoice xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100" <rsm:CrossIndustryInvoice xmlns:rsm="urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100"
xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100" xmlns:ram="urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100"
xmlns:qdt="urn:un:unece:uncefact:data:Standard:QualifiedDataType:100" xmlns:qdt="urn:un:unece:uncefact:data:Standard:QualifiedDataType:100"
xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100"><!-- xmlns:udt="urn:un:unece:uncefact:data:standard:UnqualifiedDataType:100">
Migrated by Mustangproject XSLT <!--Migrated by Mustangproject XSLT-->
--><rsm:ExchangedDocumentContext> <rsm:ExchangedDocumentContext>
<ram:TestIndicator> <ram:TestIndicator>
<udt:Indicator>false</udt:Indicator> <udt:Indicator>false</udt:Indicator>
</ram:TestIndicator> </ram:TestIndicator>