From 22b76141c259a7290fc7d41bb85140f304613fe0 Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 18 Jun 2024 18:22:57 +0200 Subject: [PATCH 01/10] Updated to Jakarta + PDFBox 3.x --- Mustang-CLI/pom.xml | 6 +- library/pom.xml | 37 +++---- .../java/org/mustangproject/CII/CIIToUBL.java | 18 +-- .../ZUGFeRD/DAPullProvider.java | 5 +- .../ZUGFeRD/DXExporterFromA1.java | 20 ++-- .../ZUGFeRD/DXExporterFromA3.java | 41 +++++-- .../ZUGFeRD/EinLieferscheinExporter.java | 29 +---- .../org/mustangproject/ZUGFeRD/IExporter.java | 1 - .../ZUGFeRD/IZUGFeRDAllowanceCharge.java | 4 +- .../ZUGFeRD/IZUGFeRDCashDiscount.java | 2 - .../ZUGFeRD/IZUGFeRDExportableItem.java | 7 +- .../ZUGFeRD/IZUGFeRDExportableTradeParty.java | 2 - .../ZUGFeRD/IZUGFeRDExporter.java | 3 +- .../ZUGFeRD/IZUGFeRDLegalOrganisation.java | 5 - .../ZUGFeRD/JakartaUpdateMitigation.java | 104 ++++++++++++++++++ .../ZUGFeRD/OXExporterFromA1.java | 18 +-- .../ZUGFeRD/OXExporterFromA3.java | 45 +++++--- .../ZUGFeRD/OXPullProvider.java | 4 - .../org/mustangproject/ZUGFeRD/Profiles.java | 4 +- .../ZUGFeRD/UBLDAPullProvider.java | 26 ++--- .../mustangproject/ZUGFeRD/XMLUpgrader.java | 15 ++- .../ZUGFeRD/XMPSchemaPDFAExtensions.java | 10 +- .../mustangproject/ZUGFeRD/XRExporter.java | 29 +---- .../ZUGFeRD/XRechnungImporter.java | 5 +- .../ZUGFeRD/ZUGFeRDExporterFromA1.java | 18 +-- .../ZUGFeRD/ZUGFeRDExporterFromA3.java | 44 ++++++-- .../ZUGFeRD/ZUGFeRDExporterFromPDFA.java | 14 ++- .../ZUGFeRD/ZUGFeRDImporter.java | 12 +- .../ZUGFeRD/ZUGFeRDInvoiceImporter.java | 11 +- .../ZUGFeRD/ZUGFeRDVisualizer.java | 56 +++++++--- .../ZUGFeRD/MustangReaderWriterEdgeTest.java | 5 +- .../ZUGFeRD/MustangReaderWriterTest.java | 5 +- pom.xml | 10 +- validator/pom.xml | 8 +- 34 files changed, 390 insertions(+), 233 deletions(-) create mode 100644 library/src/main/java/org/mustangproject/ZUGFeRD/JakartaUpdateMitigation.java diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml index 5e4d939a..4ec10658 100644 --- a/Mustang-CLI/pom.xml +++ b/Mustang-CLI/pom.xml @@ -3,14 +3,14 @@ org.mustangproject core - 2.11.1-SNAPSHOT + 3.0.0-SNAPSHOT 4.0.0 org.mustangproject 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 - 2.11.1-SNAPSHOT + 3.0.0-SNAPSHOT UTF-8 8 @@ -21,7 +21,7 @@ org.mustangproject validator - 2.11.1-SNAPSHOT + 3.0.0-SNAPSHOT diff --git a/library/pom.xml b/library/pom.xml index 02a91571..8602afe9 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -3,13 +3,13 @@ org.mustangproject core - 2.11.1-SNAPSHOT + 3.0.0-SNAPSHOT 4.0.0 org.mustangproject library - 2.11.1-SNAPSHOT + 3.0.0-SNAPSHOT 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 Cross Industry Invoice based formats Factur-X/ZUGFeRD, XRechnung and Order-X in your invoice PDFs. @@ -56,12 +56,12 @@ net.sf.saxon Saxon-HE - 9.9.0-1 + 12.4 com.fasterxml.jackson.core jackson-databind - 2.14.2 + 2.17.1 @@ -71,36 +71,36 @@ - javax.activation - activation - 1.1.1 + org.eclipse.angus + angus-activation + 2.0.2 org.apache.pdfbox preflight - 2.0.27 + 3.0.2 org.apache.pdfbox pdfbox - 2.0.27 + 3.0.2 org.dom4j dom4j - 2.1.3 + 2.1.4 org.junit.jupiter junit-jupiter-api - 5.9.1 + 5.10.2 test org.junit.vintage junit-vintage-engine - 5.9.1 + 5.10.2 test @@ -108,13 +108,13 @@ com.helger en16931-cii2ubl - 1.4.10 + 2.2.4 org.glassfish.jaxb jaxb-runtime - 2.3.3 + 4.0.5 @@ -127,16 +127,9 @@ org.xmlunit xmlunit-assertj - 2.9.1 + 2.10.0 test - - - jakarta.xml.bind - jakarta.xml.bind-api - 2.3.3 - - diff --git a/library/src/main/java/org/mustangproject/CII/CIIToUBL.java b/library/src/main/java/org/mustangproject/CII/CIIToUBL.java index 733006a1..ff695f52 100644 --- a/library/src/main/java/org/mustangproject/CII/CIIToUBL.java +++ b/library/src/main/java/org/mustangproject/CII/CIIToUBL.java @@ -5,9 +5,9 @@ import java.io.Serializable; import com.helger.commons.error.list.ErrorList; import com.helger.en16931.cii2ubl.CIIToUBL23Converter; -import com.helger.ubl21.UBL21Writer; -import com.helger.ubl22.UBL22Writer; -import com.helger.ubl23.UBL23Writer; +import com.helger.ubl21.UBL21Marshaller; +import com.helger.ubl22.UBL22Marshaller; +import com.helger.ubl23.UBL23Marshaller; /*** * converts a Cross Industry Invoice XML file to a UBL XML file @@ -25,37 +25,37 @@ public class CIIToUBL { final Serializable aUBL = cc.convertCIItoUBL(input, occurred); if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.invoice_21.InvoiceType) { - UBL21Writer.invoice () + UBL21Marshaller.invoice () .setFormattedOutput (true) .write ((oasis.names.specification.ubl.schema.xsd.invoice_21.InvoiceType) aUBL, output); } else if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.creditnote_21.CreditNoteType) { - UBL21Writer.creditNote () + UBL21Marshaller.creditNote () .setFormattedOutput (true) .write ((oasis.names.specification.ubl.schema.xsd.creditnote_21.CreditNoteType) aUBL, output); } else if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.invoice_22.InvoiceType) { - UBL22Writer.invoice () + UBL22Marshaller.invoice () .setFormattedOutput (true) .write ((oasis.names.specification.ubl.schema.xsd.invoice_22.InvoiceType) aUBL, output); } else if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.creditnote_22.CreditNoteType) { - UBL22Writer.creditNote () + UBL22Marshaller.creditNote () .setFormattedOutput (true) .write ((oasis.names.specification.ubl.schema.xsd.creditnote_22.CreditNoteType) aUBL, output); } else if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.invoice_23.InvoiceType) { - UBL23Writer.invoice () + UBL23Marshaller.invoice () .setFormattedOutput (true) .write ((oasis.names.specification.ubl.schema.xsd.invoice_23.InvoiceType) aUBL, output); } else if (aUBL instanceof oasis.names.specification.ubl.schema.xsd.creditnote_23.CreditNoteType) { - UBL23Writer.creditNote () + UBL23Marshaller.creditNote () .setFormattedOutput (true) .write ((oasis.names.specification.ubl.schema.xsd.creditnote_23.CreditNoteType) aUBL, output); } diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/DAPullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/DAPullProvider.java index 36a564bc..7ae56ebd 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/DAPullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/DAPullProvider.java @@ -28,7 +28,10 @@ import java.util.Optional; import java.util.logging.Level; import java.util.logging.Logger; -import org.mustangproject.*; +import org.mustangproject.EStandard; +import org.mustangproject.FileAttachment; +import org.mustangproject.Invoice; +import org.mustangproject.XMLTools; public class DAPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider { diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/DXExporterFromA1.java b/library/src/main/java/org/mustangproject/ZUGFeRD/DXExporterFromA1.java index 7123cd39..2f9669a8 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/DXExporterFromA1.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/DXExporterFromA1.java @@ -19,13 +19,15 @@ package org.mustangproject.ZUGFeRD; +import java.io.IOException; +import java.io.InputStream; + import org.apache.pdfbox.preflight.PreflightDocument; +import org.apache.pdfbox.preflight.ValidationResult; import org.apache.pdfbox.preflight.exception.ValidationException; import org.apache.pdfbox.preflight.parser.PreflightParser; -import javax.activation.DataSource; -import java.io.IOException; -import java.io.InputStream; +import jakarta.activation.DataSource; public class DXExporterFromA1 extends DXExporterFromA3 implements IZUGFeRDExporter { protected boolean ignorePDFAErrors = false; @@ -36,7 +38,7 @@ public class DXExporterFromA1 extends DXExporterFromA3 implements IZUGFeRDExport } private static boolean isValidA1(DataSource dataSource) throws IOException { - return getPDFAParserValidationResult(new PreflightParser(dataSource)); + return getPDFAParserValidationResult(PreflightParserHelper.createPreflightParser (dataSource)); } /*** * internal helper function: get namespace for order-x @@ -65,19 +67,19 @@ public class DXExporterFromA1 extends DXExporterFromA3 implements IZUGFeRDExport * NonSequentialParser. Some additional controls are present to check a set of * PDF/A requirements. (Stream length consistency, EOL after some Keyword...) */ - parser.parse();// might add a Format.PDF_A1A as parameter and iterate through A1 and A3 - - try (PreflightDocument document = parser.getPreflightDocument()) { + // might add a Format.PDF_A1A as parameter and iterate through A1 and A3 + + try (PreflightDocument document = (PreflightDocument) parser.parse()) { /* * Once the syntax validation is done, the parser can provide a * PreflightDocument (that inherits from PDDocument) This document process the * end of PDF/A validation. */ - document.validate(); + ValidationResult res = document.validate(); // Get validation result - return document.getResult().isValid(); + return res.isValid(); } catch (ValidationException e) { /* * the parse method can throw a SyntaxValidationException if the PDF file can't diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/DXExporterFromA3.java b/library/src/main/java/org/mustangproject/ZUGFeRD/DXExporterFromA3.java index 1e22166c..50aff364 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/DXExporterFromA3.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/DXExporterFromA3.java @@ -20,16 +20,38 @@ */ package org.mustangproject.ZUGFeRD; -import org.apache.pdfbox.cos.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.transform.TransformerException; + +import org.apache.pdfbox.Loader; +import org.apache.pdfbox.cos.COSArray; +import org.apache.pdfbox.cos.COSBase; +import org.apache.pdfbox.cos.COSDictionary; +import org.apache.pdfbox.cos.COSName; +import org.apache.pdfbox.cos.COSObject; import org.apache.pdfbox.io.IOUtils; -import org.apache.pdfbox.pdmodel.*; +import org.apache.pdfbox.pdmodel.PDDocument; +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.filespecification.PDComplexFileSpecification; import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile; import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDMarkInfo; import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureTreeRoot; import org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent; -import org.apache.pdfbox.preflight.utils.ByteArrayDataSource; import org.apache.xmpbox.XMPMetadata; import org.apache.xmpbox.schema.AdobePDFSchema; import org.apache.xmpbox.schema.DublinCoreSchema; @@ -43,11 +65,8 @@ import org.apache.xmpbox.xml.XmpSerializer; import org.mustangproject.EStandard; import org.mustangproject.FileAttachment; -import javax.activation.DataSource; -import javax.activation.FileDataSource; -import javax.xml.transform.TransformerException; -import java.io.*; -import java.util.*; +import jakarta.activation.DataSource; +import jakarta.activation.FileDataSource; public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 { @@ -163,7 +182,7 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 { */ public DXExporterFromA3 load(byte[] pdfBinary) throws IOException { ensurePDFIsValid(new ByteArrayDataSource(new ByteArrayInputStream(pdfBinary))); - doc = PDDocument.load(pdfBinary); + doc = Loader.loadPDF(pdfBinary); return this; } @@ -542,13 +561,13 @@ public class DXExporterFromA3 extends ZUGFeRDExporterFromA3 { } protected PDFAIdentificationSchema getPDFAIdentificationSchema(XMPMetadata xmp) { - PDFAIdentificationSchema pdfaid = xmp.getPDFIdentificationSchema(); + PDFAIdentificationSchema pdfaid = xmp.getPDFAIdentificationSchema(); if (pdfaid != null) if (overwrite) xmp.removeSchema(pdfaid); else return pdfaid; - return xmp.createAndAddPFAIdentificationSchema(); + return xmp.createAndAddPDFAIdentificationSchema(); } protected void writeDublinCoreSchema(XMPMetadata xmp) { diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/EinLieferscheinExporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/EinLieferscheinExporter.java index 609755e1..b2e166e3 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/EinLieferscheinExporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/EinLieferscheinExporter.java @@ -20,31 +20,10 @@ */ package org.mustangproject.ZUGFeRD; -import org.apache.pdfbox.cos.*; -import org.apache.pdfbox.io.IOUtils; -import org.apache.pdfbox.pdmodel.*; -import org.apache.pdfbox.pdmodel.common.PDMetadata; -import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification; -import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile; -import org.apache.pdfbox.preflight.PreflightDocument; -import org.apache.pdfbox.preflight.exception.ValidationException; -import org.apache.pdfbox.preflight.parser.PreflightParser; -import org.apache.pdfbox.preflight.utils.ByteArrayDataSource; -import org.apache.xmpbox.XMPMetadata; -import org.apache.xmpbox.schema.AdobePDFSchema; -import org.apache.xmpbox.schema.DublinCoreSchema; -import org.apache.xmpbox.schema.PDFAIdentificationSchema; -import org.apache.xmpbox.schema.XMPBasicSchema; -import org.apache.xmpbox.type.BadFieldValueException; -import org.apache.xmpbox.xml.XmpSerializer; - -import javax.activation.DataSource; -import javax.activation.FileDataSource; -import javax.xml.transform.TransformerException; -import java.io.*; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Map; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; public class EinLieferscheinExporter implements IExporter { IXMLProvider xmlProvider; diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IExporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IExporter.java index 095037a4..7f30f81b 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IExporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IExporter.java @@ -18,7 +18,6 @@ *********************************************************************** */ package org.mustangproject.ZUGFeRD; -import java.io.Closeable; import java.io.IOException; import java.io.OutputStream; diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDAllowanceCharge.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDAllowanceCharge.java index fe854be7..75b01a67 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDAllowanceCharge.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDAllowanceCharge.java @@ -15,10 +15,10 @@ */ package org.mustangproject.ZUGFeRD; -import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants; - import java.math.BigDecimal; +import org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants; + /** * The interface for allowances or charges, to be used by the pullprovider * @author AlexanderSchmidt diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDCashDiscount.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDCashDiscount.java index 90040a50..5d5fff13 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDCashDiscount.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDCashDiscount.java @@ -1,7 +1,5 @@ package org.mustangproject.ZUGFeRD; -import org.mustangproject.XMLTools; - public interface IZUGFeRDCashDiscount { diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java index 1a2b5300..53cc71b1 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableItem.java @@ -26,12 +26,13 @@ package org.mustangproject.ZUGFeRD; * @author jstaerk * */ -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import org.mustangproject.Item; - import java.math.BigDecimal; import java.util.Date; +import org.mustangproject.Item; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; + @JsonDeserialize(as = Item.class) public interface IZUGFeRDExportableItem extends IAbsoluteValueProvider{ IZUGFeRDExportableProduct getProduct(); diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableTradeParty.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableTradeParty.java index e097ad86..8af10dbb 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableTradeParty.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExportableTradeParty.java @@ -20,8 +20,6 @@ */ package org.mustangproject.ZUGFeRD; -import org.mustangproject.TradeParty; - /** * Mustangproject's ZUGFeRD implementation neccessary interface for ZUGFeRD exporter Licensed under the APLv2 * diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExporter.java index cff98744..f056da5c 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDExporter.java @@ -18,11 +18,12 @@ *********************************************************************** */ package org.mustangproject.ZUGFeRD; -import javax.activation.DataSource; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; +import jakarta.activation.DataSource; + public interface IZUGFeRDExporter extends Closeable, IExporter { /** * factory: loads a PDF file and returns an appropriate exporter diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDLegalOrganisation.java b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDLegalOrganisation.java index 3ba722d9..9de017cf 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDLegalOrganisation.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/IZUGFeRDLegalOrganisation.java @@ -18,11 +18,6 @@ *********************************************************************** */ package org.mustangproject.ZUGFeRD; -import javax.activation.DataSource; -import java.io.Closeable; -import java.io.IOException; -import java.io.InputStream; - public interface IZUGFeRDLegalOrganisation { /*** diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/JakartaUpdateMitigation.java b/library/src/main/java/org/mustangproject/ZUGFeRD/JakartaUpdateMitigation.java new file mode 100644 index 00000000..203b5b45 --- /dev/null +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/JakartaUpdateMitigation.java @@ -0,0 +1,104 @@ +package org.mustangproject.ZUGFeRD; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.EOFException; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.RandomAccessFile; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.apache.pdfbox.io.IOUtils; +import org.apache.pdfbox.io.RandomAccessRead; +import org.apache.pdfbox.io.RandomAccessReadBuffer; +import org.apache.pdfbox.preflight.parser.PreflightParser; + +import jakarta.activation.DataSource; + +// Copied from PDFBox preflight 2.0.x +final class ByteArrayDataSource implements DataSource +{ + private ByteArrayOutputStream data; + private String type = null; + private String name = null; + + public ByteArrayDataSource (InputStream is) throws IOException + { + data = new ByteArrayOutputStream (); + IOUtils.copy (is, data); + IOUtils.closeQuietly (is); + } + + public String getContentType () + { + return this.type; + } + + /** + * @param type + * the type to set + */ + public void setType (String type) + { + this.type = type; + } + + /** + * @param name + * the name to set + */ + public void setName (String name) + { + this.name = name; + } + + public InputStream getInputStream () throws IOException + { + return new ByteArrayInputStream (data.toByteArray ()); + } + + public String getName () + { + return this.name; + } + + public OutputStream getOutputStream () throws IOException + { + this.data = new ByteArrayOutputStream (); + return data; + } +} + +final class PreflightParserHelper +{ + private static File createTmpFile (InputStream input) throws IOException + { + FileOutputStream fos = null; + try + { + File tmpFile = File.createTempFile ("mustang-pdf", ".pdf"); + fos = new FileOutputStream (tmpFile); + IOUtils.copy (input, fos); + return tmpFile; + } + finally + { + IOUtils.closeQuietly (input); + IOUtils.closeQuietly (fos); + } + } + + public static PreflightParser createPreflightParser (DataSource dataSource) throws IOException + { + return new PreflightParser (createTmpFile (dataSource.getInputStream ())); + } +} + +final class JakartaUpdateMitigation +{ + // Dummy for the name only +} diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/OXExporterFromA1.java b/library/src/main/java/org/mustangproject/ZUGFeRD/OXExporterFromA1.java index 1805cc95..4b91f192 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/OXExporterFromA1.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/OXExporterFromA1.java @@ -19,13 +19,15 @@ package org.mustangproject.ZUGFeRD; +import java.io.IOException; +import java.io.InputStream; + import org.apache.pdfbox.preflight.PreflightDocument; +import org.apache.pdfbox.preflight.ValidationResult; import org.apache.pdfbox.preflight.exception.ValidationException; import org.apache.pdfbox.preflight.parser.PreflightParser; -import javax.activation.DataSource; -import java.io.IOException; -import java.io.InputStream; +import jakarta.activation.DataSource; public class OXExporterFromA1 extends OXExporterFromA3 implements IZUGFeRDExporter { protected boolean ignorePDFAErrors = false; @@ -36,7 +38,7 @@ public class OXExporterFromA1 extends OXExporterFromA3 implements IZUGFeRDExport } private static boolean isValidA1(DataSource dataSource) throws IOException { - return getPDFAParserValidationResult(new PreflightParser(dataSource)); + return getPDFAParserValidationResult(PreflightParserHelper.createPreflightParser(dataSource)); } /*** * internal helper function: get namespace for order-x @@ -61,19 +63,19 @@ public class OXExporterFromA1 extends OXExporterFromA3 implements IZUGFeRDExport * NonSequentialParser. Some additional controls are present to check a set of * PDF/A requirements. (Stream length consistency, EOL after some Keyword...) */ - parser.parse();// might add a Format.PDF_A1A as parameter and iterate through A1 and A3 + // might add a Format.PDF_A1A as parameter and iterate through A1 and A3 - try (PreflightDocument document = parser.getPreflightDocument()) { + try (PreflightDocument document = (PreflightDocument) parser.parse()) { /* * Once the syntax validation is done, the parser can provide a * PreflightDocument (that inherits from PDDocument) This document process the * end of PDF/A validation. */ - document.validate(); + ValidationResult res = document.validate(); // Get validation result - return document.getResult().isValid(); + return res.isValid(); } catch (ValidationException e) { /* * the parse method can throw a SyntaxValidationException if the PDF file can't diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/OXExporterFromA3.java b/library/src/main/java/org/mustangproject/ZUGFeRD/OXExporterFromA3.java index 92433b46..b326cf22 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/OXExporterFromA3.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/OXExporterFromA3.java @@ -20,20 +20,38 @@ */ package org.mustangproject.ZUGFeRD; -import org.apache.pdfbox.cos.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.transform.TransformerException; + +import org.apache.pdfbox.Loader; +import org.apache.pdfbox.cos.COSArray; +import org.apache.pdfbox.cos.COSBase; +import org.apache.pdfbox.cos.COSDictionary; +import org.apache.pdfbox.cos.COSName; +import org.apache.pdfbox.cos.COSObject; import org.apache.pdfbox.io.IOUtils; -import org.apache.pdfbox.pdmodel.*; +import org.apache.pdfbox.pdmodel.PDDocument; +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.filespecification.PDComplexFileSpecification; import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile; import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDMarkInfo; import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureTreeRoot; -import org.apache.pdfbox.pdmodel.font.PDCIDFontType2; -import org.apache.pdfbox.pdmodel.font.PDFont; -import org.apache.pdfbox.pdmodel.font.PDFontDescriptor; -import org.apache.pdfbox.pdmodel.font.PDType0Font; import org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent; -import org.apache.pdfbox.preflight.utils.ByteArrayDataSource; import org.apache.xmpbox.XMPMetadata; import org.apache.xmpbox.schema.AdobePDFSchema; import org.apache.xmpbox.schema.DublinCoreSchema; @@ -47,11 +65,8 @@ import org.apache.xmpbox.xml.XmpSerializer; import org.mustangproject.EStandard; import org.mustangproject.FileAttachment; -import javax.activation.DataSource; -import javax.activation.FileDataSource; -import javax.xml.transform.TransformerException; -import java.io.*; -import java.util.*; +import jakarta.activation.DataSource; +import jakarta.activation.FileDataSource; public class OXExporterFromA3 extends ZUGFeRDExporterFromA3 { @@ -167,7 +182,7 @@ public class OXExporterFromA3 extends ZUGFeRDExporterFromA3 { */ public OXExporterFromA3 load(byte[] pdfBinary) throws IOException { ensurePDFIsValid(new ByteArrayDataSource(new ByteArrayInputStream(pdfBinary))); - doc = PDDocument.load(pdfBinary); + doc = Loader.loadPDF(pdfBinary); return this; } @@ -536,13 +551,13 @@ public class OXExporterFromA3 extends ZUGFeRDExporterFromA3 { } protected PDFAIdentificationSchema getPDFAIdentificationSchema(XMPMetadata xmp) { - PDFAIdentificationSchema pdfaid = xmp.getPDFIdentificationSchema(); + PDFAIdentificationSchema pdfaid = xmp.getPDFAIdentificationSchema(); if (pdfaid != null) if (overwrite) xmp.removeSchema(pdfaid); else return pdfaid; - return xmp.createAndAddPFAIdentificationSchema(); + return xmp.createAndAddPDFAIdentificationSchema(); } protected void writeDublinCoreSchema(XMPMetadata xmp) { diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/OXPullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/OXPullProvider.java index 9ea90e19..eabf2a14 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/OXPullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/OXPullProvider.java @@ -27,18 +27,14 @@ import static org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants.CATE import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Base64; import java.util.Date; -import java.util.List; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; -import java.util.stream.Collectors; import org.mustangproject.EStandard; import org.mustangproject.FileAttachment; -import org.mustangproject.IncludedNote; import org.mustangproject.XMLTools; public class OXPullProvider extends ZUGFeRD2PullProvider implements IXMLProvider { diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/Profiles.java b/library/src/main/java/org/mustangproject/ZUGFeRD/Profiles.java index 1e70462f..3d73e7ac 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/Profiles.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/Profiles.java @@ -20,12 +20,12 @@ */ package org.mustangproject.ZUGFeRD; -import org.mustangproject.EStandard; - import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; +import org.mustangproject.EStandard; + public class Profiles { static Map zf2Map = Stream.of(new Object[][]{ {"MINIMUM", new Profile("MINIMUM", "urn:factur-x.eu:1p0:minimum")}, diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/UBLDAPullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/UBLDAPullProvider.java index 22f59db2..f6ed2993 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/UBLDAPullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/UBLDAPullProvider.java @@ -20,32 +20,22 @@ */ package org.mustangproject.ZUGFeRD; +import java.io.IOException; +import java.io.StringWriter; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.logging.Level; +import java.util.logging.Logger; + import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.DocumentHelper; import org.dom4j.io.OutputFormat; import org.dom4j.io.XMLWriter; import org.mustangproject.EStandard; -import org.mustangproject.FileAttachment; -import org.mustangproject.TradeParty; import org.mustangproject.XMLTools; -import java.io.IOException; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.math.BigDecimal; -import java.nio.charset.StandardCharsets; -import java.text.SimpleDateFormat; -import java.util.Base64; -import java.util.Date; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import static org.mustangproject.ZUGFeRD.ZUGFeRDDateFormat.DATE; -import static org.mustangproject.ZUGFeRD.model.DocumentCodeTypeConstants.CORRECTEDINVOICE; -import static org.mustangproject.ZUGFeRD.model.TaxCategoryCodeTypeConstants.CATEGORY_CODES_WITH_EXEMPTION_REASON; - public class UBLDAPullProvider implements IXMLProvider { protected IExportableTransaction trans; diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/XMLUpgrader.java b/library/src/main/java/org/mustangproject/ZUGFeRD/XMLUpgrader.java index 9ea78955..04934a4f 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/XMLUpgrader.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/XMLUpgrader.java @@ -1,9 +1,20 @@ package org.mustangproject.ZUGFeRD; -import javax.xml.transform.*; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; + +import javax.xml.transform.Source; +import javax.xml.transform.Templates; +import javax.xml.transform.Transformer; +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.StreamSource; -import java.io.*; /*** diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/XMPSchemaPDFAExtensions.java b/library/src/main/java/org/mustangproject/ZUGFeRD/XMPSchemaPDFAExtensions.java index 2bfe9ad2..567cd300 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/XMPSchemaPDFAExtensions.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/XMPSchemaPDFAExtensions.java @@ -30,7 +30,15 @@ package org.mustangproject.ZUGFeRD; import org.apache.xmpbox.XMPMetadata; import org.apache.xmpbox.XmpConstants; import org.apache.xmpbox.schema.PDFAExtensionSchema; -import org.apache.xmpbox.type.*; +import org.apache.xmpbox.type.ArrayProperty; +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; import org.mustangproject.EStandard; /** diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/XRExporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/XRExporter.java index 24c2a8be..5c2fa2a3 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/XRExporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/XRExporter.java @@ -20,31 +20,10 @@ */ package org.mustangproject.ZUGFeRD; -import org.apache.pdfbox.cos.*; -import org.apache.pdfbox.io.IOUtils; -import org.apache.pdfbox.pdmodel.*; -import org.apache.pdfbox.pdmodel.common.PDMetadata; -import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification; -import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile; -import org.apache.pdfbox.preflight.PreflightDocument; -import org.apache.pdfbox.preflight.exception.ValidationException; -import org.apache.pdfbox.preflight.parser.PreflightParser; -import org.apache.pdfbox.preflight.utils.ByteArrayDataSource; -import org.apache.xmpbox.XMPMetadata; -import org.apache.xmpbox.schema.AdobePDFSchema; -import org.apache.xmpbox.schema.DublinCoreSchema; -import org.apache.xmpbox.schema.PDFAIdentificationSchema; -import org.apache.xmpbox.schema.XMPBasicSchema; -import org.apache.xmpbox.type.BadFieldValueException; -import org.apache.xmpbox.xml.XmpSerializer; - -import javax.activation.DataSource; -import javax.activation.FileDataSource; -import javax.xml.transform.TransformerException; -import java.io.*; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Map; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; public class XRExporter implements IExporter { IXMLProvider xmlProvider; diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/XRechnungImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/XRechnungImporter.java index 069c6e57..ab476e86 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/XRechnungImporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/XRechnungImporter.java @@ -1,8 +1,5 @@ package org.mustangproject.ZUGFeRD; -import org.mustangproject.XMLTools; - -import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.file.Files; @@ -10,6 +7,8 @@ import java.nio.file.Paths; import java.util.logging.Level; import java.util.logging.Logger; +import org.mustangproject.XMLTools; + public class XRechnungImporter extends ZUGFeRDImporter { public XRechnungImporter(byte[] rawXml) { diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA1.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA1.java index c8c7caba..72bda71d 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA1.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA1.java @@ -19,14 +19,16 @@ package org.mustangproject.ZUGFeRD; +import java.io.IOException; +import java.io.InputStream; + import org.apache.pdfbox.preflight.PreflightDocument; +import org.apache.pdfbox.preflight.ValidationResult; import org.apache.pdfbox.preflight.exception.ValidationException; import org.apache.pdfbox.preflight.parser.PreflightParser; import org.mustangproject.EStandard; -import javax.activation.DataSource; -import java.io.IOException; -import java.io.InputStream; +import jakarta.activation.DataSource; public class ZUGFeRDExporterFromA1 extends ZUGFeRDExporterFromA3 implements IZUGFeRDExporter { protected boolean ignorePDFAErrors = false; @@ -37,7 +39,7 @@ public class ZUGFeRDExporterFromA1 extends ZUGFeRDExporterFromA3 implements IZUG } private static boolean isValidA1(DataSource dataSource) throws IOException { - return getPDFAParserValidationResult(new PreflightParser(dataSource)); + return getPDFAParserValidationResult(PreflightParserHelper.createPreflightParser(dataSource)); } private static boolean getPDFAParserValidationResult(PreflightParser parser) throws IOException { @@ -46,19 +48,19 @@ public class ZUGFeRDExporterFromA1 extends ZUGFeRDExporterFromA3 implements IZUG * NonSequentialParser. Some additional controls are present to check a set of * PDF/A requirements. (Stream length consistency, EOL after some Keyword...) */ - parser.parse();// might add a Format.PDF_A1A as parameter and iterate through A1 and A3 + // might add a Format.PDF_A1A as parameter and iterate through A1 and A3 - try (PreflightDocument document = parser.getPreflightDocument()) { + try (PreflightDocument document = (PreflightDocument) parser.parse()) { /* * Once the syntax validation is done, the parser can provide a * PreflightDocument (that inherits from PDDocument) This document process the * end of PDF/A validation. */ - document.validate(); + ValidationResult res = document.validate(); // Get validation result - return document.getResult().isValid(); + return res.isValid(); } catch (ValidationException e) { /* * the parse method can throw a SyntaxValidationException if the PDF file can't diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA3.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA3.java index bc687aa7..bf884f8d 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA3.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA3.java @@ -20,9 +20,35 @@ */ package org.mustangproject.ZUGFeRD; -import org.apache.pdfbox.cos.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.Closeable; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Map; + +import javax.xml.transform.TransformerException; + +import org.apache.pdfbox.Loader; +import org.apache.pdfbox.cos.COSArray; +import org.apache.pdfbox.cos.COSBase; +import org.apache.pdfbox.cos.COSDictionary; +import org.apache.pdfbox.cos.COSName; +import org.apache.pdfbox.cos.COSObject; import org.apache.pdfbox.io.IOUtils; -import org.apache.pdfbox.pdmodel.*; +import org.apache.pdfbox.pdmodel.PDDocument; +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.PDPage; +import org.apache.pdfbox.pdmodel.PDResources; import org.apache.pdfbox.pdmodel.common.PDMetadata; import org.apache.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification; import org.apache.pdfbox.pdmodel.common.filespecification.PDEmbeddedFile; @@ -33,7 +59,6 @@ import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.font.PDFontDescriptor; import org.apache.pdfbox.pdmodel.font.PDType0Font; import org.apache.pdfbox.pdmodel.graphics.color.PDOutputIntent; -import org.apache.pdfbox.preflight.utils.ByteArrayDataSource; import org.apache.xmpbox.XMPMetadata; import org.apache.xmpbox.schema.AdobePDFSchema; import org.apache.xmpbox.schema.DublinCoreSchema; @@ -47,11 +72,8 @@ import org.apache.xmpbox.xml.XmpSerializer; import org.mustangproject.EStandard; import org.mustangproject.FileAttachment; -import javax.activation.DataSource; -import javax.activation.FileDataSource; -import javax.xml.transform.TransformerException; -import java.io.*; -import java.util.*; +import jakarta.activation.DataSource; +import jakarta.activation.FileDataSource; public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporter, IExporter, Closeable { private boolean isFacturX = true; @@ -258,7 +280,7 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte */ public ZUGFeRDExporterFromA3 load(byte[] pdfBinary) throws IOException { ensurePDFIsValid(new ByteArrayDataSource(new ByteArrayInputStream(pdfBinary))); - doc = PDDocument.load(pdfBinary); + doc = Loader.loadPDF(pdfBinary); return this; } @@ -713,13 +735,13 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte } protected PDFAIdentificationSchema getPDFAIdentificationSchema(XMPMetadata xmp) { - PDFAIdentificationSchema pdfaid = xmp.getPDFIdentificationSchema(); + PDFAIdentificationSchema pdfaid = xmp.getPDFAIdentificationSchema(); if (pdfaid != null) if (overwrite) xmp.removeSchema(pdfaid); else return pdfaid; - return xmp.createAndAddPFAIdentificationSchema(); + return xmp.createAndAddPDFAIdentificationSchema(); } protected void writeDublinCoreSchema(XMPMetadata xmp) { diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromPDFA.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromPDFA.java index 02067215..dfddc090 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromPDFA.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromPDFA.java @@ -20,6 +20,13 @@ */ package org.mustangproject.ZUGFeRD; +import java.io.DataInputStream; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import org.apache.pdfbox.Loader; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocumentCatalog; import org.apache.pdfbox.pdmodel.common.PDMetadata; @@ -30,8 +37,7 @@ import org.apache.xmpbox.xml.XmpParsingException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.activation.DataSource; -import java.io.*; +import jakarta.activation.DataSource; /*** * Auto-detects the source PDF-A-Version and acts accordingly @@ -79,7 +85,7 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter { * @throws IOException */ private int getPDFAVersion(byte[] byteArrayInputStream) throws IOException { - PDDocument document = PDDocument.load(byteArrayInputStream); + PDDocument document = Loader.loadPDF(byteArrayInputStream); PDDocumentCatalog catalog = document.getDocumentCatalog(); PDMetadata metadata = catalog.getMetadata(); // the PDF version we could get through the document but we want the PDF-A version, @@ -89,7 +95,7 @@ public class ZUGFeRDExporterFromPDFA implements IZUGFeRDExporter { DomXmpParser xmpParser = new DomXmpParser(); XMPMetadata xmp = xmpParser.parse(metadata.createInputStream()); - PDFAIdentificationSchema pdfaSchema = xmp.getPDFIdentificationSchema(); + PDFAIdentificationSchema pdfaSchema = xmp.getPDFAIdentificationSchema(); if (pdfaSchema != null) { return pdfaSchema.getPart(); } diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java index 6cc33371..58b7fd5a 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDImporter.java @@ -23,7 +23,13 @@ import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; @@ -36,6 +42,8 @@ import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; +import org.apache.pdfbox.Loader; +import org.apache.pdfbox.io.IOUtils; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocumentNameDictionary; import org.apache.pdfbox.pdmodel.PDEmbeddedFilesNameTreeNode; @@ -115,7 +123,7 @@ public class ZUGFeRDImporter { if (Arrays.equals(pad, pdfSignature)) { // we have a pdf - try (PDDocument doc = PDDocument.load(pdfStream)) { + try (PDDocument doc = Loader.loadPDF(IOUtils.toByteArray (pdfStream))) { // PDDocumentInformation info = doc.getDocumentInformation(); final PDDocumentNameDictionary names = new PDDocumentNameDictionary(doc.getDocumentCatalog()); //start diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java index 13a693f0..33eaf0c9 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDInvoiceImporter.java @@ -3,11 +3,9 @@ package org.mustangproject.ZUGFeRD; import java.io.IOException; import java.io.InputStream; import java.math.BigDecimal; -import java.math.RoundingMode; import java.nio.charset.StandardCharsets; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; import java.util.Date; import javax.xml.xpath.XPath; @@ -16,7 +14,14 @@ import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; -import org.mustangproject.*; +import org.mustangproject.Allowance; +import org.mustangproject.BankDetails; +import org.mustangproject.Charge; +import org.mustangproject.EStandard; +import org.mustangproject.Invoice; +import org.mustangproject.Item; +import org.mustangproject.TradeParty; +import org.mustangproject.XMLTools; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Node; diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java index b5da00ba..c9431b2b 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDVisualizer.java @@ -20,30 +20,50 @@ */ package org.mustangproject.ZUGFeRD; -import org.apache.fop.apps.*; -import org.apache.fop.apps.io.ResourceResolverFactory; -import org.apache.fop.configuration.Configuration; -import org.apache.fop.configuration.ConfigurationException; -import org.apache.fop.configuration.DefaultConfigurationBuilder; -import org.apache.xmlgraphics.util.MimeConstants; -import org.mustangproject.CII.CIIToUBL; -import org.mustangproject.ClasspathResolverURIAdapter; -import org.xml.sax.SAXException; - -import javax.xml.transform.*; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; - -import java.io.*; -import java.net.URI; -import java.net.URISyntaxException; +import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.io.PipedInputStream; +import java.io.PipedOutputStream; +import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.logging.Level; import java.util.logging.Logger; +import javax.xml.transform.Result; +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.sax.SAXResult; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import org.apache.fop.apps.FOPException; +import org.apache.fop.apps.FOUserAgent; +import org.apache.fop.apps.Fop; +import org.apache.fop.apps.FopFactory; +import org.apache.fop.apps.FopFactoryBuilder; +import org.apache.fop.apps.io.ResourceResolverFactory; +import org.apache.fop.configuration.Configuration; +import org.apache.fop.configuration.ConfigurationException; +import org.apache.fop.configuration.DefaultConfigurationBuilder; +import org.apache.xmlgraphics.util.MimeConstants; +import org.mustangproject.ClasspathResolverURIAdapter; +import org.mustangproject.CII.CIIToUBL; + public class ZUGFeRDVisualizer { public enum Language { diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterEdgeTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterEdgeTest.java index 3d6f27a0..16925115 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterEdgeTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterEdgeTest.java @@ -21,6 +21,7 @@ package org.mustangproject.ZUGFeRD; import junit.framework.Test; import junit.framework.TestSuite; +import org.apache.pdfbox.Loader; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.common.PDMetadata; import org.apache.xmpbox.XMPMetadata; @@ -252,7 +253,7 @@ public class MustangReaderWriterEdgeTest extends MustangReaderTestCase { setupPdfUnderTest(SOURCE_PDF, TARGET_PDF); // now check the contents - PDDocument doc = PDDocument.load(new File(TARGET_PDF)); + PDDocument doc = Loader.loadPDF(new File(TARGET_PDF)); PDMetadata meta = doc.getDocumentCatalog().getMetadata(); assertNotNull("The pdf must contain XMPMetadata", meta); @@ -262,7 +263,7 @@ public class MustangReaderWriterEdgeTest extends MustangReaderTestCase { DomXmpParser xmpParser = new DomXmpParser(); XMPMetadata xmp = xmpParser.parse(xmpBytes); - PDFAIdentificationSchema pdfai = xmp.getPDFIdentificationSchema(); + PDFAIdentificationSchema pdfai = xmp.getPDFAIdentificationSchema(); assertNotNull("The pdf must contain a PDFIdentificationSchema", pdfai); assertTrue("The PDF/A conformance must be A, B or U", diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterTest.java index 52cf151a..b8dae9bb 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/MustangReaderWriterTest.java @@ -21,6 +21,7 @@ package org.mustangproject.ZUGFeRD; import junit.framework.Test; import junit.framework.TestSuite; +import org.apache.pdfbox.Loader; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.common.PDMetadata; import org.apache.pdfbox.pdmodel.encryption.InvalidPasswordException; @@ -328,13 +329,13 @@ public class MustangReaderWriterTest extends MustangReaderTestCase { } private void checkPdfA3B(File tempFile) throws IOException, InvalidPasswordException { - try (PDDocument doc = PDDocument.load(tempFile)) { + try (PDDocument doc = Loader.loadPDF(tempFile)) { PDMetadata metadata = doc.getDocumentCatalog().getMetadata(); InputStream exportXMPMetadata = metadata.exportXMPMetadata(); byte[] xmpBytes = new byte[exportXMPMetadata.available()]; exportXMPMetadata.read(xmpBytes); final XMPMetadata xmp = new DomXmpParser().parse(xmpBytes); - PDFAIdentificationSchema pdfaid = xmp.getPDFIdentificationSchema(); + PDFAIdentificationSchema pdfaid = xmp.getPDFAIdentificationSchema(); assertEquals(pdfaid.getPart().intValue(), 3); assertEquals(pdfaid.getConformance(), "U"); } catch (XmpParsingException e) { diff --git a/pom.xml b/pom.xml index 10feb62d..941db51e 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 org.mustangproject core - 2.11.1-SNAPSHOT + 3.0.0-SNAPSHOT pom Mustang @@ -118,9 +118,9 @@ github -Xdoclint:none - 1.8 - 1.8 - 1.8 + 11 + 11 + 11 true @@ -199,7 +199,7 @@ - 8 + 11 adopt diff --git a/validator/pom.xml b/validator/pom.xml index 0d6dabf0..6f35fd21 100644 --- a/validator/pom.xml +++ b/validator/pom.xml @@ -3,7 +3,7 @@ org.mustangproject core - 2.11.1-SNAPSHOT + 3.0.0-SNAPSHOT 4.0.0 org.mustangproject @@ -11,7 +11,7 @@ Library to validate e-invoices (ZUGFeRD, Factur-X and Xrechnung) jar - 2.11.1-SNAPSHOT + 3.0.0-SNAPSHOT @@ -38,7 +38,7 @@ ${project.groupId} library - 2.11.1-SNAPSHOT + 3.0.0-SNAPSHOT @@ -98,7 +98,7 @@ org.mustangproject library - 2.11.1-SNAPSHOT + 3.0.0-SNAPSHOT org.xmlunit From 0a087ed18434ea46669322b25a0799cbf9f18f77 Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 18 Jun 2024 20:13:31 +0200 Subject: [PATCH 02/10] Test fix --- library/pom.xml | 33 +- .../ubl-conv-ubl-output-factur-x.xml | 338 +++++++++--------- 2 files changed, 194 insertions(+), 177 deletions(-) diff --git a/library/pom.xml b/library/pom.xml index 8602afe9..375e48ab 100644 --- a/library/pom.xml +++ b/library/pom.xml @@ -70,11 +70,16 @@ 2.9 - - org.eclipse.angus - angus-activation - 2.0.2 - + + jakarta.xml.bind + jakarta.xml.bind-api + 4.0.2 + + + org.eclipse.angus + angus-activation + 2.0.2 + org.apache.pdfbox @@ -124,12 +129,18 @@ test - - org.xmlunit - xmlunit-assertj - 2.10.0 - test - + + org.xmlunit + xmlunit-assertj + 2.10.0 + test + + + org.slf4j + slf4j-simple + 2.0.9 + test + diff --git a/library/src/test/resources/ubl-conv-ubl-output-factur-x.xml b/library/src/test/resources/ubl-conv-ubl-output-factur-x.xml index f9daed6d..c9a9ce4f 100644 --- a/library/src/test/resources/ubl-conv-ubl-output-factur-x.xml +++ b/library/src/test/resources/ubl-conv-ubl-output-factur-x.xml @@ -1,168 +1,174 @@ - - - urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 - urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 - RE-20201121/508 - 2020-11-21 - 2020-12-12 - 380 - EUR - AB321 - - - - Bei Spiel GmbH - - - Ecke 12 - Stadthausen - 12345 - - DE - - - - DE136695976 - - VAT - - - - Bei Spiel GmbH - - - - - - + + urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0 + urn:fdc:peppol.eu:2017:poacc:billing:01:1.0 + RE-20201121/508 + 2020-11-21 + 2020-12-12 + 380 + EUR + AB321 + + + + Ecke 12 + Stadthausen + 12345 + + DE + + + + DE136695976 + + VAT + + + + Bei Spiel GmbH + + + + + + + 2 + + + Bahnstr. 42 + Spielkreis + 88802 + + DE + + + + Theodor Est + + + + + 2020-11-10 + + + 42 + RE-20201121/508 + + DE88200800000970375700 + Max Mustermann + + COBADEFFXXX + + + + + Zahlbar ohne Abzug bis 12.12.2020 + + + 75.04 + + 160 + 11.2 + + S + 7 + + VAT + + + + + 336 + 63.84 + + S + 19 + + VAT + + + + + + 496 + 496 + 571.04 + 0 + 0 + 0 + 571.04 + + + 1 + 1 + 160 + + Of a sample invoice + Design (hours) + + S + 7 + + VAT + + + + + 160 + 1 + + false + 0 + 160 + + + + 2 - - - Theodor Est - - - Bahnstr. 42 - Spielkreis - 88802 - - DE - - - - Theodor Est - - - - - 2020-11-10 - - - 42 - RE-20201121/508 - - DE88200800000970375700 - Max Mustermann - - COBADEFFXXX - - - - - Zahlbar ohne Abzug bis 12.12.2020 - - - 75.04 - - 160 - 11.2 - - S - 7 - - VAT - - - - - 336 - 63.84 - - S - 19 - - VAT - - - - - - 496 - 496 - 571.04 - 0 - 0 - 0 - 571.04 - - - 1 - 1 - 160 - - Of a sample invoice - Design (hours) - - S - 7 - - VAT - - - - - 160 - 1 - - - - 2 - 400 - 316 - - various colors, ~2000ml - Ballons - - S - 19 - - VAT - - - - - 0.79 - 1 - - - - 3 - 800 - 20 - - Hot air „heiße Luft“ (litres) - - S - 19 - - VAT - - - - - 0.025 - 1 - - + 400 + 316 + + various colors, ~2000ml + Ballons + + S + 19 + + VAT + + + + + 0.79 + 1 + + false + 0 + 0.79 + + + + + 3 + 800 + 20 + + Hot air „heiße Luft“ (litres) + + S + 19 + + VAT + + + + + 0.025 + 1 + + false + 0 + 0.025 + + + \ No newline at end of file From 9cd2e36c693c5481b717f987c022327ece9c2221 Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 18 Jun 2024 21:09:52 +0200 Subject: [PATCH 03/10] Test fixes --- .../ZUGFeRD/ZUGFeRDExporterFromA3.java | 5 +- .../mustangproject/ZUGFeRD/ResourceCase.java | 3 + .../ZUGFeRD/VisualizationTest.java | 4 +- .../factur-x-vis-ubl-creditnote.en.html | 6 +- .../test/resources/factur-x-vis-ubl.en.html | 1950 ++++++++++++++- .../src/test/resources/factur-x-vis.fr.html | 2122 ++++++++++++++++- 6 files changed, 4081 insertions(+), 9 deletions(-) diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA3.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA3.java index bf884f8d..64efd879 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA3.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRDExporterFromA3.java @@ -42,6 +42,7 @@ import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSObject; import org.apache.pdfbox.io.IOUtils; +import org.apache.pdfbox.pdfwriter.compress.CompressParameters; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDDocumentCatalog; import org.apache.pdfbox.pdmodel.PDDocumentInformation; @@ -312,7 +313,7 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte throw new IOException( "File must be attached (usually with setTransaction) before perfoming this operation"); } - doc.save(ZUGFeRDfilename); + doc.save(ZUGFeRDfilename, CompressParameters.NO_COMPRESSION); if (!disableAutoClose) { close(); } @@ -339,7 +340,7 @@ public class ZUGFeRDExporterFromA3 extends XRExporter implements IZUGFeRDExporte throw new IOException( "File must be attached (usually with setTransaction) before perfoming this operation"); } - doc.save(output); + doc.save(output, CompressParameters.NO_COMPRESSION); if (!disableAutoClose) { close(); } diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/ResourceCase.java b/library/src/test/java/org/mustangproject/ZUGFeRD/ResourceCase.java index a95ed41f..4ac331d6 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/ResourceCase.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/ResourceCase.java @@ -1,6 +1,8 @@ package org.mustangproject.ZUGFeRD; import junit.framework.TestCase; + +import org.junit.Ignore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -9,6 +11,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +@Ignore public class ResourceCase extends TestCase { private static final Logger LOGGER = LoggerFactory.getLogger(ResourceCase.class.getCanonicalName()); // log output is diff --git a/library/src/test/java/org/mustangproject/ZUGFeRD/VisualizationTest.java b/library/src/test/java/org/mustangproject/ZUGFeRD/VisualizationTest.java index 9fa58030..a8412b55 100644 --- a/library/src/test/java/org/mustangproject/ZUGFeRD/VisualizationTest.java +++ b/library/src/test/java/org/mustangproject/ZUGFeRD/VisualizationTest.java @@ -80,10 +80,10 @@ public class VisualizationTest extends ResourceCase { /* remove file endings so that tests can also pass after checking out from git with arbitrary options (which may include CSRF changes) */ - result = zvi.visualize(UBLinputFile.getAbsolutePath(),ZUGFeRDVisualizer.Language.EN).replace("\r","").replace("\n",""); + result = zvi.visualize(UBLinputFile.getAbsolutePath(),ZUGFeRDVisualizer.Language.EN).replace("\r","").replace("\n","").replace(" ","").replace("\t",""); File expectedResult=getResourceAsFile("factur-x-vis-ubl-creditnote.en.html"); - expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8).replace("\r","").replace("\n",""); + expected = new String(Files.readAllBytes(expectedResult.toPath()), StandardCharsets.UTF_8).replace("\r","").replace("\n","").replace(" ","").replace("\t",""); // remove linebreaks as well... } catch (UnsupportedOperationException e) { diff --git a/library/src/test/resources/factur-x-vis-ubl-creditnote.en.html b/library/src/test/resources/factur-x-vis-ubl-creditnote.en.html index b07fb397..f5855ab2 100644 --- a/library/src/test/resources/factur-x-vis-ubl-creditnote.en.html +++ b/library/src/test/resources/factur-x-vis-ubl-creditnote.en.html @@ -1,7 +1,7 @@ - + + - XRechnung
We accept no liability for the correctness of the data
Buyer Information
Routing ID:
04011000-12345-03
Name:
[Buyer name]
Street / house number:
[Buyer address line 1]
PO Box:
Address Addition:
Postcode:
12345
Place:
[Buyer city]
State/Province:
Country:
DE (Deutschland)
ID:
[Buyer identifier]
ID scheme:
Name:
Phone:
E-mail address:
Seller Information
Company name:
[Seller name]
Street / house number:
[Seller address line 1]
PO Box:
Address Addition:
Code postal:
12345
Place:
[Seller city]
State/Province:
Country code:
DE (Deutschland)
ID:
ID scheme:
Name:
nicht vorhanden
Phone:
+49 1234-5678
E-mail address:
seller@email.de
Invoice details
Seller Information:
123456XX
Invoice date:
4.4.2016
Invoice type:
380 (Commercial invoice)
Currency
EUR (Euro)

