Skip to content

Commit

Permalink
Allow 326 and 384 for DE only
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinForsberg-Ecru committed Oct 28, 2024
1 parent ef880ec commit e030538
Show file tree
Hide file tree
Showing 2 changed files with 221 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rules/sch/PEPPOL-EN16931-UBL.sch
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,12 @@ Last update: 2024 November release 3.0.18.
$profile != '01' or (some $code in tokenize('71 80 82 84 102 218 219 326 331 380 382 383 384 386 388 393 395 553 575 623 780 817 870 875 876 877', '\s')
satisfies normalize-space(text()) = $code)"
flag="fatal">Invoice type code MUST be set according to the profile.</assert>
<assert id="PEPPOL-EN16931-P0112"
test="not(normalize-space(.) = '326' or normalize-space(.) = '384') or ($supplierCountryIsDE and $customerCountryIsDE)"
flag="fatal">Invoice type code 326 or 384 are only allowed when both buyer and
seller are German organizations </assert>
</rule>

<rule context="cbc:CreditNoteTypeCode">
<assert id="PEPPOL-EN16931-P0101"
test="
Expand Down
216 changes: 216 additions & 0 deletions rules/unit-UBL-PEPPOL/PEPPOL-EN16931-P0112.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,216 @@
<?xml version="1.0" encoding="UTF-8"?>
<testSet xmlns="http://difi.no/xsd/vefa/validator/1.0" configuration="peppolbis-en16931-base-3.0-ubl">
<assert>
<description>Invoice type code 326 or 384 are only allowed when both buyer and
seller are German organizations.</description>
<scope>PEPPOL-EN16931-P0112</scope>
</assert>
<test>
<assert>
<success>PEPPOL-EN16931-P0112</success>
</assert>
<Invoice 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:Invoice-2">
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
<cac:AccountingSupplierParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">[email protected]</cbc:EndpointID>
<cac:PartyIdentification>
<cbc:ID schemeID="0013">987654321</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name>[Seller name]</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>[Seller address line 1]</cbc:StreetName>
<cbc:AdditionalStreetName>[Seller address line 2]</cbc:AdditionalStreetName>
<cbc:CityName>[Seller city]</cbc:CityName>
<cbc:PostalZone>12345</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>NO</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:AccountingCustomerParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">[email protected]</cbc:EndpointID>
<cac:PartyIdentification>
<cbc:ID>138</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name>[Buyer name]</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>[Buyer address line 1]</cbc:StreetName>
<cbc:AdditionalStreetName>[Buyer address line 2]</cbc:AdditionalStreetName>
<cbc:CityName>[Buyer city]</cbc:CityName>
<cbc:PostalZone>98765</cbc:PostalZone>
<cac:AddressLine>
<cbc:Line>[Buyer address line 3]</cbc:Line>
</cac:AddressLine>
<cac:Country>
<cbc:IdentificationCode>SE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
</cac:Party>
</cac:AccountingCustomerParty>
</Invoice>
</test>
<test>
<assert>
<success>PEPPOL-EN16931-P0112</success>
</assert>
<Invoice 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:Invoice-2">
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
<cbc:InvoiceTypeCode>326</cbc:InvoiceTypeCode>
<cac:AccountingSupplierParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">[email protected]</cbc:EndpointID>
<cac:PartyIdentification>
<cbc:ID schemeID="0013">987654321</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name>[Seller name]</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>[Seller address line 1]</cbc:StreetName>
<cbc:AdditionalStreetName>[Seller address line 2]</cbc:AdditionalStreetName>
<cbc:CityName>[Seller city]</cbc:CityName>
<cbc:PostalZone>12345</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:AccountingCustomerParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">[email protected]</cbc:EndpointID>
<cac:PartyIdentification>
<cbc:ID>138</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name>[Buyer name]</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>[Buyer address line 1]</cbc:StreetName>
<cbc:AdditionalStreetName>[Buyer address line 2]</cbc:AdditionalStreetName>
<cbc:CityName>[Buyer city]</cbc:CityName>
<cbc:PostalZone>98765</cbc:PostalZone>
<cac:AddressLine>
<cbc:Line>[Buyer address line 3]</cbc:Line>
</cac:AddressLine>
<cac:Country>
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
</cac:Party>
</cac:AccountingCustomerParty>
</Invoice>
</test>
<test>
<assert>
<success>PEPPOL-EN16931-P0112</success>
</assert>
<Invoice 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:Invoice-2">
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:02:1.0</cbc:ProfileID>
<cbc:InvoiceTypeCode>384</cbc:InvoiceTypeCode>
<cac:AccountingSupplierParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">[email protected]</cbc:EndpointID>
<cac:PartyIdentification>
<cbc:ID schemeID="0013">987654321</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name>[Seller name]</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>[Seller address line 1]</cbc:StreetName>
<cbc:AdditionalStreetName>[Seller address line 2]</cbc:AdditionalStreetName>
<cbc:CityName>[Seller city]</cbc:CityName>
<cbc:PostalZone>12345</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:AccountingCustomerParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">[email protected]</cbc:EndpointID>
<cac:PartyIdentification>
<cbc:ID>138</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name>[Buyer name]</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>[Buyer address line 1]</cbc:StreetName>
<cbc:AdditionalStreetName>[Buyer address line 2]</cbc:AdditionalStreetName>
<cbc:CityName>[Buyer city]</cbc:CityName>
<cbc:PostalZone>98765</cbc:PostalZone>
<cac:AddressLine>
<cbc:Line>[Buyer address line 3]</cbc:Line>
</cac:AddressLine>
<cac:Country>
<cbc:IdentificationCode>DE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
</cac:Party>
</cac:AccountingCustomerParty>
</Invoice>
</test>
<test>
<assert>
<error>PEPPOL-EN16931-P0112</error>
</assert>
<Invoice 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:Invoice-2">
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
<cbc:InvoiceTypeCode>384</cbc:InvoiceTypeCode>
<cac:AccountingSupplierParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">[email protected]</cbc:EndpointID>
<cac:PartyIdentification>
<cbc:ID schemeID="0013">987654321</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name>[Seller name]</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>[Seller address line 1]</cbc:StreetName>
<cbc:AdditionalStreetName>[Seller address line 2]</cbc:AdditionalStreetName>
<cbc:CityName>[Seller city]</cbc:CityName>
<cbc:PostalZone>12345</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>SE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:AccountingCustomerParty>
<cac:Party>
<cbc:EndpointID schemeID="EM">[email protected]</cbc:EndpointID>
<cac:PartyIdentification>
<cbc:ID>138</cbc:ID>
</cac:PartyIdentification>
<cac:PartyName>
<cbc:Name>[Buyer name]</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>[Buyer address line 1]</cbc:StreetName>
<cbc:AdditionalStreetName>[Buyer address line 2]</cbc:AdditionalStreetName>
<cbc:CityName>[Buyer city]</cbc:CityName>
<cbc:PostalZone>98765</cbc:PostalZone>
<cac:AddressLine>
<cbc:Line>[Buyer address line 3]</cbc:Line>
</cac:AddressLine>
<cac:Country>
<cbc:IdentificationCode>NO</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
</cac:Party>
</cac:AccountingCustomerParty>
</Invoice>
</test>
</testSet>

0 comments on commit e030538

Please sign in to comment.