Skip to content

Commit

Permalink
Merge pull request #100 from OpenPEPPOL/poacc-528
Browse files Browse the repository at this point in the history
ResponseTypeCode check not having order lines
  • Loading branch information
jerouris authored Mar 18, 2024
2 parents 1e30c4d + 0505c15 commit 7b60357
Show file tree
Hide file tree
Showing 12 changed files with 354 additions and 5 deletions.
5 changes: 5 additions & 0 deletions guides/release-notes/v3.0.13.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Release date:: May 2024
* Order transaction (T01)

* Order Response transaction (T76)
* Order Response transaction Advanced (T116)

* Catalogue transaction (T19)
** Added possibility (by use of a code) to indicate if an item is non-returnable after purchase. The element cac:TransactionConditions/cbc:ActionCode on item-level is used and the code is added to the codelist "Transaction condition code (OpenPeppol)", together with the previous code to indicate if an item is contracted (CT). The element cbc:ActionCode was previously fixed to the value 'CT' since it was the only allowed code, but with this change, it can be used for both purposes.
Expand All @@ -24,4 +25,8 @@ Release date:: May 2024

* Added rule to check that an OrderResponse with ResponseTypeCode CA (accepted with amendment on line level) actually has order response lines. The rule is introduced with severity warning and will be changed to severity fatal in next release. The rule is added to both T76 (Order Responseand) and T116 (Order Response Advanced).

* Added rule to check that an OrderResponse with ResponseTypeCode AP or RE should not have order response lines. The rule is introduced with severity warning and will be changed to severity fatal in next release. The rule is added to both T76 (Order Responseand) and T116 (Order Response Advanced).

* Added rule to check that an OrderResponse with ResponseTypeCode AB must not have order response lines. The rule is introduced with severity error. The rule is added to both T76 (Order Responseand) and T116 (Order Response Advanced).

== Other
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<cbc:ID>101</cbc:ID>
<cbc:IssueDate>2013-07-01</cbc:IssueDate>
<cbc:IssueTime>14:23:26</cbc:IssueTime>
<cbc:OrderResponseCode>AP</cbc:OrderResponseCode>
<cbc:OrderResponseCode>CA</cbc:OrderResponseCode>
<cbc:Note>Response message with item identifiers</cbc:Note>
<cbc:DocumentCurrencyCode listID="ISO4217">EUR</cbc:DocumentCurrencyCode>
<cbc:CustomerReference>92487ksdhfj</cbc:CustomerReference>
Expand Down
2 changes: 1 addition & 1 deletion rules/examples/OrderResponseAdvanced_Example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<cbc:SalesOrderID>101-111</cbc:SalesOrderID>
<cbc:IssueDate>2022-04-01</cbc:IssueDate>
<cbc:IssueTime>06:10:10</cbc:IssueTime>
<cbc:OrderResponseCode>AP</cbc:OrderResponseCode>
<cbc:OrderResponseCode>CA</cbc:OrderResponseCode>
<cbc:Note>Response message with amendments in the details</cbc:Note>
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
<cbc:CustomerReference>ABC-123</cbc:CustomerReference>
Expand Down
2 changes: 1 addition & 1 deletion rules/examples/OrderResponse_Example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<cbc:SalesOrderID>101-111</cbc:SalesOrderID>
<cbc:IssueDate>2013-07-01</cbc:IssueDate>
<cbc:IssueTime>06:10:10</cbc:IssueTime>
<cbc:OrderResponseCode>AP</cbc:OrderResponseCode>
<cbc:OrderResponseCode>CA</cbc:OrderResponseCode>
<cbc:Note>Response message with amendments in the details</cbc:Note>
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
<cbc:CustomerReference>ABC-123</cbc:CustomerReference>
Expand Down
9 changes: 9 additions & 0 deletions rules/sch/parts/PEPPOL-M-T116.sch
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@
<assert id="PEPPOL-T116-R007"
test="(normalize-space(.) = 'CA' and count(../cac:OrderLine) > 0) or normalize-space(.) != 'CA'"
flag="warning">An order response with code CA (Conditionally accepted) must provide order lines.</assert>
<assert id="PEPPOL-T116-R008"
test="(normalize-space(.) = 'AP' and count(../cac:OrderLine) = 0) or normalize-space(.) != 'AP'"
flag="warning">An order response with code AP (Accepted) should NOT provide order lines.</assert>
<assert id="PEPPOL-T116-R009"
test="(normalize-space(.) = 'RE' and count(../cac:OrderLine) = 0) or normalize-space(.) != 'RE'"
flag="warning">An order response with code RE (Rejected) should NOT provide order lines.</assert>
<assert id="PEPPOL-T116-R010"
test="(normalize-space(.) = 'AB' and count(../cac:OrderLine) = 0) or normalize-space(.) != 'AB'"
flag="fatal">An order response with code AB (Acknowledged) must NOT provide order lines.</assert>
</rule>


