Skip to content

Commit

Permalink
Added Peppol PINT AU-NZ 1.0.1 rules
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Jul 24, 2024
1 parent 95fccff commit e42a541
Show file tree
Hide file tree
Showing 36 changed files with 16,305 additions and 72 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ I hope that with the introduction of PINT, the versioning problem will be solved

* v3.1.12 - work in progress
* Added Peppol PINT rules 1.0.2
* Added Peppol PINT AU-NZ 1.0.1 rules
* v3.1.11 - 2024-07-02
* Added Peppol May 2024 release (Billing 3.0.17 and Upgrade 3.0.13)
* Added Peppol A-NZ-PEPPOL 1.0.11 rules
Expand Down
12 changes: 12 additions & 0 deletions phive-rules-peppol/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,18 @@
</execution>
-->
<!--
<execution>
<id>pint-aunz</id>
<goals>
<goal>convert</goal>
</goals>
<configuration>
<schematronDirectory>src/test/resources/external/rule-source/pint-aunz/1.0.1</schematronDirectory>
<xsltDirectory>src/main/resources/external/schematron/pint-aunz/1.0.1/xslt</xsltDirectory>
</configuration>
</execution>
-->
<!--
<execution>
<id>pint-jp</id>
<goals>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,14 @@ public static void initStandard (@Nonnull final IValidationExecutorSetRegistry <
PeppolValidation2023_05.init (aRegistry);
PeppolValidation2023_11.init (aRegistry);
PeppolValidation2024_05.init (aRegistry);
PeppolValidationAUNZ.init (aRegistry);
PeppolValidationSG.init (aRegistry);
PeppolValidationBisAUNZ.init (aRegistry);
PeppolValidationBisSG.init (aRegistry);
PeppolValidationDirectory.init (aRegistry);
PeppolValidationReporting.init (aRegistry);
PeppolValidationPINT.init (aRegistry);
PeppolValidationJP.init (aRegistry);
PeppolValidationMY.init (aRegistry);
PeppolValidationPint.init (aRegistry);
PeppolValidationPintAUNZ.init (aRegistry);
PeppolValidationPintJP.init (aRegistry);
PeppolValidationPintMY.init (aRegistry);
}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
* @author Philip Helger
*/
@Immutable
public final class PeppolValidationAUNZ
public final class PeppolValidationBisAUNZ
{
@Nonnull
private static ClassLoader _getCL ()
{
return PeppolValidationAUNZ.class.getClassLoader ();
return PeppolValidationBisAUNZ.class.getClassLoader ();
}

private static final String BASE_PATH = "external/schematron/peppol-aunz/";
Expand Down Expand Up @@ -96,7 +96,7 @@ private static ClassLoader _getCL ()
"creditnote-self-billing",
"1.0.11");

private PeppolValidationAUNZ ()
private PeppolValidationBisAUNZ ()
{}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
* @author Philip Helger
*/
@Immutable
public final class PeppolValidationSG
public final class PeppolValidationBisSG
{
@Nonnull
private static ClassLoader _getCL ()
{
return PeppolValidationSG.class.getClassLoader ();
return PeppolValidationBisSG.class.getClassLoader ();
}

private static final String BASE_PATH = "external/schematron/peppol-sg/";
Expand All @@ -66,7 +66,7 @@ private static ClassLoader _getCL ()
"creditnote",
"2023.12");

private PeppolValidationSG ()
private PeppolValidationBisSG ()
{}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@
* @author Philip Helger
*/
@Immutable
public final class PeppolValidationPINT
public final class PeppolValidationPint
{
public static final String GROUP_ID = "org.peppol.pint";
private static final String BASE_PATH = "external/schematron/pint/";

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

// 1.0.0
Expand Down Expand Up @@ -77,7 +77,7 @@ private static ClassLoader _getCL ()
public static final VESID VID_OPENPEPPOL_PINT_INVOICE_1_0_2 = new VESID (GROUP_ID, "invoice", "1.0.2");
public static final VESID VID_OPENPEPPOL_PINT_CREDIT_NOTE_1_0_2 = new VESID (GROUP_ID, "credit-note", "1.0.2");

private PeppolValidationPINT ()
private PeppolValidationPint ()
{}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
/*
* 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;

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

import com.helger.commons.ValueEnforcer;
import com.helger.commons.io.resource.ClassPathResource;
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.api.executorset.status.IValidationExecutorSetStatus;
import com.helger.phive.api.executorset.status.ValidationExecutorSetStatus;
import com.helger.phive.xml.schematron.SchematronNamespaceBeautifier;
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.xml.namespace.MapBasedNamespaceContext;

/**
* Peppol Malaysia validation configuration
*
* @author Philip Helger
*/
@Immutable
public final class PeppolValidationPintAUNZ
{
@Nonnull
private static ClassLoader _getCL ()
{
return PeppolValidationPintAUNZ.class.getClassLoader ();
}

private static final String BASE_PATH = "external/schematron/pint-aunz/";
private static final String GROUP_ID = "org.peppol.pint.aunz";

// 1.0.1
public static final VESID VID_OPENPEPPOL_AUNZ_PINT_UBL_INVOICE_1_0_1 = new VESID (GROUP_ID, "invoice", "1.0.1");
public static final VESID VID_OPENPEPPOL_AUNZ_PINT_UBL_CREDIT_NOTE_1_0_1 = new VESID (GROUP_ID,
"creditnote",
"1.0.1");

private PeppolValidationPintAUNZ ()
{}

@Nonnull
private static IValidationExecutorSetStatus _createStatus (final boolean bIsDeprecated)
{
return ValidationExecutorSetStatus.createDeprecatedNow (bIsDeprecated);
}

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

final MapBasedNamespaceContext aNSCtxInvoice = PeppolValidation.createUBLNSContext (UBL21Marshaller.invoice ()
.getRootElementNamespaceURI ());
final MapBasedNamespaceContext aNSCtxCreditNote = PeppolValidation.createUBLNSContext (UBL21Marshaller.creditNote ()
.getRootElementNamespaceURI ());

// For better error messages (merge both)
SchematronNamespaceBeautifier.addMappings (aNSCtxCreditNote);

final boolean bNotDeprecated = false;

// 1.0.1
{
final String sBase = BASE_PATH + "1.0.1/xslt/";
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_OPENPEPPOL_AUNZ_PINT_UBL_INVOICE_1_0_1,
"AU-NZ PINT Invoice (UBL) 1.0.1",
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()),
ValidationExecutorSchematron.createXSLT (new ClassPathResource (sBase +
"PINT-UBL-validation-preprocessed-inv.xslt",
_getCL ()),
aNSCtxInvoice),
ValidationExecutorSchematron.createXSLT (new ClassPathResource (sBase +
"PINT-jurisdiction-aligned-rules-inv.xslt",
_getCL ()),
aNSCtxInvoice)));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_OPENPEPPOL_AUNZ_PINT_UBL_CREDIT_NOTE_1_0_1,
"AU-NZ PINT Credit Note (UBL) 1.0.1",
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()),
ValidationExecutorSchematron.createXSLT (new ClassPathResource (sBase +
"PINT-UBL-validation-preprocessed-cn.xslt",
_getCL ()),
aNSCtxInvoice),
ValidationExecutorSchematron.createXSLT (new ClassPathResource (sBase +
"PINT-jurisdiction-aligned-rules-cn.xslt",
_getCL ()),
aNSCtxInvoice)));

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
* @author Philip Helger
*/
@Immutable
public final class PeppolValidationJP
public final class PeppolValidationPintJP
{
@Nonnull
private static ClassLoader _getCL ()
{
return PeppolValidationJP.class.getClassLoader ();
return PeppolValidationPintJP.class.getClassLoader ();
}

private static final String BASE_PATH = "external/schematron/pint-jp/";
Expand All @@ -55,7 +55,7 @@ private static ClassLoader _getCL ()
"credit-note",
"0.1.2");