Billing period:

from:
to:
Project number:
Contract Number:
Order number:
Order number:

Previous invoices:

Total amounts of the invoice
Line total
netto
314,86
Total discounts
netto
Total charges
netto
Grand total
netto
314,86
VAT amount
22,04
Total VAT
Grand total
brutto
336,90
Amount paid
brutto
rounding amount
brutto
Amount Due
brutto
336,90
Breakdown of VAT at invoice level
VAT category: S (Standard rate)
Grand total
netto
314,86
VAT rate
7%
VAT amount
22,04
Reason for exemption::
ID for the exemption reason::
Payment details
Discount; other payment terms:
Zahlbar sofort ohne Abzug.
Due date:
Code for the means of payment:
58 (SEPA credit transfer)
Means of payment:
Usage:
Card information
Card number:
Card holder:
Direct debit
Mandate Reference No:
IBAN:
Creditor ID:
Transfer
Account holder:
IBAN:
DE75512108001245126199
BIC:
Invoice Comment
Subject:
Comment:
#ADU#Es gelten unsere Allgem. Geschäftsbedingungen, die Sie unter […] finden.
We accept no liability for the correctness of the data
LineZeitschrift [...]
Free text:
Die letzte Lieferung im Rahmen des abgerechneten Abonnements erfolgt in 12/2016 Lieferung erfolgt / erfolgte direkt vom Verlag
Object ID:
Object ID schema:
Order line number:
6171175.1
Account assignment information:

Billing period:

from:
1.1.2016
to:
31.12.2016
Price details
Quantity
1
Unit
XPP (Piece)
Unit price (net)
288,79
Total price (net)
288,79
Discount (net):
Net list price:
Number of units:
Unit of measure code:
VAT:
S (Standard rate)
VAT rate in percent:
7%
Allowances at line level
Charges at invoice line level
Item Information
Name:
Zeitschrift [...]
Description:
Zeitschrift Inland
Part number:
246
Customer's material number:

Article properties:

Item ID:
Item ID schema:
Item classification code:
0721-880X
Identifier to form the schema:
IB (ISBN (International Standard Book Number))
Version for creating the schema:
Country of origin code:
LinePorto + Versandkosten
Free text:
Object ID:
Object ID schema:
Order line number:
Account assignment information:

Billing period:

from:
to:
Price details
Quantity
1
Unit
XPP (Piece)
Unit price (net)
26,07
Total price (net)
26,07
Discount (net):
Net list price:
Number of units:
Unit of measure code:
VAT:
S (Standard rate)
VAT rate in percent:
7%
Allowances at line level
Charges at invoice line level
Item Information
Name:
Porto + Versandkosten
Description:
Part number:
Customer's material number:

Article properties:

Item ID:
Item ID schema:
Item classification code:
Identifier to form the schema:
Version for creating the schema:
Country of origin code:
We accept no liability for the correctness of the data
Seller Information
Differing trade name:
[Seller trading name]
State/Province:
Electronic address:
seller@email.de
Electronic address scheme:
EM (Electronic mail)
Register number:
[HRA-Eintrag]
VAT ID:
DE 123456789
Tax ID:
Tax ID scheme:
Further legal information:
123/456/7890, HRA-Eintrag in […]
VAT currency code:
Buyer Information
Differing trade name:
State/Province:
E-mail address:
buyer@info.de
Electronic address scheme:
EM (Electronic mail)
Register number:
Scheme of register/register number:
VAT ID:
VAT payday date:
VAT Statement Date Code:
Account assignment information:
Contract Information
Assignment number:
Receipt confirmation ID:
Dispatch note ID:
Process ID:
Specification ID:
urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0
Object ID:
Object ID schema:
We accept no liability for the correctness of the data
Documents justifying the invoice
History
+ + + + + XRechnung + + + + +
+ +
+
+
+
+
We accept no liability for the correctness of the data
+
+
+
+
Buyer Information
+
+
+
Routing ID:
+
04011000-12345-03
+
+
+
Name:
+
[Buyer name]
+
+
+
Street / house number:
+
[Buyer address line 1]
+
+
+
PO Box:
+
+
+
+
Address Addition:
+
+
+
+
Postcode:
+
12345
+
+
+
Place:
+
[Buyer city]
+
+
+
State/Province:
+
+
+
+
Country:
+
DE (Deutschland)
+
+
+
ID:
+
[Buyer identifier]
+
+
+
ID scheme:
+
+
+
+
Name:
+
+
+
+
Phone:
+
+
+
+
E-mail address:
+
+
+
+
+
+
+
Seller Information
+
+
+
+
+
+
+
Company name:
+
[Seller name]
+
+
+
Street / house number:
+
[Seller address line 1]
+
+
+
PO Box:
+
+
+
+
Address Addition:
+
+
+
+
Code postal:
+
12345
+
+
+
Place:
+
[Seller city]
+
+
+
State/Province:
+
+
+
+
Country code:
+
DE (Deutschland)
+
+
+
ID:
+
+
+
+
ID scheme:
+
+
+
+
Name:
+
nicht vorhanden
+
+
+
Phone:
+
+49 1234-5678
+
+
+
E-mail address:
+
seller@email.de
+
+
+
+
+
+
+
+
+
Invoice details
+
+
+
+
+
Seller Information:
+
123456XX
+
+
+
Invoice date:
+
4.4.2016
+
+
+
Invoice type:
+
380 (Commercial invoice)
+
+
+
Currency
+
EUR (Euro)
+
+
+

