From 2553700336f3afed5026763f6db01e319de14736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20N=C3=B6hles?= Date: Thu, 30 Jan 2025 10:33:43 +0100 Subject: [PATCH 1/3] Update readme Add artifact version info Fix naming of xrechnung artefacts --- README.md | 41 +++++++++++++++---- .../XRechnungSchematronValidator.java | 4 +- ...nung_2.3_CII.sch => XRechnung_3.2_CII.sch} | 2 +- ....3_COMMON.sch => XRechnung_3.2_COMMON.sch} | 0 ...nung_2.3_UBL.sch => XRechnung_3.2_UBL.sch} | 2 +- 5 files changed, 38 insertions(+), 11 deletions(-) rename src/main/resources/XRechnung/{XRechnung_2.3_CII.sch => XRechnung_3.2_CII.sch} (99%) rename src/main/resources/XRechnung/{XRechnung_2.3_COMMON.sch => XRechnung_3.2_COMMON.sch} (100%) rename src/main/resources/XRechnung/{XRechnung_2.3_UBL.sch => XRechnung_3.2_UBL.sch} (99%) diff --git a/README.md b/README.md index b9edfec..16b4b6c 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,16 @@ ## Introduction `e-invoice-validator` is a small service for validating XML against the official -EN16931 schematron rules. It exposes a validation endpoint which takes the +schematron rules of factur-x, Peppol BIS, XRechnung and EN16931. It exposes a validation endpoint which takes the to be validated XML and returns a JSON payload which contains possible warnings or errors. The HTTP status code indicates if the provided XML is valid (200) or has issues (400). UBL and CII is supported. -### Currently supported validation artifacts: [v1.3.13](https://github.com/ConnectingEurope/eInvoicing-EN16931/releases/tag/validation-1.3.13) +### Currently supported validation artifacts: + +- EN16931 v1.3.13 +- factur-x v1.07.2 +- XRechnung v3.2 +- Peppol BIS 3.0 ## Usage This service was mainly designed with containerization in mind. So general idea is to use the following @@ -63,22 +68,44 @@ final class EN16931Validator } } ``` +- Example response in case the XML is valid + +```JSON +{ + "meta": { + "xml_syntax_type": "CII", + "xml_profile_type": "FACTURX_EXTENDED" + }, + "errors": [], + "warnings": [], + "is_valid": true +} +``` + - Example response in case the XML is invalid ```JSON { "meta": { - "validation_profile": "UBL", - "validation_profile_version": "1.3.13" + "xml_syntax_type": "CII", + "xml_profile_type": "EN16931" }, "errors": [ { - "rule_id": "BR-03", - "rule_location": "/*:Invoice[namespace-uri()='urn:oasis:names:specification:ubl:schema:xsd:Invoice-2'][1]", + "rule_id": "BR-CO-15", + "rule_location": "/*:CrossIndustryInvoice[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]", + "rule_severity": "FATAL", + "rule_messages": [ + "[BR-CO-15]-Invoice total amount with VAT (BT-112) = Invoice total amount without VAT (BT-109) + Invoice total VAT amount (BT-110)." + ] + }, + { + "rule_id": "BR-CL-04", + "rule_location": "/*:CrossIndustryInvoice[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]/*:SupplyChainTradeTransaction[namespace-uri()='urn:un:unece:uncefact:data:standard:CrossIndustryInvoice:100'][1]/*:ApplicableHeaderTradeSettlement[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]/*:InvoiceCurrencyCode[namespace-uri()='urn:un:unece:uncefact:data:standard:ReusableAggregateBusinessInformationEntity:100'][1]", "rule_severity": "FATAL", "rule_messages": [ - "[BR-03]-An Invoice shall have an Invoice issue date (BT-2)." + "[BR-CL-04]-Invoice currency code MUST be coded using ISO code list 4217 alpha-3" ] } ], diff --git a/src/main/java/io/github/easybill/Services/Validators/XRechnungSchematronValidator.java b/src/main/java/io/github/easybill/Services/Validators/XRechnungSchematronValidator.java index bf0a546..da16a54 100644 --- a/src/main/java/io/github/easybill/Services/Validators/XRechnungSchematronValidator.java +++ b/src/main/java/io/github/easybill/Services/Validators/XRechnungSchematronValidator.java @@ -21,12 +21,12 @@ public final class XRechnungSchematronValidator public XRechnungSchematronValidator() { ciiSchematron = new SchematronResourceSCH( - new ClassPathResource("/XRechnung/XRechnung_2.3_CII.sch") + new ClassPathResource("/XRechnung/XRechnung_3.2_CII.sch") ); ublSchematron = new SchematronResourceSCH( - new ClassPathResource("/XRechnung/XRechnung_2.3_UBL.sch") + new ClassPathResource("/XRechnung/XRechnung_3.2_UBL.sch") ); if (!ciiSchematron.isValidSchematron()) { diff --git a/src/main/resources/XRechnung/XRechnung_2.3_CII.sch b/src/main/resources/XRechnung/XRechnung_3.2_CII.sch similarity index 99% rename from src/main/resources/XRechnung/XRechnung_2.3_CII.sch rename to src/main/resources/XRechnung/XRechnung_3.2_CII.sch index 24d2624..3bee025 100644 --- a/src/main/resources/XRechnung/XRechnung_2.3_CII.sch +++ b/src/main/resources/XRechnung/XRechnung_3.2_CII.sch @@ -44,7 +44,7 @@ - + - + Date: Thu, 30 Jan 2025 10:38:04 +0100 Subject: [PATCH 2/3] Fix fixture name for failing tests --- src/test/resources/Peppol/{Peppol_006.XML => Peppol_006.xml} | 0 src/test/resources/Peppol/{Peppol_014.XML => Peppol_014.xml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename src/test/resources/Peppol/{Peppol_006.XML => Peppol_006.xml} (100%) rename src/test/resources/Peppol/{Peppol_014.XML => Peppol_014.xml} (100%) diff --git a/src/test/resources/Peppol/Peppol_006.XML b/src/test/resources/Peppol/Peppol_006.xml similarity index 100% rename from src/test/resources/Peppol/Peppol_006.XML rename to src/test/resources/Peppol/Peppol_006.xml diff --git a/src/test/resources/Peppol/Peppol_014.XML b/src/test/resources/Peppol/Peppol_014.xml similarity index 100% rename from src/test/resources/Peppol/Peppol_014.XML rename to src/test/resources/Peppol/Peppol_014.xml From eabd248e427b6ea38ab96cb5559f72807bb5e08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20N=C3=B6hles?= Date: Thu, 30 Jan 2025 10:40:22 +0100 Subject: [PATCH 3/3] Updating readme to specify, that only the EN16931 and Extended profiles of factur-x is supported --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 16b4b6c..6ca1522 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,10 @@ provided XML is valid (200) or has issues (400). UBL and CII is supported. ### Currently supported validation artifacts: - EN16931 v1.3.13 -- factur-x v1.07.2 - XRechnung v3.2 - Peppol BIS 3.0 +- factur-x v1.07.2 + - (only the profiles EN16931 and EXTENDED are supported) ## Usage This service was mainly designed with containerization in mind. So general idea is to use the following