Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 35 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@

## 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
- 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
Expand Down Expand Up @@ -63,22 +69,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"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<active pattern="peppol-cii-pattern-0-b"/>
<active pattern="peppol-cii-pattern-1"/>
</phase>
<include href="XRechnung_2.3_COMMON.sch"/>
<include href="XRechnung_3.2_COMMON.sch"/>
<!--BEGIN Functions from PEPPOL-->
<function xmlns="http://www.w3.org/1999/XSL/Transform"
name="u:gln"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<active pattern="peppol-ubl-pattern-1"/>
<active pattern="peppol-ubl-pattern-2"/>
</phase>
<include href="XRechnung_2.3_COMMON.sch"/>
<include href="XRechnung_3.2_COMMON.sch"/>
<!--BEGIN Functions from PEPPOL-->
<function xmlns="http://www.w3.org/1999/XSL/Transform"
name="u:gln"
Expand Down
Loading