diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml index 17132792..aaf4986f 100644 --- a/Mustang-CLI/pom.xml +++ b/Mustang-CLI/pom.xml @@ -1,215 +1,87 @@ + 4.0.0 org.mustangproject core 2.13.0-SNAPSHOT - 4.0.0 + Mustang-CLI - e-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation - should also work for XRechnung/CII. - jar + E-Invoice commandline tool + + + E-invoices commandline tool, allowing to create(embed), split and validate Factur-X/ZUGFeRD files. Validation + should also work for XRechnung/CII. + + - UTF-8 - 11 - 11 + org.mustangproject validator - 2.13.0-SNAPSHOT - + ${project.version} + - + + commons-cli commons-cli - 1.8.0 + ${dep.commons-cli.version} org.junit.jupiter junit-jupiter-api - 5.10.2 - test + - org.junit.vintage - junit-vintage-engine - 5.10.2 - test - - - - org.xmlunit + org.xmlunit xmlunit-core - 2.10.0 + compile + org.xmlunit xmlunit-assertj - 2.10.0 + compile - - - jakarta.xml.bind - jakarta.xml.bind-api - 4.0.2 + org.junit.vintage + junit-vintage-engine - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - - org.apache.maven.plugins maven-surefire-plugin - - alphabetical - - org.apache.maven.plugins maven-jar-plugin - 3.4.2 - - - - true - true - - - - org.apache.maven.plugins maven-compiler-plugin - 2.3.2 - - 11 - 11 - org.apache.maven.plugins maven-shade-plugin - 3.5.3 org.mustangproject.commandline.Main - false - - - *:* - - LICENSE - NOTICE - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - commons-logging:commons-logging - - ** - - - - - - package - - shade - - - - - - - - - - - release-sign-artifacts - - - performRelease - true - - - - - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 11 - adopt - - - - - - - - - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - A business-friendly OSS license - - - - - Jochen Stärk - jstaerk@usegroup.de - - architect - developer - - - diff --git a/library/pom.xml b/library/pom.xml index f4e24d68..66684cac 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -1,178 +1,143 @@ + + 4.0.0 org.mustangproject core 2.13.0-SNAPSHOT - - 4.0.0 library jar - Library to write, read and validate e-invoices (Factur-X, ZUGFeRD, Order-X, XRechnung/CII) - FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT + + Mustang Library to r/w e-invoices + + + FOSS Java library to read, write and validate european electronic invoices and orders in the UN/CEFACT Cross Industry Invoice based formats Factur-X/ZUGFeRD, XRechnung and Order-X in your invoice PDFs. - http://www.mustangproject.org/ - - scm:git:https://github.com/ZUGFeRD/mustangproject.git - scm:git:https://github.com/ZUGFeRD/mustangproject.git - https://github.com/ZUGFeRD/mustangproject - core-2.3.2 - - - - sonatype-oss-public - https://oss.sonatype.org/content/groups/public/ - - true - - - true - - - - - - internal.repo - Temporary Staging Repository - file://${project.build.directory}/mvn-repo - - + - UTF-8 - github - -Xdoclint:none - - 11 - 11 - true - + org.slf4j slf4j-api - 2.0.9 + net.sf.saxon Saxon-HE - 12.4 - + ${dep.saxon-he.version} + + + com.fasterxml.jackson.core jackson-databind - 2.17.1 + ${dep.jackson.version} + org.apache.xmlgraphics fop - 2.9 + ${dep.apache.fop.version} - - xml-apis - xml-apis - + + xml-apis + xml-apis + jakarta.xml.bind jakarta.xml.bind-api - 4.0.2 + ${dep.jakarta.xml-bind.version} + org.eclipse.angus angus-activation - 2.0.2 + ${dep.angus.version} org.apache.pdfbox preflight - 3.0.2 + ${dep.pdfbox.version} + org.apache.pdfbox pdfbox - 3.0.2 + ${dep.pdfbox.version} + org.dom4j dom4j - 2.1.4 + ${dep.dom4j.version} - - org.junit.jupiter - junit-jupiter-api - 5.10.2 - test - - - org.junit.vintage - junit-vintage-engine - 5.10.2 - test - - + com.helger en16931-cii2ubl - 2.2.4 + ${dep.en16931-cii2ubl.version} + org.glassfish.jaxb jaxb-runtime - 4.0.5 + ${dep.jaxb-runtime.version} + + + + org.junit.jupiter + junit-jupiter-api + + + + org.junit.vintage + junit-vintage-engine org.xmlunit xmlunit-core - 2.10.0 - test org.xmlunit xmlunit-assertj - 2.10.0 - test + org.slf4j slf4j-simple - 2.0.9 - test + org.apache.maven.plugins maven-surefire-plugin - - alphabetical - + org.apache.maven.plugins maven-compiler-plugin - 3.13.0 - - 11 - 11 - + org.apache.maven.plugins maven-jar-plugin - 3.2.0 **/logback.xml @@ -204,26 +169,19 @@ + org.apache.maven.plugins maven-source-plugin - 3.3.1 - - - attach-sources - - jar-no-fork - - - + org.apache.maven.plugins maven-shade-plugin - 3.5.3 true - false + false + *:* @@ -243,100 +201,19 @@ - package shade + package - - + - - org.codehaus.mojo - templating-maven-plugin - 1.0.0 - - - filtering-java-templates - - filter-sources - - - - - - - - release-sign-artifacts - - - performRelease - true - - - - - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 11 - adopt - - - - - - - - - - - User List - https://groups.google.com/forum/?hl=de#!forum/mustangproject - - - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - A business-friendly OSS license - - - - - Jochen Stärk - jstaerk@usegroup.de - - architect - developer - - - - Alexander Schmidt - schmidt.alexander@mail.de - - developer - - - diff --git a/library/src/main/java/org/mustangproject/Item.java b/library/src/main/java/org/mustangproject/Item.java index 321b4723..d4d417c6 100644 --- a/library/src/main/java/org/mustangproject/Item.java +++ b/library/src/main/java/org/mustangproject/Item.java @@ -26,6 +26,7 @@ public class Item implements IZUGFeRDExportableItem { protected Product product; protected ArrayList notes = null; protected ArrayList referencedDocuments = null; + protected ArrayList additionalReference = null; protected ArrayList Allowances = new ArrayList<>(), Charges = new ArrayList<>(); @@ -63,6 +64,7 @@ public class Item implements IZUGFeRDExportableItem { String referencedLineID = null; ArrayList rdocs = null; + ArrayList addRefs = null; // nodes.item(i).getTextContent())) { @@ -248,6 +250,35 @@ public class Item implements IZUGFeRDExportableItem { } } } + + if (tradeSettlementName.equals("AdditionalReferencedDocument")) { + String IssuerAssignedID = ""; + String TypeCode = ""; + String ReferenceTypeCode = ""; + + NodeList refDocChilds = tradeSettlementChilds.item(tradeSettlementChildIndex).getChildNodes(); + for (int refDocIndex = 0; refDocIndex < refDocChilds.getLength(); refDocIndex++) { + String localName = refDocChilds.item(refDocIndex).getLocalName(); + if ((localName != null) && (localName.equals("IssuerAssignedID"))) { + IssuerAssignedID = refDocChilds.item(refDocIndex).getTextContent(); + } + if ((localName != null) && (localName.equals("TypeCode"))) { + TypeCode = refDocChilds.item(refDocIndex).getTextContent(); + } + if ((localName != null) && (localName.equals("ReferenceTypeCode"))) { + ReferenceTypeCode = refDocChilds.item(refDocIndex).getTextContent(); + } + } + + ReferencedDocument rd = new ReferencedDocument(IssuerAssignedID, TypeCode, + ReferenceTypeCode); + if (addRefs == null) { + addRefs = new ArrayList<>(); + } + addRefs.add(rd); + + } + } } } @@ -274,6 +305,11 @@ public class Item implements IZUGFeRDExportableItem { addReferencedDocument(rdoc); } } + if (addRefs != null) { + for (ReferencedDocument rdoc : addRefs) { + addAdditionalReference(rdoc); + } + } addReferencedLineID( referencedLineID ); } @@ -465,6 +501,29 @@ public class Item implements IZUGFeRDExportableItem { return referencedDocuments.toArray(new IReferencedDocument[0]); } + + /*** + * adds item level references along with their typecodes and issuerassignedIDs (contract ID, cost centre, ...) + * @param doc the ReferencedDocument to add + * @return fluent setter + */ + public Item addAdditionalReference(ReferencedDocument doc) { + if (additionalReference == null) { + additionalReference = new ArrayList<>(); + } + additionalReference.add(doc); + return this; + } + + @Override + public IReferencedDocument[] getAdditionalReferences() { + if (additionalReference == null) { + return null; + } + return additionalReference.toArray(new IReferencedDocument[0]); + } + + /*** * specify a item level delivery period * (apart from the document level delivery period, and the document level diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java index f6e03242..e5e25cae 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java @@ -92,12 +92,22 @@ public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{ /*** * the ID of an additionally referenced document for this item + * @deprecated use {@link #getAdditionalReferences()} instead. * @return the id as string */ + @Deprecated default String getAdditionalReferencedDocumentID() { return null; } + /*** + * allows to specify multiple references (billing information) + * @return the referenced documents + */ + default IReferencedDocument[] getAdditionalReferences() { + return null; + } + /*** * allows to specify multiple(!) referenced documents along with e.g. their typecodes diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java index ba43dd94..b98abebc 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD1PullProvider.java @@ -387,9 +387,10 @@ public class ZUGFeRD1PullProvider extends ZUGFeRD2PullProvider { + "" + currencyFormat(lc.getItemTotalNetAmount()) + "" + ""; - if (currentItem.getAdditionalReferencedDocumentID() != null) { + if (currentItem.getAdditionalReferences() != null) { + xml += "" + currentItem.getAdditionalReferences()[0].getIssuerAssignedID() + "130"; + } else if (currentItem.getAdditionalReferencedDocumentID() != null) { xml += "" + currentItem.getAdditionalReferencedDocumentID() + "130"; - } xml += "" + ""; diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java index 64bfb738..eaefecaa 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java @@ -503,9 +503,16 @@ public class ZUGFeRD2PullProvider implements IXMLProvider { + "" + currencyFormat(lc.getItemTotalNetAmount()) + "" // currencyID=\"EUR\" + ""; - if (currentItem.getAdditionalReferencedDocumentID() != null) { + if (currentItem.getAdditionalReferences() != null) { + for (final IReferencedDocument currentReference : currentItem.getAdditionalReferences()) { + xml += "" + + "" + XMLTools.encodeXML(currentReference.getIssuerAssignedID()) + "" + + "130" + + "" + XMLTools.encodeXML(currentReference.getReferenceTypeCode()) + "" + + ""; + } + } else if (currentItem.getAdditionalReferencedDocumentID() != null) { xml += "" + currentItem.getAdditionalReferencedDocumentID() + "130"; - } xml += "" + ""; diff --git a/pom.xml b/pom.xml index b020447b..9355edf7 100644 --- a/pom.xml +++ b/pom.xml @@ -7,126 +7,44 @@ pom Mustang + + The Mustang project is a java library to read and write ZUGFeRD + meta data inside your invoice PDFs + + + http://www.mustangproject.org/ + library validator Mustang-CLI - - The Mustang project is a java library to read and write ZUGFeRD meta data inside your invoice PDFs - - http://www.mustangproject.org/ - - scm:git:git://github.com/dexecutor/dependent-tasks-executor.git - scm:git:git@github.com:dexecutor/dexecutor.git - https://github.com/dexecutor/dependent-tasks-executor - core-2.3.2 - - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - true - false - forked-path - -Dgpg.passphrase=${gpg.passphrase} - - - - org.apache.maven.scm - maven-scm-provider-gitexe - 1.9.5 - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - 3.0.1 - - - org.mustangproject.ZUGFeRD.model.* - - - - - maven-deploy-plugin - 3.0.0-M1 - - internal.repo::default::file://${project.build.directory}/mvn-repo - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 - true - - ossrh - https://s01.oss.sonatype.org/ - true - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.3.1 - - alphabetical - - - - org.apache.maven.plugins - maven-source-plugin - 3.2.1 - - - attach-javadoc - - - - - - - - - - ossrh - https://s01.oss.sonatype.org/content/repositories/snapshots - - - ossrh - https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ - - + UTF-8 github -Xdoclint:none - 11 11 - true + + 2.0.13 + 12.4 + 2.17.1 + 2.9 + 4.0.2 + 2.0.2 + 3.0.2 + 2.1.4 + 2.2.4 + 4.0.5 + 5.10.2 + 2.10.0 + + 1.9.0 + 1.26.1 + 8.0.0 - - - - User List - https://groups.google.com/forum/?hl=de#!forum/mustangproject - - + Apache-2.0 @@ -135,6 +53,7 @@ A business-friendly OSS license + Jochen Stärk @@ -152,11 +71,267 @@ + + + + User List + https://groups.google.com/forum/?hl=de#!forum/mustangproject + + + + + scm:git:https://github.com/ZUGFeRD/mustangproject.git + scm:git:https://github.com/ZUGFeRD/mustangproject.git + https://github.com/ZUGFeRD/mustangproject + + + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + + compile + + compile + + + ${maven.compiler.source} + + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + + org.apache.maven.plugins + maven-release-plugin + 3.1.1 + + true + false + forked-path + -Dgpg.passphrase=${gpg.passphrase} + + + + org.apache.maven.scm + maven-scm-provider-gitexe + 2.1.0 + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.8.0 + + org.mustangproject.ZUGFeRD.model.* + + + + + maven-deploy-plugin + 3.1.2 + + internal.repo::default::file://${project.build.directory}/mvn-repo + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.7.0 + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.3.1 + + alphabetical + + + + + org.apache.maven.plugins + maven-source-plugin + 3.3.1 + + + attach-sources + + jar-no-fork + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.4.2 + + + + true + true + + + + + + + test-jar + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.5.3 + + false + + + *:* + + LICENSE + NOTICE + META-INF/*.SF + META-INF/*.DSA + META-INF/*.RSA + + + + commons-logging:commons-logging + + ** + + + + + + + + shade + + package + + + + + + + + + + + org.codehaus.mojo + templating-maven-plugin + 3.0.0 + + + filtering-java-templates + + filter-sources + + + + + + + + + + org.codehaus.mojo + templating-maven-plugin + + + + + + + + org.slf4j + slf4j-api + ${dep.slf4j.version} + + + + jakarta.xml.bind + jakarta.xml.bind-api + ${dep.jakarta.xml-bind.version} + + + + org.junit.jupiter + junit-jupiter-api + ${dep.junit5.version} + test + + + + org.junit.vintage + junit-vintage-engine + ${dep.junit5.version} + test + + + + org.xmlunit + xmlunit-core + ${dep.xmlunit.version} + test + + + + org.xmlunit + xmlunit-assertj + ${dep.xmlunit.version} + test + + + + org.slf4j + slf4j-simple + ${dep.slf4j.version} + test + + + + + - - - - + release-sign-artifacts @@ -170,7 +345,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.6 + 3.2.4 sign-artifacts @@ -181,26 +356,6 @@ - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 11 - adopt - - - - diff --git a/validator/pom.xml b/validator/pom.xml index 0e934d03..f3f3a95a 100644 --- a/validator/pom.xml +++ b/validator/pom.xml @@ -1,33 +1,22 @@ + 4.0.0 org.mustangproject core 2.13.0-SNAPSHOT - 4.0.0 + validator - Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung) - jar - - - - sonatype-oss-public - https://oss.sonatype.org/content/groups/public/ - - true - - - true - - - + + E-Invoices Validator + + + Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung + + - UTF-8 - false - 11 - 11 @@ -35,155 +24,82 @@ library ${project.version} + jakarta.xml.bind jakarta.xml.bind-api - 4.0.2 - - org.verapdf validation-model-jakarta - 1.26.1 + ${dep.verapdf.validation-model-jakarta.version} + com.helger.schematron ph-schematron-xslt - 8.0.0 + ${dep.ph-schematron-xslt.version} + org.xmlunit xmlunit-core - 2.10.0 - test + org.xmlunit xmlunit-assertj - 2.10.0 - test + org.junit.jupiter junit-jupiter-api - 5.10.2 - test + org.junit.vintage junit-vintage-engine - 5.10.2 - test + org.slf4j slf4j-simple - 2.0.9 - test + - - - - - org.apache.maven.plugins - maven-release-plugin - 2.5.3 - - - org.apache.maven.plugins maven-surefire-plugin - - alphabetical - - + org.apache.maven.plugins maven-jar-plugin - 3.2.0 - - - **/logback.xml - - - - true - true - - - + org.apache.maven.plugins maven-compiler-plugin - 2.3.2 - - 11 - 11 - - + org.apache.maven.plugins maven-shade-plugin - 2.4.3 - - true - false - - - *:* - - LICENSE - NOTICE - META-INF/*.SF - META-INF/*.DSA - META-INF/*.RSA - - - - commons-logging:commons-logging - - ** - - - - - - - package - - shade - - - - - - - - + maven-resources-plugin - 3.1.0 copy-zf-schematron-xml-dependencies - compile copy-resources + compile ${basedir}/src/main/resources/xslt/ZF_221/ @@ -201,62 +117,11 @@ - - - Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - repo - A business-friendly OSS license - - - - - Jochen Stärk - jstaerk@usegroup.de - - architect - developer - - - - - release-sign-artifacts - - - performRelease - true - - - - - - org.apache.maven.plugins - maven-toolchains-plugin - 3.1.0 - - - - toolchain - - - - - - - 11 - adopt - - - - - - - - + + generateXSLTFromSchematron false @@ -266,7 +131,7 @@ com.helger.maven ph-schematron-maven-plugin - 8.0.0 + ${dep.ph-schematron-xslt.version} ${basedir}/src/main/resources/schematron ${basedir}/src/main/resources/xslt