Billing period:

+
+
+
from:
+
+
+
+
to:
+
+
+
+
+
+
+
+
+
Project number:
+
+
+
+
Contract Number:
+
+
+
+
Order number:
+
+
+
+
Order number:
+
+
+
+

Previous invoices:

+
+
+
+
+
+
+
+
+
Total amounts of the invoice
+
+
+
Line total
+
netto
+
314,86
+
+
+
Total discounts
+
netto
+
+
+
+
Total charges
+
netto
+
+
+
+
Grand total
+
netto
+
314,86
+
+
+
VAT amount
+
+
22,04
+
+
+
Total VAT
+
+
+
+
+
Grand total
+
brutto
+
336,90
+
+
+
Amount paid
+
brutto
+
+
+
+
rounding amount
+
brutto
+
+
+
+
Amount Due
+
brutto
+
336,90
+
+
+
+
+
+
+
+
+
Breakdown of VAT at invoice level
+
+
+
VAT category: S (Standard rate)
+
+
+
+
+
Grand total
+
netto
+
314,86
+
+
+
VAT rate
+
+
7%
+
+
+
VAT amount
+
+
22,04
+
+
+
+
Reason for exemption::
+
ID for the exemption reason::
+
+
+
+
+
+
+
+
+
+
Payment details
+
+
+
Discount; other payment terms:
+
Zahlbar sofort ohne Abzug.
+
+
+
Due date:
+
+
+
+
Code for the means of payment:
+
58 (SEPA credit transfer)
+
+
+
Means of payment:
+
+
+
+
Usage:
+
+
+
+
+
+
Card information
+
+
+
Card number:
+
+
+
+
Card holder:
+
+
+
+
+
+
+
+
+
+
Direct debit
+
+
+
Mandate Reference No:
+
+
+
+
IBAN:
+
+
+
+
Creditor ID:
+
+
+
+
+
+
Transfer
+
+
+
Account holder:
+
+
+
+
IBAN:
+
DE75512108001245126199
+
+
+
BIC:
+
+
+
+
+
+
+
+
+
+
Invoice Comment
+
+
+
Subject:
+
+
+
+
Comment:
+
#ADU#Es gelten unsere Allgem. Geschäftsbedingungen, die Sie unter […] finden.
+
+
+
+
+
+
+
+
We accept no liability for the correctness of the data
+
+
+
+
LineZeitschrift [...]
+
+
+
Free text:
+
Die letzte Lieferung im Rahmen des abgerechneten Abonnements erfolgt in 12/2016 Lieferung + erfolgt / erfolgte direkt vom Verlag
+
+
+
Object ID:
+
+
+
+
Object ID schema:
+
+
+
+
Order line number:
+
6171175.1
+
+
+
Account assignment information:
+
+
+

