From 10c22314e43c032a6902619a0e2ff6b68ad29117 Mon Sep 17 00:00:00 2001 From: langfr Date: Thu, 7 Aug 2025 19:53:57 +0100 Subject: [PATCH] Update validation to XRechnung 3.0.2. --- .../ZUGFeRD/ZUGFeRD2PullProvider.java | 6 +- .../xslt/XR_30/XRechnung-CII-validation.xslt | 670 ++++++++++++++---- .../xslt/XR_30/XRechnung-UBL-validation.xslt | 520 +++++++++++--- .../validator/ZUGFeRDValidatorTest.java | 6 +- .../CII_XRechnung_with_Peppol_violation.xml | 3 + validator/src/test/resources/validXRV30.xml | 8 + 6 files changed, 933 insertions(+), 280 deletions(-) diff --git a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java index 6efb4b23..1585f010 100644 --- a/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java +++ b/library/src/main/java/org/mustangproject/ZUGFeRD/ZUGFeRD2PullProvider.java @@ -462,10 +462,8 @@ public class ZUGFeRD2PullProvider implements IXMLProvider { } xml += "" + XMLTools.encodeXML(currentItem.getProduct().getName()) + ""; - if (currentItem.getProduct().getDescription() != null) { - xml += "" + - XMLTools.encodeXML(currentItem.getProduct().getDescription()) + - ""; + if (currentItem.getProduct().getDescription() != null && !currentItem.getProduct().getDescription().isEmpty()) { + xml += "" + XMLTools.encodeXML(currentItem.getProduct().getDescription()) + ""; } if (currentItem.getProduct().getClassifications() != null) { for (IDesignatedProductClassification classification : currentItem.getProduct().getClassifications()) { diff --git a/validator/src/main/resources/xslt/XR_30/XRechnung-CII-validation.xslt b/validator/src/main/resources/xslt/XR_30/XRechnung-CII-validation.xslt index 14b1a296..84b8788d 100644 --- a/validator/src/main/resources/xslt/XR_30/XRechnung-CII-validation.xslt +++ b/validator/src/main/resources/xslt/XR_30/XRechnung-CII-validation.xslt @@ -30,6 +30,12 @@ indent="yes"/> + + + + @@ -120,6 +126,25 @@ + + + + + + + + + + + + + + + + + @@ -245,7 +270,7 @@   @@ -272,7 +297,7 @@ variable-pattern - + @@ -281,7 +306,7 @@ peppol-cii-pattern-1 - + @@ -290,7 +315,7 @@ peppol-cii-pattern-0-a - + @@ -299,7 +324,7 @@ peppol-cii-pattern-0-b - + @@ -308,7 +333,7 @@ cii-pattern - + @@ -317,45 +342,67 @@ cii-extension-pattern - + + + + + + cii-cvd-pattern + cii-cvd-pattern + + + - Schematron Version @xr-schematron.version.full@ - XRechnung @xrechnung.version@ compatible - CII + Schematron Version 2.4.0 - XRechnung 3.0.2 compatible - CII + + + - + select="'(^|\r?\n)#(SKONTO)#TAGE=([0-9]+#PROZENT=[0-9]+\.[0-9]{2})(#BASISBETRAG=-?[0-9]+\.[0-9]{2})?#$'"/> + + + select="' 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 0090 0091 0093 0094 0095 0096 0097 0098 0099 0100 0101 0102 0104 0105 0106 0107 0108 0109 0110 0111 0112 0113 0114 0115 0116 0117 0118 0119 0120 0121 0122 0123 0124 0125 0126 0127 0128 0129 0130 0131 0132 0133 0134 0135 0136 0137 0138 0139 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 0150 0151 0152 0153 0154 0155 0156 0157 0158 0159 0160 0161 0162 0163 0164 0165 0166 0167 0168 0169 0170 0171 0172 0173 0174 0175 0176 0177 0178 0179 0180 0183 0184 0185 0186 0187 0188 0189 0190 0191 0192 0193 0194 0195 0196 0197 0198 0199 0200 0201 0202 0203 0204 0205 0206 0207 0208 0209 0210 0211 0212 0213 0214 0215 0216 0217 0218 0219 0220 0221 0222 0223 0224 0225 0226 0227 0228 0229 0230 0231 0232 0233 0234 0235 0236 0237 0238 0239 0240'"/> + select="' 0002 0007 0009 0037 0060 0088 0096 0097 0106 0130 0135 0142 0147 0151 0154 0158 0170 0177 0183 0184 0188 0190 0191 0192 0193 0194 0195 0196 0198 0199 0200 0201 0202 0203 0204 0205 0208 0209 0210 0211 0212 0213 0215 0216 0217 0218 0219 0220 0221 0225 0230 0240 0235 9910 9913 9914 9915 9918 9919 9920 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9957 9959 AN AQ AS AU EM '"/> - - - + + + + + + + + - + @@ -365,7 +412,7 @@ PEPPOL-EN16931-R001 - warning + fatal @@ -373,12 +420,12 @@ - + + mode="M27"> @@ -388,7 +435,7 @@ PEPPOL-EN16931-R005 - warning + fatal @@ -403,7 +450,7 @@ PEPPOL-EN16931-R053 - warning + fatal @@ -418,7 +465,7 @@ PEPPOL-EN16931-R054 - warning + fatal @@ -433,18 +480,18 @@ PEPPOL-EN16931-R055 - warning + fatal - + Invoice total VAT amount and Invoice total VAT amount in accounting currency MUST have the same operational sign - + - + @@ -453,7 +500,7 @@ PEPPOL-EN16931-R010 - warning + fatal @@ -461,10 +508,10 @@ - + - + @@ -473,7 +520,7 @@ PEPPOL-EN16931-R020 - warning + fatal @@ -481,12 +528,12 @@ - + + mode="M27"> @@ -495,7 +542,7 @@ PEPPOL-EN16931-R041 - warning + fatal @@ -504,12 +551,12 @@ - + + mode="M27"> @@ -518,7 +565,7 @@ PEPPOL-EN16931-R042 - warning + fatal @@ -527,22 +574,22 @@ - + + mode="M27"> - + + test="not(ram:CalculationPercent and ram:BasisAmount) or u:slack(if (ram:ActualAmount) then ram:ActualAmount else 0, (xs:decimal(ram:BasisAmount) * xs:decimal(ram:CalculationPercent)) div 100, $slackValue)"> PEPPOL-EN16931-R040 - warning + fatal @@ -557,7 +604,7 @@ PEPPOL-EN16931-R043-1 - warning + fatal @@ -565,10 +612,10 @@ - + - + @@ -578,7 +625,7 @@ PEPPOL-EN16931-R043-2 - warning + fatal @@ -586,12 +633,12 @@ - + + mode="M27"> @@ -601,7 +648,7 @@ PEPPOL-EN16931-R061 - warning + fatal @@ -609,12 +656,12 @@ - + + mode="M27"> @@ -624,7 +671,7 @@ PEPPOL-EN16931-R110 - warning + fatal @@ -632,12 +679,12 @@ - + + mode="M27"> @@ -647,7 +694,7 @@ PEPPOL-EN16931-R111 - warning + fatal @@ -655,12 +702,12 @@ - + + mode="M27"> PEPPOL-EN16931-R101 - warning + fatal @@ -690,12 +737,12 @@ - + + mode="M27"> @@ -705,7 +752,7 @@ PEPPOL-EN16931-R121 - warning + fatal @@ -713,12 +760,12 @@ - + + mode="M27"> @@ -728,7 +775,7 @@ PEPPOL-EN16931-R130 - warning + fatal @@ -736,17 +783,17 @@ - + - - - + + + + mode="M28"> @@ -755,7 +802,7 @@ PEPPOL-EN16931-R008 - warning + fatal @@ -763,17 +810,17 @@ - + - - - + + + + mode="M29"> @@ -783,7 +830,7 @@ PEPPOL-EN16931-R044 - warning + fatal @@ -793,12 +840,12 @@ - + + test="not(ram:ChargeAmount) or xs:decimal(../ram:NetPriceProductTradePrice/ram:ChargeAmount) = xs:decimal(ram:ChargeAmount) - u:decimalOrZero(ram:AppliedTradeAllowanceCharge/ram:ActualAmount[1])"> PEPPOL-EN16931-R046 - warning + fatal @@ -806,15 +853,15 @@ - + - - - + + + - + - + + test="not((rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:TypeCode = 'VAT' and rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:CategoryCode = ('S', 'Z', 'E', 'AE', 'K', 'G', 'L', 'M')) or (rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:CategoryTradeTax = 'VAT' and rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeAllowanceCharge/ram:CategoryTradeTax/ram:CategoryCode = ('S', 'Z', 'E', 'AE', 'K', 'G', 'L', 'M')) or (rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:TypeCode = 'VAT' and rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:CategoryCode = ('S', 'Z', 'E', 'AE', 'K', 'G', 'L', 'M'))) or ((rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTradeParty/ram:SpecifiedTaxRegistration/ram:ID[normalize-space(@schemeID)='VA' or normalize-space(@schemeID)='FC'][boolean(normalize-space(.))], rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeAgreement/ram:SellerTaxRepresentativeTradeParty))"> BR-DE-16 fatal @@ -904,10 +951,10 @@ - + + test="normalize-space(rsm:ExchangedDocument/ram:TypeCode) = ('326', '380', '384', '389', '381', '875', '876', '877')"> BR-DE-17 warning @@ -953,10 +1000,10 @@ - + + test="not(normalize-space(rsm:ExchangedDocument/ram:TypeCode) = '384') or (rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:InvoiceReferencedDocument)"> BR-DE-26 warning @@ -966,20 +1013,20 @@ - + + priority="1012" + mode="M30"> - + + test="ram:GuidelineSpecifiedDocumentContextParameter/ram:ID = $XR-CIUS-ID or ram:GuidelineSpecifiedDocumentContextParameter/ram:ID = $XR-EXTENSION-ID or ram:GuidelineSpecifiedDocumentContextParameter/ram:ID = $XR-CVD-ID"> BR-DE-21 warning @@ -989,12 +1036,12 @@ - + + priority="1011" + mode="M30"> @@ -1011,12 +1058,12 @@ - + + priority="1010" + mode="M30"> @@ -1049,12 +1096,12 @@ - + + priority="1009" + mode="M30"> @@ -1132,12 +1179,12 @@ - + + priority="1008" + mode="M30"> @@ -1170,12 +1217,35 @@ - + + + + + + + + + + + BR-TMP-2 + warning + + + + [BR-TMP-2] BT-124 "External document location" muss eine absolute URL mit gültigem Schema enthalten. + + + + + priority="1006" + mode="M30"> @@ -1208,20 +1278,20 @@ - + - + + context="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = ('30','58')]"/> - + + test="not(normalize-space(ram:TypeCode) = '58') or matches(normalize-space(replace(ram:PayeePartyCreditorFinancialAccount/ram:IBANID, '([ \n\r\t\s])', '')), '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and xs:integer(string-join(for $cp in string-to-codepoints(concat(substring(normalize-space(replace(ram:PayeePartyCreditorFinancialAccount/ram:IBANID, '([ \n\r\t\s])', '')),5),upper-case(substring(normalize-space(replace(ram:PayeePartyCreditorFinancialAccount/ram:IBANID, '([ \n\r\t\s])', '')),1,2)),substring(normalize-space(replace(ram:PayeePartyCreditorFinancialAccount/ram:IBANID, '([ \n\r\t\s])', '')),3,2))) return (if($cp > 64) then string($cp - 55) else string($cp - 48)),'')) mod 97 = 1"> BR-DE-19 warning @@ -1261,14 +1331,14 @@ - + - + + context="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = ('48','54','55')]"/> @@ -1299,20 +1369,20 @@ - + - + + context="/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ram:SpecifiedTradeSettlementPaymentMeans[normalize-space(ram:TypeCode) = '59']"/> - + + test="not(normalize-space(ram:TypeCode) = '59') or matches(normalize-space(replace(ram:PayerPartyDebtorFinancialAccount/ram:IBANID, '([ \n\r\t\s])', '')), '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and xs:decimal(string-join(for $cp in string-to-codepoints(concat(substring(normalize-space(replace(ram:PayerPartyDebtorFinancialAccount/ram:IBANID, '([ \n\r\t\s])', '')),5),upper-case(substring(normalize-space(replace(ram:PayerPartyDebtorFinancialAccount/ram:IBANID, '([ \n\r\t\s])', '')),1,2)),substring(normalize-space(replace(ram:PayerPartyDebtorFinancialAccount/ram:IBANID, '([ \n\r\t\s])', '')),3,2))) return (if($cp > 64) then string($cp - 55) else string($cp - 48)),'')) mod 97 = 1"> BR-DE-20 warning @@ -1352,12 +1422,12 @@ - + + priority="1002" + mode="M30"> @@ -1375,19 +1445,67 @@ - + - - - + + + + + + + + + BR-DE-TMP-32 + information + + + + + [BR-DE-TMP-32] Eine Rechnung sollte zur Angabe des Liefer-/Leistungsdatums entweder BT-72 "Actual delivery date", BG-14 "Invoicing period" oder in jeder Rechnungsposition BG-26 "Invoice line period" enthalten. + + + + + + + + + + + + + + + BR-TMP-3 + fatal + + + + [BR-TMP-3] If both elements to which BT-149 and BT-150 can be mapped are present, both must be equal. + + + + + + + + + priority="1006" + mode="M31"> @@ -1407,12 +1525,12 @@ - + + priority="1005" + mode="M31"> @@ -1432,12 +1550,12 @@ - + + priority="1004" + mode="M31"> @@ -1457,12 +1575,12 @@ - + + priority="1003" + mode="M31"> @@ -1482,12 +1600,12 @@ - + + priority="1002" + mode="M31"> @@ -1507,12 +1625,12 @@ - + + priority="1001" + mode="M31"> @@ -1532,10 +1650,248 @@ - + - - - + + + + + + + + + BR-DEX-01 + fatal + + + + [BR-DEX-01] Das Element + + "Attached Document" (BT-125) benutzt einen nicht zulässigen MIME-Code: + + . Im Falle einer Extension darf zusätzlich zu der Liste der mime codes (definiert in Abschnitt 8.2, "Binary Object") der MIME-Code application/xml genutzt werden. + + + + + + + + + + + + + + + + + + + + BR-DE-CVD-03 + fatal + + + + + [BR-DE-CVD-03] In einer Rechnung muss mindestens eine + + INVOICE LINE (BG-25) enthalten sein, in der der Scheme identifier von + + "Item classification identifier" (BT-158) den Wert 'CVD' und der + + "Item attribute name" (BT-160) den Wert 'cva' enthält. + + + + + + + + + + + + + + + BR-DE-CVD-06-b + fatal + + + + + [BR-DE-CVD-06-b] Wenn + + "Item attribute name" (BT-160) mit dem Wert 'cva' angegeben ist, muss in derselben Rechnungszeile genau ein + + "Item classification identifier" (BT-158) mit dem Scheme identifier 'CVD' vorhanden sein. + + + + + + + + + + BR-DE-CVD-06-a + fatal + + + + + [BR-DE-CVD-06-a] Wenn der Scheme identifier von + + "Item classification identifier" (BT-158) mit dem Wert 'CVD' angegeben ist, muss in derselben Rechnungszeile genau ein + + "Item attribute name" (BT-160) mit dem Wert 'cva' vorhanden sein. + + + + + + + + + + + + + + + BR-TMP-CVD-01 + fatal + + + + + [BR-TMP-CVD-01] Das Bildungsschema für + + "Item classification identifier" (BT-158) ist aus der Codeliste UNTDID 7143 zu wählen. + + + + + + + + + + BR-DE-CVD-04 + fatal + + + + + [BR-DE-CVD-04] Ein + + "Item classification identifier" (BT-158) mit dem Scheme identifier 'CVD' muss einen Wert aus der Liste der zulässigen Fahrzeugkategorien enthalten. + + + + + + + + + + + + + + + BR-DE-CVD-05 + fatal + + + + + [BR-DE-CVD-05] Wenn innerhalb von + + ITEM ATTRIBUTES (BG-32) der + + "Item attribute name" (BT-160) den Wert 'cva' hat, muss der + + "Item attribute value" (BT-161) einen der zulässigen Werte enthalten. + + + + + + + + + + + + + + + BR-DE-CVD-01 + fatal + + + + + [BR-DE-CVD-01] Das Element + + "Contract reference" (BT-12) muss übermittelt werden. + + + + + + + + + + BR-DE-CVD-02 + fatal + + + + + [BR-DE-CVD-02] Das Element + + "Tender or lot reference" (BT-17) muss übermittelt werden. + + + + + + + + + diff --git a/validator/src/main/resources/xslt/XR_30/XRechnung-UBL-validation.xslt b/validator/src/main/resources/xslt/XR_30/XRechnung-UBL-validation.xslt index f77bc205..76e093d0 100644 --- a/validator/src/main/resources/xslt/XR_30/XRechnung-UBL-validation.xslt +++ b/validator/src/main/resources/xslt/XR_30/XRechnung-UBL-validation.xslt @@ -132,6 +132,25 @@ select=" (number($digits[8])*2) + (number($digits[7])*4) + (number($digits[6])*8) + (number($digits[5])*16) + (number($digits[4])*32) + (number($digits[3])*64) + (number($digits[2])*128) + (number($digits[1])*256) "/> + + + + + + + + + + + + + + + + + @@ -257,7 +276,7 @@   @@ -289,7 +308,7 @@ variable-pattern - + @@ -298,7 +317,7 @@ peppol-ubl-pattern-1 - + @@ -307,7 +326,7 @@ peppol-ubl-pattern-2 - + @@ -316,7 +335,7 @@ ubl-pattern - + @@ -325,18 +344,33 @@ ubl-extension-pattern - + + + + + + ubl-cvd-pattern + ubl-cvd-pattern + + + - Schematron Version @xr-schematron.version.full@ - XRechnung @xrechnung.version@ compatible - UBL - Invoice / Creditnote + Schematron Version 2.4.0 - XRechnung 3.0.2 compatible - UBL - Invoice / Creditnote + + + + + - + select="'(^|\r?\n)#(SKONTO)#TAGE=([0-9]+#PROZENT=[0-9]+\.[0-9]{2})(#BASISBETRAG=-?[0-9]+\.[0-9]{2})?#$'"/> + + + select="' 0002 0003 0004 0005 0006 0007 0008 0009 0010 0011 0012 0013 0014 0015 0016 0017 0018 0019 0020 0021 0022 0023 0024 0025 0026 0027 0028 0029 0030 0031 0032 0033 0034 0035 0036 0037 0038 0039 0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 0080 0081 0082 0083 0084 0085 0086 0087 0088 0089 0090 0091 0093 0094 0095 0096 0097 0098 0099 0100 0101 0102 0104 0105 0106 0107 0108 0109 0110 0111 0112 0113 0114 0115 0116 0117 0118 0119 0120 0121 0122 0123 0124 0125 0126 0127 0128 0129 0130 0131 0132 0133 0134 0135 0136 0137 0138 0139 0140 0141 0142 0143 0144 0145 0146 0147 0148 0149 0150 0151 0152 0153 0154 0155 0156 0157 0158 0159 0160 0161 0162 0163 0164 0165 0166 0167 0168 0169 0170 0171 0172 0173 0174 0175 0176 0177 0178 0179 0180 0183 0184 0185 0186 0187 0188 0189 0190 0191 0192 0193 0194 0195 0196 0197 0198 0199 0200 0201 0202 0203 0204 0205 0206 0207 0208 0209 0210 0211 0212 0213 0214 0215 0216 0217 0218 0219 0220 0221 0222 0223 0224 0225 0226 0227 0228 0229 0230 0231 0232 0233 0234 0235 0236 0237 0238 0239 0240'"/> + select="' 0002 0007 0009 0037 0060 0088 0096 0097 0106 0130 0135 0142 0147 0151 0154 0158 0170 0177 0183 0184 0188 0190 0191 0192 0193 0194 0195 0196 0198 0199 0200 0201 0202 0203 0204 0205 0208 0209 0210 0211 0212 0213 0215 0216 0217 0218 0219 0220 0221 0225 0230 0240 0235 9910 9913 9914 9915 9918 9919 9920 9922 9923 9924 9925 9926 9927 9928 9929 9930 9931 9932 9933 9934 9935 9936 9937 9938 9939 9940 9941 9942 9943 9944 9945 9946 9947 9948 9949 9950 9951 9952 9953 9957 9959 AN AQ AS AU EM '"/> - - - + + + + + + + + + mode="M36"> @@ -389,17 +434,17 @@ - + - - - + + + + mode="M37"> @@ -461,10 +506,10 @@ - + - + @@ -481,12 +526,12 @@ - + + mode="M37"> @@ -503,12 +548,12 @@ - + + mode="M37"> @@ -525,12 +570,12 @@ - + + mode="M37"> @@ -547,12 +592,12 @@ - + + mode="M37"> @@ -569,20 +614,20 @@ - + + mode="M37"> - + + test="not(cbc:MultiplierFactorNumeric and cbc:BaseAmount) or u:slack(if (cbc:Amount) then cbc:Amount else 0, (xs:decimal(cbc:BaseAmount) * xs:decimal(cbc:MultiplierFactorNumeric)) div 100, $slackValue)"> PEPPOL-EN16931-R040 fatal @@ -607,12 +652,12 @@ - + + mode="M37"> @@ -630,12 +675,12 @@ - + + mode="M37"> @@ -653,12 +698,12 @@ - + + mode="M37"> @@ -676,12 +721,12 @@ - + + mode="M37"> - + + test="u:slack($lineExtensionAmount, ($quantity * ($priceAmount div $baseQuantity)) + $chargesTotal - $allowancesTotal, $slackValue)"> PEPPOL-EN16931-R120 fatal @@ -741,10 +786,10 @@ - + - + @@ -777,12 +822,12 @@ - + + mode="M37"> - + - - - + + + - + @@ -876,10 +921,10 @@ select="('326', '380', '384', '389', '381', '875', '876', '877')"/> - + + test="normalize-space(cbc:InvoiceTypeCode) = $supportedInvAndCNTypeCodes or normalize-space(cbc:CreditNoteTypeCode) = $supportedInvAndCNTypeCodes"> BR-DE-17 warning @@ -910,10 +955,10 @@ - + + test="cbc:CustomizationID = $XR-CIUS-ID or cbc:CustomizationID = $XR-EXTENSION-ID or cbc:CustomizationID = $XR-CVD-ID"> BR-DE-21 warning @@ -940,10 +985,10 @@ - + + test="((not(normalize-space(cbc:InvoiceTypeCode) = '384' or normalize-space(cbc:CreditNoteTypeCode) = '384') or (cac:BillingReference/cac:InvoiceDocumentReference)))"> BR-DE-26 warning @@ -983,12 +1028,52 @@ - + + + + + + BR-DE-TMP-32 + information + + + + + [BR-DE-TMP-32] Eine Rechnung sollte zur Angabe des Liefer-/Leistungsdatums entweder BT-72 "Actual delivery date", BG-14 "Invoicing period" oder in jeder Rechnungsposition BG-26 "Invoice line period" enthalten. + + + + + + + + + + + + + + + BR-TMP-2 + warning + + + + [BR-TMP-2] BT-124 "External document location" muss eine absolute URL mit gültigem Schema enthalten. + + + + + mode="M38"> @@ -1005,12 +1090,12 @@ - + + mode="M38"> @@ -1043,12 +1128,12 @@ - + + mode="M38"> @@ -1126,12 +1211,12 @@ - + + mode="M38"> @@ -1164,12 +1249,12 @@ - + + mode="M38"> @@ -1202,20 +1287,20 @@ - + - + mode="M38"> + context="/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')] | /cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('30','58')]"/> - + + test="not(normalize-space(cbc:PaymentMeansCode) = '58') or matches(normalize-space(replace(cac:PayeeFinancialAccount/cbc:ID, '([ \n\r\t\s])', '')), '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and xs:integer(string-join(for $cp in string-to-codepoints(concat(substring(normalize-space(replace(cac:PayeeFinancialAccount/cbc:ID, '([ \n\r\t\s])', '')),5),upper-case(substring(normalize-space(replace(cac:PayeeFinancialAccount/cbc:ID, '([ \n\r\t\s])', '')),1,2)),substring(normalize-space(replace(cac:PayeeFinancialAccount/cbc:ID, '([ \n\r\t\s])', '')),3,2))) return (if($cp > 64) then string($cp - 55) else string($cp - 48)),'')) mod 97 = 1"> BR-DE-19 warning @@ -1255,14 +1340,14 @@ - + - + mode="M38"> + context="/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('48','54','55')] |/cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = ('48','54','55')]"/> @@ -1292,20 +1377,20 @@ - + - + mode="M38"> + context="/ubl:Invoice/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59'] | /cn:CreditNote/cac:PaymentMeans[normalize-space(cbc:PaymentMeansCode) = '59']"/> - + + test="not(normalize-space(cbc:PaymentMeansCode) = '59') or matches(normalize-space(replace(cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID, '([ \n\r\t\s])', '')), '^[A-Z]{2}[0-9]{2}[a-zA-Z0-9]{0,30}$') and xs:decimal(string-join(for $cp in string-to-codepoints(concat(substring(normalize-space(replace(cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID, '([ \n\r\t\s])', '')),5),upper-case(substring(normalize-space(replace(cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID, '([ \n\r\t\s])', '')),1,2)),substring(normalize-space(replace(cac:PaymentMandate/cac:PayerFinancialAccount/cbc:ID, '([ \n\r\t\s])', '')),3,2))) return (if($cp > 64) then string($cp - 55) else string($cp - 48)),'')) mod 97 = 1"> BR-DE-20 warning @@ -1344,12 +1429,12 @@ - + + mode="M38"> @@ -1367,11 +1452,11 @@ - + - - - + + + + mode="M39"> @@ -1401,18 +1486,18 @@ - + - + - + + test="(every $invoiceline in /ubl:Invoice/cac:InvoiceLine[ exists (./cac:SubInvoiceLine) ] satisfies $invoiceline/xs:decimal(cbc:LineExtensionAmount) = sum($invoiceline/cac:SubInvoiceLine/xs:decimal(cbc:LineExtensionAmount))) and (count( //cac:SubInvoiceLine [count(cac:SubInvoiceLine) > 0 and xs:decimal(cbc:LineExtensionAmount) = sum(cac:SubInvoiceLine/xs:decimal(cbc:LineExtensionAmount))]) = count(//cac:SubInvoiceLine [count(cac:SubInvoiceLine) > 0]))"> BR-DEX-02 warning @@ -1440,12 +1525,12 @@ - + + mode="M39"> - [BR-DEX-09] Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) - Paid amount (BT-113) + Rounding amount (BT-114) - Σ Third party payment amount (BT-DEX-002). + [BR-DEX-09] Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) - Paid amount (BT-113) + Rounding amount (BT-114) + Σ Third party payment amount (BT-DEX-002). - + + mode="M39"> @@ -1494,12 +1579,12 @@ - + + mode="M39"> @@ -1519,12 +1604,12 @@ - + + mode="M39"> @@ -1544,12 +1629,12 @@ - + + mode="M39"> @@ -1569,12 +1654,12 @@ - + + mode="M39"> @@ -1594,12 +1679,12 @@ - + + mode="M39"> @@ -1677,10 +1762,213 @@ - + - - - + + + + + + + + + + + + + + + BR-DE-CVD-02 + fatal + + + + + [BR-DE-CVD-02] Das Element + + "Tender or lot reference" (BT-17) muss übermittelt werden. + + + + + + + + + + BR-DE-CVD-01 + fatal + + + + + [BR-DE-CVD-01] Das Element + + "Contract reference" (BT-12) muss übermittelt werden. + + + + + + + + + + BR-DE-CVD-03 + fatal + + + + + [BR-DE-CVD-03] In einer Rechnung muss mindestens eine + + INVOICE LINE (BG-25) enthalten sein, in der der Scheme identifier von + + "Item classification identifier" (BT-158) den Wert 'CVD' und der + + "Item attribute name" (BT-160) den Wert 'cva' enthält. + + + + + + + + + + + + + + + BR-DE-CVD-06-a + fatal + + + + + [BR-DE-CVD-06-a] Wenn der Scheme identifier von + + "Item classification identifier" (BT-158) mit dem Wert 'CVD' angegeben ist, muss in derselben Rechnungszeile genau ein + + "Item attribute name" (BT-160) mit dem Wert 'cva' vorhanden sein. + + + + + + + + + + BR-DE-CVD-06-b + fatal + + + + + [BR-DE-CVD-06-b] Wenn + + "Item attribute name" (BT-160) mit dem Wert 'cva' angegeben ist, muss in derselben Rechnungszeile genau ein + + "Item classification identifier" (BT-158) mit dem Scheme identifier 'CVD' vorhanden sein. + + + + + + + + + + + + + + + BR-TMP-CVD-01 + fatal + + + + + [BR-TMP-CVD-01] Das Bildungsschema für + + "Item classification identifier" (BT-158) ist aus der Codeliste UNTDID 7143 zu wählen. + + + + + + + + + + BR-DE-CVD-04 + fatal + + + + + [BR-DE-CVD-04] Ein + + "Item classification identifier" (BT-158) mit dem Scheme identifier 'CVD' muss einen Wert aus der Liste der zulässigen Fahrzeugkategorien enthalten. + + + + + + + + + + + + + + + BR-DE-CVD-05 + fatal + + + + + [BR-DE-CVD-05] Wenn innerhalb von + + ITEM ATTRIBUTES (BG-32) der + + "Item attribute name" (BT-160) den Wert 'cva' hat, muss der + + "Item attribute value" (BT-161) einen der zulässigen Werte enthalten. + + + + + + + + + diff --git a/validator/src/test/java/org/mustangproject/validator/ZUGFeRDValidatorTest.java b/validator/src/test/java/org/mustangproject/validator/ZUGFeRDValidatorTest.java index ec938490..7bf2aca9 100644 --- a/validator/src/test/java/org/mustangproject/validator/ZUGFeRDValidatorTest.java +++ b/validator/src/test/java/org/mustangproject/validator/ZUGFeRDValidatorTest.java @@ -216,10 +216,10 @@ public class ZUGFeRDValidatorTest extends ResourceCase { assertThat(res).valueByXPath("count(//error)") .asInt() - .isEqualTo(2); + .isEqualTo(5); assertThat(res).valueByXPath("count(//warning)") .asInt() - .isEqualTo(3); + .isEqualTo(1); assertThat(res).valueByXPath("count(//notice)") .asInt() @@ -250,7 +250,7 @@ public class ZUGFeRDValidatorTest extends ResourceCase { assertThat(res).valueByXPath("count(//notice)") .asInt() - .isEqualTo(12); // 12 notices RE XRechnung 3.0 + .isEqualTo(9); // 9 notices RE XRechnung 3.0 assertThat(res).valueByXPath("/validation/summary/@status") .asString() .isEqualTo("valid");// expect to be valid because XR notices are, well, only notices diff --git a/validator/src/test/resources/CII_XRechnung_with_Peppol_violation.xml b/validator/src/test/resources/CII_XRechnung_with_Peppol_violation.xml index 8e023db5..71efa791 100644 --- a/validator/src/test/resources/CII_XRechnung_with_Peppol_violation.xml +++ b/validator/src/test/resources/CII_XRechnung_with_Peppol_violation.xml @@ -93,6 +93,9 @@ Stadt DE + + muster@example.com + diff --git a/validator/src/test/resources/validXRV30.xml b/validator/src/test/resources/validXRV30.xml index 8587992c..adffb992 100644 --- a/validator/src/test/resources/validXRV30.xml +++ b/validator/src/test/resources/validXRV30.xml @@ -89,6 +89,14 @@ S 7 + + + 20160101 + + + 20161231 + + 26.07