Expand Down
13 changes: 11 additions & 2 deletions rules/sch/parts/PEPPOL-M-T76.sch
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,17 @@

<rule context="cbc:OrderResponseCode">
<assert id="PEPPOL-T76-R007"
test="(normalize-space(.) = 'CA' and count(../cac:OrderLine) > 0) or normalize-space(.) != 'CA'"
flag="warning">An order response with code CA (Conditionally accepted) must provide order lines.</assert>
test="(normalize-space(.) = 'CA' and count(../cac:OrderLine) > 0) or normalize-space(.) != 'CA'"
flag="warning">An order response with code CA (Conditionally accepted) must provide order lines.</assert>
<assert id="PEPPOL-T76-R008"
test="(normalize-space(.) = 'AP' and count(../cac:OrderLine) = 0) or normalize-space(.) != 'AP'"
flag="warning">An order response with code AP (Accepted) should NOT provide order lines.</assert>
<assert id="PEPPOL-T76-R009"
test="(normalize-space(.) = 'RE' and count(../cac:OrderLine) = 0) or normalize-space(.) != 'RE'"
flag="warning">An order response with code RE (Rejected) should NOT provide order lines.</assert>
<assert id="PEPPOL-T76-R010"
test="(normalize-space(.) = 'AB' and count(../cac:OrderLine) = 0) or normalize-space(.) != 'AB'"
flag="fatal">An order response with code AB (Acknowledged) must NOT provide order lines.</assert>
</rule>

</pattern>
54 changes: 54 additions & 0 deletions rules/unit-order-response-advanced/PEPPOL-T116-R008.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<testSet xmlns="http://difi.no/xsd/vefa/validator/1.0"
configuration="peppolbis-t76-base-3.0">
<assert>
<description>An order response with code AP (Accepted) should NOT provide order lines.</description>
<scope>PEPPOL-T116-R008</scope>
</assert>

<test>

<assert>
<success>PEPPOL-T116-R008</success>
</assert>

<OrderResponse xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2">

<cbc:OrderResponseCode>AP</cbc:OrderResponseCode>

<!-- <cac:OrderLine>
<cac:LineItem>
<cac:Price>
<cbc:PriceAmount currencyID="EUR"/>
</cac:Price>
</cac:LineItem>
</cac:OrderLine>-->

</OrderResponse>
</test>

<test>
<assert>
<warning>PEPPOL-T116-R008</warning>
</assert>

<OrderResponse xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2">

<cbc:OrderResponseCode>AP</cbc:OrderResponseCode>

<cac:OrderLine>
<cac:LineItem>
<cac:Price>
<cbc:PriceAmount currencyID="EUR"/>
</cac:Price>
</cac:LineItem>
</cac:OrderLine>

</OrderResponse>
</test>

</testSet>
55 changes: 55 additions & 0 deletions rules/unit-order-response-advanced/PEPPOL-T116-R009.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<testSet xmlns="http://difi.no/xsd/vefa/validator/1.0"
configuration="peppolbis-t76-base-3.0">
<assert>
<description>An order response with code RE (Rejected) should NOT provide order lines.</description>
<scope>PEPPOL-T116-R009</scope>
</assert>

<test>

<assert>
<success>PEPPOL-T116-R009</success>
</assert>

<OrderResponse xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2">

<cbc:OrderResponseCode>RE</cbc:OrderResponseCode>

<!-- <cac:OrderLine>
<cac:LineItem>
<cac:Price>
<cbc:PriceAmount currencyID="EUR"/>
</cac:Price>
</cac:LineItem>
</cac:OrderLine>-->

</OrderResponse>
</test>

<test>
<assert>
<warning>PEPPOL-T116-R009</warning>
</assert>