Billing period:

+
+
from:
+
1.1.2016
+
+
+
to:
+
31.12.2016
+
+
+
+
+
Price details
+
+
+
Quantity
+
1
+
+
+
Unit
+
XPP (Piece)
+
+
+
Unit price (net)
+
288,79
+
+
+
Total price (net)
+
288,79
+
+
+
+
+
Discount (net):
+
+
+
+
Net list price:
+
+
+
+
Number of units:
+
+
+
+
Unit of measure code:
+
+
+
+
VAT:
+
S (Standard rate)
+
+
+
VAT rate in percent:
+
7%
+
+
+
+
+
+
+
+
+
Allowances at line level
+
+
+
Charges at invoice line level
+
+
+
+
+
+
+
Item Information
+
+
+
+
+
+
Name:
+
Zeitschrift [...]
+
+
+
Description:
+
Zeitschrift Inland
+
+
+
Part number:
+
246
+
+
+
Customer's material number:
+
+
+

Article properties:

+
+
+
+
+
+
+
Item ID:
+
+
+
+
Item ID schema:
+
+
+
+
Item classification code:
+
0721-880X
+
+
+
Identifier to form the schema:
+
IB (ISBN (International Standard Book Number))
+
+
+
Version for creating the schema:
+
+
+
+
Country of origin code:
+
+
+
+
+
+
+
+
+
+
+
+
+
LinePorto + Versandkosten
+
+
+
Free text:
+
+
+
+
Object ID:
+
+
+
+
Object ID schema:
+
+
+
+
Order line number:
+
+
+
+
Account assignment information:
+
+
+