private PeppolValidationJP ()
private PeppolValidationPintJP ()
{}

@Nonnull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
* @author Philip Helger
*/
@Immutable
public final class PeppolValidationMY
public final class PeppolValidationPintMY
{
@Nonnull
private static ClassLoader _getCL ()
{
return PeppolValidationMY.class.getClassLoader ();
return PeppolValidationPintMY.class.getClassLoader ();
}

private static final String BASE_PATH = "external/schematron/pint-my/";
Expand All @@ -60,7 +60,7 @@ private static ClassLoader _getCL ()
"creditnote-self-billing",
"1.0.0");

private PeppolValidationMY ()
private PeppolValidationPintMY ()
{}

@Nonnull
Expand Down Expand Up @@ -95,15 +95,15 @@ public static void init (@Nonnull final IValidationExecutorSetRegistry <IValidat
"Malaysia PINT Invoice (UBL) 1.0.0",
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()),
ValidationExecutorSchematron.createXSLT (PeppolValidationPINT.RES_OPENPEPPOL_PINT_1_0_1,
ValidationExecutorSchematron.createXSLT (PeppolValidationPint.RES_OPENPEPPOL_PINT_1_0_1,
aNSCtxInvoice),
ValidationExecutorSchematron.createXSLT (aCPRBilling,
aNSCtxInvoice)));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_OPENPEPPOL_MY_PINT_UBL_CREDIT_NOTE_1_0_0,
"Malaysia PINT Credit Note (UBL) 1.0.0",
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()),
ValidationExecutorSchematron.createXSLT (PeppolValidationPINT.RES_OPENPEPPOL_PINT_1_0_1,
ValidationExecutorSchematron.createXSLT (PeppolValidationPint.RES_OPENPEPPOL_PINT_1_0_1,
aNSCtxCreditNote),
ValidationExecutorSchematron.createXSLT (aCPRBilling,
aNSCtxCreditNote)));
Expand All @@ -112,15 +112,15 @@ public static void init (@Nonnull final IValidationExecutorSetRegistry <IValidat
"Malaysia PINT Invoice Self-Billing (UBL) 1.0.0",
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllInvoiceXSDs ()),
ValidationExecutorSchematron.createXSLT (PeppolValidationPINT.RES_OPENPEPPOL_PINT_1_0_1,
ValidationExecutorSchematron.createXSLT (PeppolValidationPint.RES_OPENPEPPOL_PINT_1_0_1,
aNSCtxInvoice),
ValidationExecutorSchematron.createXSLT (aCPRSelfBilling,
aNSCtxInvoice)));
aRegistry.registerValidationExecutorSet (ValidationExecutorSet.create (VID_OPENPEPPOL_MY_PINT_UBL_CREDIT_NOTE_SELF_BILLING_1_0_0,
"Malaysia PINT Credit Note Self-Billing (UBL) 1.0.0",
_createStatus (bNotDeprecated),
ValidationExecutorXSD.create (UBL21Marshaller.getAllCreditNoteXSDs ()),
ValidationExecutorSchematron.createXSLT (PeppolValidationPINT.RES_OPENPEPPOL_PINT_1_0_1,
ValidationExecutorSchematron.createXSLT (PeppolValidationPint.RES_OPENPEPPOL_PINT_1_0_1,
aNSCtxCreditNote),
ValidationExecutorSchematron.createXSLT (aCPRSelfBilling,
aNSCtxCreditNote)));
Expand Down
Loading

0 comments on commit e42a541

Please sign in to comment.