<OrderResponse xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2">

<cbc:OrderResponseCode>RE</cbc:OrderResponseCode>

<cac:OrderLine>
<cac:LineItem>
<cac:Price>
<cbc:PriceAmount currencyID="EUR"/>
</cac:Price>
</cac:LineItem>
</cac:OrderLine>

</OrderResponse>
</test>


</testSet>
54 changes: 54 additions & 0 deletions rules/unit-order-response-advanced/PEPPOL-T116-R010.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<testSet xmlns="http://difi.no/xsd/vefa/validator/1.0"
configuration="peppolbis-t76-base-3.0">
<assert>
<description>An order response with code AB (Acknowledged) must NOT provide order lines.</description>
<scope>PEPPOL-T116-R010</scope>
</assert>

<test>

<assert>
<success>PEPPOL-T116-R010</success>
</assert>

<OrderResponse xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2">

<cbc:OrderResponseCode>AB</cbc:OrderResponseCode>

<!-- <cac:OrderLine>
<cac:LineItem>
<cac:Price>
<cbc:PriceAmount currencyID="EUR"/>
</cac:Price>
</cac:LineItem>
</cac:OrderLine>-->

</OrderResponse>
</test>

<test>
<assert>
<error>PEPPOL-T116-R010</error>
</assert>

<OrderResponse xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2">

<cbc:OrderResponseCode>AB</cbc:OrderResponseCode>

<cac:OrderLine>
<cac:LineItem>
<cac:Price>
<cbc:PriceAmount currencyID="EUR"/>
</cac:Price>
</cac:LineItem>
</cac:OrderLine>

</OrderResponse>
</test>

</testSet>
54 changes: 54 additions & 0 deletions rules/unit-order-response/PEPPOL-T76-R008.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<testSet xmlns="http://difi.no/xsd/vefa/validator/1.0"
configuration="peppolbis-t76-base-3.0">
<assert>
<description>An order response with code AP (Accepted) should NOT provide order lines.</description>
<scope>PEPPOL-T76-R008</scope>
</assert>

<test>

<assert>
<success>PEPPOL-T76-R008</success>
</assert>

<OrderResponse xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2">

<cbc:OrderResponseCode>AP</cbc:OrderResponseCode>

<!-- <cac:OrderLine>
<cac:LineItem>
<cac:Price>
<cbc:PriceAmount currencyID="EUR"/>
</cac:Price>
</cac:LineItem>
</cac:OrderLine>-->

</OrderResponse>
</test>

<test>
<assert>
<warning>PEPPOL-T76-R008</warning>
</assert>

<OrderResponse xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2">

<cbc:OrderResponseCode>AP</cbc:OrderResponseCode>

<cac:OrderLine>
<cac:LineItem>
<cac:Price>
<cbc:PriceAmount currencyID="EUR"/>
</cac:Price>
</cac:LineItem>
</cac:OrderLine>

</OrderResponse>
</test>

</testSet>
55 changes: 55 additions & 0 deletions rules/unit-order-response/PEPPOL-T76-R009.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<testSet xmlns="http://difi.no/xsd/vefa/validator/1.0"
configuration="peppolbis-t76-base-3.0">
<assert>
<description>An order response with code RE (Rejected) should NOT provide order lines.</description>
<scope>PEPPOL-T76-R009</scope>
</assert>

<test>

<assert>
<success>PEPPOL-T76-R009</success>
</assert>

<OrderResponse xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2">

<cbc:OrderResponseCode>RE</cbc:OrderResponseCode>

<!-- <cac:OrderLine>
<cac:LineItem>
<cac:Price>
<cbc:PriceAmount currencyID="EUR"/>
</cac:Price>
</cac:LineItem>
</cac:OrderLine>-->

</OrderResponse>
</test>

<test>
<assert>
<warning>PEPPOL-T76-R009</warning>
</assert>

<OrderResponse xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:OrderResponse-2">

<cbc:OrderResponseCode>RE</cbc:OrderResponseCode>

<cac:OrderLine>
<cac:LineItem>
<cac:Price>
<cbc:PriceAmount currencyID="EUR"/>
</cac:Price>
</cac:LineItem>
</cac:OrderLine>

</OrderResponse>
</test>


</testSet>
Loading

0 comments on commit 7b60357

Please sign in to comment.