Billing period:

+
+
from:
+
+
+
+
to:
+
+
+
+
+
+
Price details
+
+
+
Quantity
+
1
+
+
+
Unit
+
XPP (Piece)
+
+
+
Unit price (net)
+
26,07
+
+
+
Total price (net)
+
26,07
+
+
+
+
+
Discount (net):
+
+
+
+
Net list price:
+
+
+
+
Number of units:
+
+
+
+
Unit of measure code:
+
+
+
+
VAT:
+
S (Standard rate)
+
+
+
VAT rate in percent:
+
7%
+
+
+
+
+
+
+
+
+
Allowances at line level
+
+
+
Charges at invoice line level
+
+
+
+
+
+
+
Item Information
+
+
+
+
+
+
Name:
+
Porto + Versandkosten
+
+
+
Description:
+
+
+
+
Part number:
+
+
+
+
Customer's material number:
+
+
+

Article properties:

+
+
+
+
+
+
+
Item ID:
+
+
+
+
Item ID schema:
+
+
+
+
Item classification code:
+
+
+
+
Identifier to form the schema:
+
+
+
+
Version for creating the schema:
+
+
+
+
Country of origin code:
+
+
+
+
+
+
+
+
+
+
+
+
We accept no liability for the correctness of the data
+
+
+
+
Seller Information
+
+
+
Differing trade name:
+
[Seller trading name]
+
+
+
State/Province:
+
+
+
+
Electronic address:
+
seller@email.de
+
+
+
Electronic address scheme:
+
EM (Electronic mail)
+
+
+
Register number:
+
[HRA-Eintrag]
+
+
+
VAT ID:
+
DE 123456789
+
+
+
Tax ID:
+
+
+
+
Tax ID scheme:
+
+
+
+
Further legal information:
+
123/456/7890, HRA-Eintrag in […]
+
+
+
VAT currency code:
+
+
+
+
+
+
+
+
+
+
+
Buyer Information
+
+
+
Differing trade name:
+
+
+
+
State/Province:
+
+
+
+
E-mail address:
+
buyer@info.de
+
+
+
Electronic address scheme:
+
EM (Electronic mail)
+
+
+
Register number:
+
+
+
+
Scheme of register/register number:
+
+
+
+
VAT ID:
+
+
+
+
VAT payday date:
+
+
+
+
VAT Statement Date Code:
+
+
+
+
Account assignment information:
+
+
+
+
+
+
+
+
+
+
+
Contract Information
+
+
+
Assignment number:
+
+
+
+
Receipt confirmation ID:
+
+
+
+
Dispatch note ID:
+
+
+
+
Process ID:
+
+
+
+
Specification ID:
+
urn:cen.eu:en16931:2017#compliant#urn:xeinkauf.de:kosit:xrechnung_3.0
+
+
+
Object ID:
+
+
+
+
Object ID schema:
+
+
+
+
+
+
+
+
+
+
We accept no liability for the correctness of the data
+
+
+
+
Documents justifying the invoice
+
+
+
+
+
+
+
+
+
History
+
+
+
+
+
+
+ \ No newline at end of file diff --git a/library/src/test/resources/factur-x-vis.fr.html b/library/src/test/resources/factur-x-vis.fr.html index 644891a7..76efd248 100644 --- a/library/src/test/resources/factur-x-vis.fr.html +++ b/library/src/test/resources/factur-x-vis.fr.html @@ -1 +1,2121 @@ - XRechnung
Nous n'assumons aucune responsabilité quant à l'exactitude des données.
Informations sur l'acheteur
Identifiant d'itinéraire:
AB321
Nom:
Theodor Est
Rue / Numéro de maison:
Bahnstr. 42
Boîte postale:
Supplément d'adresse:
Code postal:
88802
Lieu:
Spielkreis
Région:
Pays:
DE (Deutschland)
Identifiant:
2
Schéma de l'Identifiant:
Nom:
Téléphone:
Adresse électronique:
Informations sur le vendeur
Nom de la société:
Bei Spiel GmbH
Rue / Numéro de maison:
Ecke 12
Boîte postale:
Supplément d'adresse:
Code postal:
12345
Lieu:
Stadthausen
Région:
Code pays:
DE (Deutschland)
Identifiant:
Schéma de l'Identifiant:
Nom:
Téléphone:
Adresse électronique:
Détails de la facturation
Informations sur le vendeur:
RE-20201121/508
Date de facture:
21.11.2020
Type de facture:
380 (Commercial invoice)
Devise
EUR (Euro)

Période de facturation:

de:
jusqu'à:
Numéro du projet:
Numéro du contrat:
Numéro de commande:
Numéro de commande:

Factures précédentes:

Montants totaux de la facture
Total de toutes les lignes
netto
496,00
Total de remises
netto
0,00
Total de suppléments
netto
0,00
Montant total
netto
496,00
montant de la TVA
Montant total de TVA
75,04
Montant total
brutto
571,04
Montant payé
brutto
0,00
Montant arrondi
brutto
Montant dû
brutto
571,04
Ventilation de la TVA au niveau de la facture
Catégorie de TVA: S (Standard rate)
Montant total
netto
160,00
taux TVA
7.00%
montant de la TVA
11,20
Motif d'exemption:
Identifiant pour motif d'exemption:
Ventilation de la TVA au niveau de la facture
Catégorie de TVA: S (Standard rate)
Montant total
netto
336,00
taux TVA
19.00%
montant de la TVA
63,84
Motif d'exemption:
Identifiant pour motif d'exemption:
Détails de paiement
Rabais; autres conditions de paiement:
Zahlbar ohne Abzug bis 12.12.2020
Date d'échéance:
12.12.2020
Code du moyen de paiement:
42 (Payment to bank account)
Moyens de paiement:
Bank transfer
Utilisation:
RE-20201121/508
Information de la carte
Numéro de carte:
Titulaire de la carte:
Prélèvement automatique
Numéro de référence du mandat:
IBAN:
Identifiant du créancier:
Transfert
Titulaire du compte:
Max Mustermann
IBAN:
DE88200800000970375700
BIC:
COBADEFFXXX
Nous n'assumons aucune responsabilité quant à l'exactitude des données.
Position1
Texte libre:
Identifiant d'objet:
Schéma de l'Identifiant objet:
Numéro de ligne de commande:
Information sur l'attribution de compte:

Période de facturation:

de:
jusqu'à:
Détails de prix
Quantité
1.0000
Unité
HUR (hour)
Prix unitaire net
160,00
Prix total net
160,00
Remise nette:
Prix catalogue (net):
160,00
Nombre d'unités:
1.0000
Code de l'unité de mesure :
HUR (hour)
TVA:
S (Standard rate)
Pourcentage de TVA:
7%
Allocations au niveau de la ligne de facture
Supplément au niveau de la ligne de facture
Informations sur l'article
Nom:
Design (hours)
Description:
Of a sample invoice
Numéro d'article:
N° client / matériel:

Propriétés de l'article:

Identifiant article:
Schéma de l'Identifiant article:
Code de classification des articles:
Identifiant pour la création du schéma:
Version de création du schéma:
Code du pays d'origine:
Position2
Texte libre:
Identifiant d'objet:
Schéma de l'Identifiant objet:
Numéro de ligne de commande:
Information sur l'attribution de compte:

Période de facturation:

de:
jusqu'à:
Détails de prix
Quantité
400.0000
Unité
H87 (piece)
Prix unitaire net
0,79
Prix total net
316,00
Remise nette:
Prix catalogue (net):
0,79
Nombre d'unités:
1.0000
Code de l'unité de mesure :
H87 (piece)
TVA:
S (Standard rate)
Pourcentage de TVA:
19%
Allocations au niveau de la ligne de facture
Supplément au niveau de la ligne de facture
Informations sur l'article
Nom:
Ballons
Description:
various colors, ~2000ml
Numéro d'article:
N° client / matériel:

Propriétés de l'article:

Identifiant article:
Schéma de l'Identifiant article:
Code de classification des articles:
Identifiant pour la création du schéma:
Version de création du schéma:
Code du pays d'origine:
Position3
Texte libre:
Identifiant d'objet:
Schéma de l'Identifiant objet:
Numéro de ligne de commande:
Information sur l'attribution de compte:

Période de facturation:

de:
jusqu'à:
Détails de prix
Quantité
800.0000
Unité
LTR (litre)
Prix unitaire net
0,02
Prix total net
20,00
Remise nette:
Prix catalogue (net):
0,02
Nombre d'unités:
1.0000
Code de l'unité de mesure :
LTR (litre)
TVA:
S (Standard rate)
Pourcentage de TVA:
19%
Allocations au niveau de la ligne de facture
Supplément au niveau de la ligne de facture
Informations sur l'article
Nom:
Hot air „heiße Luft“ (litres)
Description:
Numéro d'article:
N° client / matériel:

Propriétés de l'article:

Identifiant article:
Schéma de l'Identifiant article:
Code de classification des articles:
Identifiant pour la création du schéma:
Version de création du schéma:
Code du pays d'origine:
Nous n'assumons aucune responsabilité quant à l'exactitude des données.
Informations sur le vendeur
Nom commercial différent:
Région:
Adresse électronique:
Schéma de l'adresse électronique:
Numéro d'enregistrement:
Identifiant TVA:
DE136695976
Numéro fiscale:
Schéma du numéro fiscal:
Autres informations légales:
Code devise de la TVA:
Informations sur l'acheteur
Nom commercial différent :
Région:
Adresse électronique:
Schéma de l'adresse électronique:
Numéro d'enregistrement:
Schéma du numéro d'enregistrement:
Identifiant TVA:
Date de facturation de la TVA:
Code de date de règlement de la TVA:
Informations sur l'attribution de compte:
Informations sur le contrat
Numéro d'attribution:
Identifiant de l'accusé de réception:
Identifiant du bordereau d'expédition:
Identifiant processus:
Identifiant spécification:
urn:cen.eu:en16931:2017
Identifiant objet:
Schéma de l'Identifiant objet:
Nous n'assumons aucune responsabilité quant à l'exactitude des données.
Documents justificatifs
Historique de traitement
\ No newline at end of file + + + + + XRechnung + + + + +
+ +
+
+
+
+
Nous n'assumons aucune responsabilité quant à l'exactitude des données.
+
+
+
+
Informations sur l'acheteur
+
+
+
Identifiant d'itinéraire:
+
AB321
+
+
+
Nom:
+
Theodor Est
+
+
+
Rue / Numéro de maison:
+
Bahnstr. 42
+
+
+
Boîte postale:
+
+
+
+
Supplément d'adresse:
+
+
+
+
Code postal:
+
88802
+
+
+
Lieu:
+
Spielkreis
+
+
+
Région:
+
+
+
+
Pays:
+
DE (Deutschland)
+
+
+
Identifiant:
+
2
+
+
+
Schéma de l'Identifiant:
+
+
+
+
Nom:
+
+
+
+
Téléphone:
+
+
+
+
Adresse électronique:
+
+
+
+
+
+
+
Informations sur le vendeur
+
+
+
+
+
+
+
Nom de la société:
+
Bei Spiel GmbH
+
+
+
Rue / Numéro de maison:
+
Ecke 12
+
+
+
Boîte postale:
+
+
+
+
Supplément d'adresse:
+
+
+
+
Code postal:
+
12345
+
+
+
Lieu:
+
Stadthausen
+
+
+
Région:
+
+
+
+
Code pays:
+
DE (Deutschland)
+
+
+
Identifiant:
+
+
+
+
Schéma de l'Identifiant:
+
+
+
+
Nom:
+
+
+
+
Téléphone:
+
+
+
+
Adresse électronique:
+
+
+
+
+
+
+
+
+
+
Détails de la facturation
+
+
+
+
+
Informations sur le vendeur:
+
RE-20201121/508
+
+
+
Date de facture:
+
21.11.2020
+
+
+
Type de facture:
+
380 (Commercial invoice)
+
+
+
Devise
+
EUR (Euro)
+
+
+

Période de facturation:

+
+
+
de:
+
+
+
+
jusqu'à:
+
+
+
+
+
+
+
+
+
Numéro du projet:
+
+
+
+
Numéro du contrat:
+
+
+
+
Numéro de commande:
+
+
+
+
Numéro de commande:
+
+
+
+

Factures précédentes:

+
+
+
+
+
+
+
+
+
Montants totaux de la facture
+
+
+
Total de toutes les lignes
+
netto
+
496,00
+
+
+
Total de remises
+
netto
+
0,00
+
+
+
Total de suppléments
+
netto
+
0,00
+
+
+
Montant total
+
netto
+
496,00
+
+
+
montant de la TVA
+
+
+
+
+
Montant total de TVA
+
+
75,04
+
+
+
Montant total
+
brutto
+
571,04
+
+
+
Montant payé
+
brutto
+
0,00
+
+
+
Montant arrondi
+
brutto
+
+
+
+
Montant dû
+
brutto
+
571,04
+
+
+
+
+
+
+
+
+
Ventilation de la TVA au niveau de la facture
+
+
+
Catégorie de TVA: S (Standard rate)
+
+
+
+
+
Montant total
+
netto
+
160,00
+
+
+
taux TVA
+
+
7.00%
+
+
+
montant de la TVA
+
+
11,20
+
+
+
+
Motif d'exemption:
+
Identifiant pour motif d'exemption:
+
+
+
+
+
+
Ventilation de la TVA au niveau de la facture
+
+
+
Catégorie de TVA: S (Standard rate)
+
+
+
+
+
Montant total
+
netto
+
336,00
+
+
+
taux TVA
+
+
19.00%
+
+
+
montant de la TVA
+
+
63,84
+
+
+
+
Motif d'exemption:
+
Identifiant pour motif d'exemption:
+
+
+
+
+
+
+
+
+
+
Détails de paiement
+
+
+
Rabais; autres conditions de paiement:
+
Zahlbar ohne Abzug bis 12.12.2020
+
+
+
Date d'échéance:
+
12.12.2020
+
+
+
Code du moyen de paiement:
+
42 (Payment to bank account)
+
+
+
Moyens de paiement:
+
Bank transfer
+
+
+
Utilisation:
+
RE-20201121/508
+
+
+
+
+
Information de la carte
+
+
+
Numéro de carte:
+
+
+
+
Titulaire de la carte:
+
+
+
+
+
+
+
+
+
+
Prélèvement automatique
+
+
+
Numéro de référence du mandat:
+
+
+
+
IBAN:
+
+
+
+
Identifiant du créancier:
+
+
+
+
+
+
Transfert
+
+
+
Titulaire du compte:
+
Max Mustermann
+
+
+
IBAN:
+
DE88200800000970375700
+
+
+
BIC:
+
COBADEFFXXX
+
+
+
+
+
+
+
+
+
+
+
Nous n'assumons aucune responsabilité quant à l'exactitude des données.
+
+
+
+
Position1
+
+
+
Texte libre:
+
+
+
+
Identifiant d'objet:
+
+
+
+
Schéma de l'Identifiant objet:
+
+
+
+
Numéro de ligne de commande:
+
+
+
+
Information sur l'attribution de compte:
+
+
+

Période de facturation:

+
+
de:
+
+
+
+
jusqu'à:
+
+
+
+
+
+
Détails de prix
+
+
+
Quantité
+
1.0000
+
+
+
Unité
+
HUR (hour)
+
+
+
Prix unitaire net
+
160,00
+
+
+
Prix total net
+
160,00
+
+
+
+
+
Remise nette:
+
+
+
+
Prix catalogue (net):
+
160,00
+
+
+
Nombre d'unités:
+
1.0000
+
+
+
Code de l'unité de mesure :
+
HUR (hour)
+
+
+
TVA:
+
S (Standard rate)
+
+
+
Pourcentage de TVA:
+
7%
+
+
+
+
+
+
+
+
+
Allocations au niveau de la ligne de facture
+
+
+
Supplément au niveau de la ligne de facture
+
+
+
+
+
+
+
Informations sur l'article
+
+
+
+
+
+
Nom:
+
Design (hours)
+
+
+
Description:
+
Of a sample invoice
+
+
+
Numéro d'article:
+
+
+
+
N° client / matériel:
+
+
+

Propriétés de l'article:

+
+
+
+
+
+
+
Identifiant article:
+
+
+
+
Schéma de l'Identifiant article:
+
+
+
+
Code de classification des articles:
+
+
+
+
Identifiant pour la création du schéma:
+
+
+
+
Version de création du schéma:
+
+
+
+
Code du pays d'origine:
+
+
+
+
+
+
+
+
+
+
+
+
+
Position2
+
+
+
Texte libre:
+
+
+
+
Identifiant d'objet:
+
+
+
+
Schéma de l'Identifiant objet:
+
+
+
+
Numéro de ligne de commande:
+
+
+
+
Information sur l'attribution de compte:
+
+
+

Période de facturation:

+
+
de:
+
+
+
+
jusqu'à:
+
+
+
+
+
+
Détails de prix
+
+
+
Quantité
+
400.0000
+
+
+
Unité
+
H87 (piece)
+
+
+
Prix unitaire net
+
0,79
+
+
+
Prix total net
+
316,00
+
+
+
+
+
Remise nette:
+
+
+
+
Prix catalogue (net):
+
0,79
+
+
+
Nombre d'unités:
+
1.0000
+
+
+
Code de l'unité de mesure :
+
H87 (piece)
+
+
+
TVA:
+
S (Standard rate)
+
+
+
Pourcentage de TVA:
+
19%
+
+
+
+
+
+
+
+
+
Allocations au niveau de la ligne de facture
+
+
+
Supplément au niveau de la ligne de facture
+
+
+
+
+
+
+
Informations sur l'article
+
+
+
+
+
+
Nom:
+
Ballons
+
+
+
Description:
+
various colors, ~2000ml
+
+
+
Numéro d'article:
+
+
+
+
N° client / matériel:
+
+
+

Propriétés de l'article:

+
+
+
+
+
+
+
Identifiant article:
+
+
+
+
Schéma de l'Identifiant article:
+
+
+
+
Code de classification des articles:
+
+
+
+
Identifiant pour la création du schéma:
+
+
+
+
Version de création du schéma:
+
+
+
+
Code du pays d'origine:
+
+
+
+
+
+
+
+
+
+
+
+
+
Position3
+
+
+
Texte libre:
+
+
+
+
Identifiant d'objet:
+
+
+
+
Schéma de l'Identifiant objet:
+
+
+
+
Numéro de ligne de commande:
+
+
+
+
Information sur l'attribution de compte:
+
+
+

Période de facturation:

+
+
de:
+
+
+
+
jusqu'à:
+
+
+
+
+
+
Détails de prix
+
+
+
Quantité
+
800.0000
+
+
+
Unité
+
LTR (litre)
+
+
+
Prix unitaire net
+
0,02
+
+
+
Prix total net
+
20,00
+
+
+
+
+
Remise nette:
+
+
+
+
Prix catalogue (net):
+
0,02
+
+
+
Nombre d'unités:
+
1.0000
+
+
+
Code de l'unité de mesure :
+
LTR (litre)
+
+
+
TVA:
+
S (Standard rate)
+
+
+
Pourcentage de TVA:
+
19%
+
+
+
+
+
+
+
+
+
Allocations au niveau de la ligne de facture
+
+
+
Supplément au niveau de la ligne de facture
+
+
+
+
+
+
+
Informations sur l'article
+
+
+
+
+
+
Nom:
+
Hot air „heiße Luft“ (litres)
+
+
+
Description:
+
+
+
+
Numéro d'article:
+
+
+
+
N° client / matériel:
+
+
+

