Skip to content

Commit

Permalink
Added support for Peppol Italy rules 3.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Feb 18, 2024
1 parent 2f91508 commit f5d0915
Show file tree
Hide file tree
Showing 115 changed files with 72,700 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ I hope that with the introduction of PINT, the versioning problem will be solved
* XRechnung 3.0.1 rules updated to reference EN 16931 rules 1.3.11 (was 1.3.10)
* Added Peppol A-NZ-PEPPOL 1.0.10 rules
* Moved Peppol A-NZ-PEPPOL 1.0.7 and 1.0.8 rules from `phive-rules-peppol` to `phive-rules-peppol-legacy`
* Added support for Peppol Italy rules 3.0.2 (AGID Credit Note, Despatch Advice, Invoice, Order, Order Agreement and Order Response)
* v3.1.6 - 2023-11-30
* Added Peppol November 2023 release (Billing 3.0.16 and Upgrade 3.0.12)
* Moved Peppol 3.15.0 rules from `phive-rules-peppol` to `phive-rules-peppol-legacy`
Expand Down
20 changes: 10 additions & 10 deletions phive-rules-peppol-italy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/rule-source/2.3.0/peppolbis-trdm016-3.0-despatch-advice/Schematron/ENG</schematronDirectory>
<schematronDirectory>src/test/resources/external/rule-source/3.0.2/peppolbis-trdm016-3.0-despatch-advice/Schematron/ENG</schematronDirectory>
<schematronPattern>*.sch</schematronPattern>
<xsltDirectory>src/main/resources/schematron/peppol-italy/2.3.0/despatch-advice</xsltDirectory>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/3.0.2/despatch-advice</xsltDirectory>
</configuration>
</execution>
-->
Expand All @@ -115,9 +115,9 @@
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/rule-source/2.3.0/peppolbis-en16931-ubl-3.0-invoice/Schematron/ENG</schematronDirectory>
<schematronDirectory>src/test/resources/external/rule-source/3.0.2/peppolbis-en16931-ubl-3.0-invoice/Schematron/ENG</schematronDirectory>
<schematronPattern>*.sch</schematronPattern>
<xsltDirectory>src/main/resources/schematron/peppol-italy/2.3.0/invoice</xsltDirectory>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/3.0.2/invoice</xsltDirectory>
</configuration>
</execution>
-->
Expand All @@ -128,9 +128,9 @@
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/rule-source/2.3.0/peppolbis-trdm001-3.0-order/Schematron/ENG</schematronDirectory>
<schematronDirectory>src/test/resources/external/rule-source/3.0.2/peppolbis-trdm001-3.0-order/Schematron/ENG</schematronDirectory>
<schematronPattern>*.sch</schematronPattern>
<xsltDirectory>src/main/resources/schematron/peppol-italy/2.3.0/order</xsltDirectory>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/3.0.2/order</xsltDirectory>
</configuration>
</execution>
-->
Expand All @@ -141,9 +141,9 @@
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/rule-source/2.3.0/peppolbis-trdm110-3.0-order-agreement/Schematron/ENG</schematronDirectory>
<schematronDirectory>src/test/resources/external/rule-source/3.0.2/peppolbis-trdm110-3.0-order-agreement/Schematron/ENG</schematronDirectory>
<schematronPattern>*.sch</schematronPattern>
<xsltDirectory>src/main/resources/schematron/peppol-italy/2.3.0/order-agreement</xsltDirectory>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/3.0.2/order-agreement</xsltDirectory>
</configuration>
</execution>
-->
Expand All @@ -154,9 +154,9 @@
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/rule-source/2.3.0/peppolbis-trdm076-3.0-order-response/Schematron/ENG</schematronDirectory>
<schematronDirectory>src/test/resources/external/rule-source/3.0.2/peppolbis-trdm076-3.0-order-response/Schematron/ENG</schematronDirectory>
<schematronPattern>*.sch</schematronPattern>
<xsltDirectory>src/main/resources/schematron/peppol-italy/2.3.0/order-response</xsltDirectory>
<xsltDirectory>src/main/resources/external/schematron/peppol-italy/3.0.2/order-response</xsltDirectory>
</configuration>
</execution>
-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ public static void init (@Nonnull final IValidationExecutorSetRegistry <IValidat

PeppolItalyValidation2_2_9.init (aRegistry);
PeppolItalyValidation2_3_0.init (aRegistry);
PeppolItalyValidation3_0_2.init (aRegistry);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/*
* Copyright (C) 2014-2024 Philip Helger (www.helger.com)
* philip[at]helger[dot]com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.helger.phive.peppol.italy;

import javax.annotation.Nonnull;
import javax.annotation.concurrent.Immutable;

import com.helger.commons.ValueEnforcer;
import com.helger.commons.io.resource.ClassPathResource;
import com.helger.commons.io.resource.IReadableResource;
import com.helger.diver.api.version.VESID;
import com.helger.phive.api.executorset.IValidationExecutorSetRegistry;
import com.helger.phive.api.executorset.ValidationExecutorSet;
import com.helger.phive.xml.schematron.ValidationExecutorSchematron;
import com.helger.phive.xml.source.IValidationSourceXML;
import com.helger.phive.xml.xsd.ValidationExecutorXSD;
import com.helger.ubl21.UBL21Marshaller;
import com.helger.ubl21.UBL21NamespaceContext;

/**
* Italian Peppol validation artefacts based on BIS 3.0.14.
*
* @author Philip Helger
*/
@Immutable
public final class PeppolItalyValidation3_0_2
{
// Standard resources
public static final String VERSION_STR = "3.0.2";

// Standard
private static final String GROUP_ID = "it.peppol";

public static final VESID VID_CREDIT_NOTE = new VESID (GROUP_ID, "creditnote", VERSION_STR);
public static final VESID VID_DESPATCH_ADVICE = new VESID (GROUP_ID, "despatch-advice", VERSION_STR);
public static final VESID VID_INVOICE = new VESID (GROUP_ID, "invoice", VERSION_STR);
public static final VESID VID_ORDER = new VESID (GROUP_ID, "order", VERSION_STR);
public static final VESID VID_ORDER_AGREEMENT = new VESID (GROUP_ID, "order-agreement", VERSION_STR);
public static final VESID VID_ORDER_RESPONSE = new VESID (GROUP_ID, "order-response", VERSION_STR);

@Nonnull
private static ClassLoader _getCL ()
{
return PeppolItalyValidation3_0_2.class.getClassLoader ();
}

private static final String PREFIX_XSLT = "external/schematron/peppol-italy/" + VERSION_STR + "/";

private static final IReadableResource DESPATCH_ADVICE = new ClassPathResource (PREFIX_XSLT +
"despatch-advice/AGID-PEPPOL-T16.xslt",
_getCL ());
private static final IReadableResource INVOICE = new ClassPathResource (PREFIX_XSLT + "invoice/AGID-EN16931-UBL.xslt",
_getCL ());
private static final IReadableResource ORDER = new ClassPathResource (PREFIX_XSLT + "order/AGID-PEPPOL-T01.xslt",
_getCL ());
private static final IReadableResource ORDER_AGREEMENT = new ClassPathResource (PREFIX_XSLT +
"order-agreement/AGID-PEPPOL-T110.xslt",
_getCL ());
private static final IReadableResource ORDER_RESPONSE = new ClassPathResource (PREFIX_XSLT +
"order-response/AGID-PEPPOL-T76.xslt",
_getCL ());

private PeppolItalyValidation3_0_2 ()
{}

@Nonnull
private static ValidationExecutorSchematron _createXSLT (@Nonnull final IReadableResource aRes)
{
return ValidationExecutorSchematron.createXSLT (aRes, UBL21NamespaceContext.getInstance ());
}

public static void init (@Nonnull final IValidationExecutorSetRegistry <IValidationSourceXML> aRegistry)
{
ValueEnforcer.notNull (aRegistry, "Registry");

final String sVersion = " (" + VERSION_STR + ")";
final String sAkaVersionBIS = " (for BIS 3.0.14)";

final boolean bNotDeprecated = false;

aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_DESPATCH_ADVICE,
"AGID Peppol Despatch Advice" +
sVersion +
sAkaVersionBIS,
bNotDeprecated,
ValidationExecutorXSD.create (UBL21Marshaller.getAllDespatchAdviceXSDs ()),
_createXSLT (DESPATCH_ADVICE)));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_INVOICE,
"AGID Peppol Invoice" +
sVersion +
sAkaVersionBIS,
bNotDeprecated,
ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()),
_createXSLT (INVOICE)));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_CREDIT_NOTE,
"AGID Peppol Credit Note" +
sVersion +
sAkaVersionBIS,
bNotDeprecated,
ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()),
_createXSLT (INVOICE)));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_ORDER,
"AGID Peppol Order" +
sVersion +
sAkaVersionBIS,
bNotDeprecated,
ValidationExecutorXSD.create (UBL21Marshaller.getAllOrderXSDs ()),
_createXSLT (ORDER)));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_ORDER_AGREEMENT,
"AGID Peppol Order Agreement" +
sVersion +
sAkaVersionBIS,
bNotDeprecated,
ValidationExecutorXSD.create (UBL21Marshaller.getAllOrderResponseXSDs ()),
_createXSLT (ORDER_AGREEMENT)));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_ORDER_RESPONSE,
"AGID Peppol Order Response" +
sVersion +
sAkaVersionBIS,
bNotDeprecated,
ValidationExecutorXSD.create (UBL21Marshaller.getAllOrderResponseXSDs ()),
_createXSLT (ORDER_RESPONSE)));
}
}
Loading

0 comments on commit f5d0915

Please sign in to comment.