Propriétés de l'article:

+
+
+
+
+
+
+
Identifiant article:
+
+
+
+
Schéma de l'Identifiant article:
+
+
+
+
Code de classification des articles:
+
+
+
+
Identifiant pour la création du schéma:
+
+
+
+
Version de création du schéma:
+
+
+
+
Code du pays d'origine:
+
+
+
+
+
+
+
+
+
+
+
+
Nous n'assumons aucune responsabilité quant à l'exactitude des données.
+
+
+
+
Informations sur le vendeur
+
+
+
Nom commercial différent:
+
+
+
+
Région:
+
+
+
+
Adresse électronique:
+
+
+
+
Schéma de l'adresse électronique:
+
+
+
+
Numéro d'enregistrement:
+
+
+
+
Identifiant TVA:
+
DE136695976
+
+
+
Numéro fiscale:
+
+
+
+
Schéma du numéro fiscal:
+
+
+
+
Autres informations légales:
+
+
+
+
Code devise de la TVA:
+
+
+
+
+
+
+
+
+
+
+
Informations sur l'acheteur
+
+
+
Nom commercial différent :
+
+
+
+
Région:
+
+
+
+
Adresse électronique:
+
+
+
+
Schéma de l'adresse électronique:
+
+
+
+
Numéro d'enregistrement:
+
+
+
+
Schéma du numéro d'enregistrement:
+
+
+
+
Identifiant TVA:
+
+
+
+
Date de facturation de la TVA:
+
+
+
+
Code de date de règlement de la TVA:
+
+
+
+
Informations sur l'attribution de compte:
+
+
+
+
+
+
+
+
+
+
+
Informations sur le contrat
+
+
+
Numéro d'attribution:
+
+
+
+
Identifiant de l'accusé de réception:
+
+
+
+
Identifiant du bordereau d'expédition:
+
+
+
+
Identifiant processus:
+
+
+
+
Identifiant spécification:
+
urn:cen.eu:en16931:2017
+
+
+
Identifiant objet:
+
+
+
+
Schéma de l'Identifiant objet:
+
+
+
+
+
+
+
+
+
+
Nous n'assumons aucune responsabilité quant à l'exactitude des données.
+
+
+
+
Documents justificatifs
+
+
+
+
+
+
+
+
+
Historique de traitement
+
+
+
+
+
+
+ \ No newline at end of file From 07b44464c50ef3805a2bad575ed256f51722271d Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 18 Jun 2024 21:14:42 +0200 Subject: [PATCH 04/10] Version bump --- validator/pom.xml | 39 ++++--------------- .../validator/ResourceCase.java | 3 ++ 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/validator/pom.xml b/validator/pom.xml index 6f35fd21..a14871ed 100644 --- a/validator/pom.xml +++ b/validator/pom.xml @@ -40,35 +40,22 @@ library 3.0.0-SNAPSHOT
- - - javax.xml.bind - jaxb-api - 2.1 - - - - org.dom4j - dom4j - 2.1.3 - - ch.qos.logback logback-classic - 1.2.13 + 1.5.6 ch.qos.logback logback-core - 1.2.13 + 1.5.6 org.codehaus.janino janino - 3.1.7 + 3.1.8 @@ -82,23 +69,13 @@ org.verapdf validation-model - 1.22.2 + 1.26.1 com.helger.schematron ph-schematron-xslt - 6.3.3 - - - com.helger - ph-jaxb - 9.5.5 - - - org.mustangproject - library - 3.0.0-SNAPSHOT + 8.0.0 org.xmlunit @@ -120,13 +97,13 @@ org.junit.jupiter junit-jupiter-api - 5.9.1 + 5.10.2 test org.junit.vintage junit-vintage-engine - 5.9.1 + 5.10.2 test @@ -328,7 +305,7 @@ com.helger.maven ph-schematron-maven-plugin - 5.6.0 + 8.0.0 ${basedir}/src/main/resources/schematron ${basedir}/src/main/resources/xslt diff --git a/validator/src/test/java/org/mustangproject/validator/ResourceCase.java b/validator/src/test/java/org/mustangproject/validator/ResourceCase.java index 27ff2755..621da5ef 100644 --- a/validator/src/test/java/org/mustangproject/validator/ResourceCase.java +++ b/validator/src/test/java/org/mustangproject/validator/ResourceCase.java @@ -6,10 +6,13 @@ import java.io.IOException; import java.io.InputStream; import org.apache.commons.io.IOUtils; +import org.junit.Ignore; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import junit.framework.TestCase; + +@Ignore public class ResourceCase extends TestCase { private static final Logger LOGGER = LoggerFactory.getLogger(ResourceCase.class.getCanonicalName()); // log output is From c94b3da52c184f6123bc02dd1df8c850b86b246f Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 18 Jun 2024 21:16:09 +0200 Subject: [PATCH 05/10] Version bump --- Mustang-CLI/pom.xml | 10 +++++----- validator/pom.xml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Mustang-CLI/pom.xml b/Mustang-CLI/pom.xml index 4ec10658..48bfcfe9 100644 --- a/Mustang-CLI/pom.xml +++ b/Mustang-CLI/pom.xml @@ -30,24 +30,24 @@ commons-cli commons-cli - 1.5.0 + 1.8.0 org.riversun bigdoc - 0.3.0 + 0.4.0 org.junit.jupiter junit-jupiter-api - 5.9.1 + 5.10.2 test org.junit.vintage junit-vintage-engine - 5.9.1 + 5.10.2 test @@ -59,7 +59,7 @@ org.xmlunit xmlunit-assertj - 2.9.1 + 2.10.0 diff --git a/validator/pom.xml b/validator/pom.xml index a14871ed..e6de0a9b 100644 --- a/validator/pom.xml +++ b/validator/pom.xml @@ -92,7 +92,7 @@ org.riversun bigdoc - 0.3.0 + 0.4.0 org.junit.jupiter From f9110281358bfafc4f358377670ef1d940e97cba Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 18 Jun 2024 21:18:37 +0200 Subject: [PATCH 06/10] Renamed class --- ...akartaUpdateMitigation.java => PDFBoxUpdateMitigation.java} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename library/src/main/java/org/mustangproject/ZUGFeRD/{JakartaUpdateMitigation.java => PDFBoxUpdateMitigation.java} (96%) diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/JakartaUpdateMitigation.java b/library/src/main/java/org/mustangproject/ZUGFeRD/PDFBoxUpdateMitigation.java similarity index 96% rename from library/src/main/java/org/mustangproject/ZUGFeRD/JakartaUpdateMitigation.java rename to library/src/main/java/org/mustangproject/ZUGFeRD/PDFBoxUpdateMitigation.java index 203b5b45..ce21d978 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/JakartaUpdateMitigation.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/PDFBoxUpdateMitigation.java @@ -73,6 +73,7 @@ final class ByteArrayDataSource implements DataSource } } +// Try to create an API similar to the 2.x one final class PreflightParserHelper { private static File createTmpFile (InputStream input) throws IOException @@ -98,7 +99,7 @@ final class PreflightParserHelper } } -final class JakartaUpdateMitigation +final class PDFBoxUpdateMitigation { // Dummy for the name only } From 2d245665f4f066c5f2487c70f13738dfa35dfe85 Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 18 Jun 2024 21:48:13 +0200 Subject: [PATCH 07/10] Avoid valid result in case of exception --- .../main/java/org/mustangproject/validator/ZUGFeRDValidator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/validator/src/main/java/org/mustangproject/validator/ZUGFeRDValidator.java b/validator/src/main/java/org/mustangproject/validator/ZUGFeRDValidator.java index 981d732f..d87eb83f 100644 --- a/validator/src/main/java/org/mustangproject/validator/ZUGFeRDValidator.java +++ b/validator/src/main/java/org/mustangproject/validator/ZUGFeRDValidator.java @@ -322,6 +322,7 @@ public class ZUGFeRDValidator { } } catch (IrrecoverableValidationError | IOException irx) { LOGGER.info(irx.getMessage()); + context.setInvalid (); } finally { finalStringResult.append(context.getXMLResult()); finalStringResult.append(""); From ef5babb38e51af4f083248871951e6e3b33771af Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 18 Jun 2024 22:08:14 +0200 Subject: [PATCH 08/10] Fix NullPointerException --- .../main/java/org/mustangproject/validator/PDFValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/validator/src/main/java/org/mustangproject/validator/PDFValidator.java b/validator/src/main/java/org/mustangproject/validator/PDFValidator.java index 629c632e..cdd4db86 100644 --- a/validator/src/main/java/org/mustangproject/validator/PDFValidator.java +++ b/validator/src/main/java/org/mustangproject/validator/PDFValidator.java @@ -129,7 +129,7 @@ public class PDFValidator extends Validator { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final Document docXMP; - if (xmp.length() == 0) { + if (xmp == null || xmp.length() == 0) { context.addResultItem(new ValidationResultItem(ESeverity.error, "Invalid XMP Metadata not found") .setSection(17).setPart(EPart.pdf)); } From 73e35fdd46fb8dd8efd30c4a31307966f9acf6ad Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 18 Jun 2024 22:08:32 +0200 Subject: [PATCH 09/10] Using Verapdf for Jakarta --- validator/pom.xml | 2 +- .../mustangproject/validator/ZUGFeRDValidator.java | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/validator/pom.xml b/validator/pom.xml index e6de0a9b..f07ff5cb 100644 --- a/validator/pom.xml +++ b/validator/pom.xml @@ -68,7 +68,7 @@ org.verapdf - validation-model + validation-model-jakarta 1.26.1 diff --git a/validator/src/main/java/org/mustangproject/validator/ZUGFeRDValidator.java b/validator/src/main/java/org/mustangproject/validator/ZUGFeRDValidator.java index d87eb83f..554944dd 100644 --- a/validator/src/main/java/org/mustangproject/validator/ZUGFeRDValidator.java +++ b/validator/src/main/java/org/mustangproject/validator/ZUGFeRDValidator.java @@ -1,6 +1,12 @@ package org.mustangproject.validator; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringReader; +import java.io.StringWriter; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; @@ -11,7 +17,6 @@ import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; -import javax.xml.bind.annotation.adapters.HexBinaryAdapter; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -28,6 +33,8 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.InputSource; +import jakarta.xml.bind.annotation.adapters.HexBinaryAdapter; + //abstract class public class ZUGFeRDValidator { private static final Logger LOGGER = LoggerFactory.getLogger(ZUGFeRDValidator.class.getCanonicalName()); // log From 95d00f7a5844fee7220189b86140604fb05231d2 Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Tue, 18 Jun 2024 22:10:46 +0200 Subject: [PATCH 10/10] Fixed another NPR --- .../src/main/java/org/mustangproject/validator/PDFValidator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/validator/src/main/java/org/mustangproject/validator/PDFValidator.java b/validator/src/main/java/org/mustangproject/validator/PDFValidator.java index cdd4db86..e9c04eb3 100644 --- a/validator/src/main/java/org/mustangproject/validator/PDFValidator.java +++ b/validator/src/main/java/org/mustangproject/validator/PDFValidator.java @@ -133,6 +133,7 @@ public class PDFValidator extends Validator { context.addResultItem(new ValidationResultItem(ESeverity.error, "Invalid XMP Metadata not found") .setSection(17).setPart(EPart.pdf)); } + else /* * checking for sth like EXTENDED * INVOICE