BR-KSA-26: مرفق تجزئة الفاتورة السابقة (PIH) غير فارغ وبنوع text/plain

الشرح من فريق ماثل، مبني على نص قواعد الهيئة والشرط اللي ينفّذه SDK 3.4.8 · آخر تحديث

تحذير: الفاتورة تنقبل مع تحذيربشرط، شوف الشرحالحقول: KSA-13

تُطبَّق على عنصر cac:Attachment داخل cac:AdditionalDocumentReference الذي قيمة cbc:ID فيه 'PIH' (KSA-13): يجب أن يحتوي على cbc:EmbeddedDocumentBinaryObject غير فارغ مع mimeCode='text/plain';. النص الرسمي يشرح طريقة حساب تجزئة SHA-256، لكن هذا الفحص لا يعيد حساب قيمة التجزئة ولا يتحقق منها.

كيف تحلها

ضع تجزئة SHA-256 للفاتورة السابقة بترميز base64 في <cbc:EmbeddedDocumentBinaryObject mimeCode="text/plain">…</cbc:EmbeddedDocumentBinaryObject> داخل مرفق PIH. للفاتورة الأولى، القيمة المحددة في النص الرسمي هي NWZlY2ViNjZmZmM4NmYzOGQ5NTI3ODZjNmQ2OTZjNzljMmRiYzIzOWRkNGU5MWI0NjcyOWQ3M2EyN2ZiNTdlOQ==.

نص الهيئة الرسمي

[BR-KSA-26]-If the invoice contains the previous invoice hash (KSA-13), this hash must be base64 encoded SHA256. The hash shall be computed using the following method as described in the ds:transforms block in the XML Invoice Specifications: 1. Remove the <Invoice><ext:UBLExtensions/> block 2. Remove the <Invoice><cac:AdditionalDocumentReference/> block where <cbc:ID/> = QR 3. Remove the <Invoice><cac:Signature/> block 4. Canonicalize the Invoice using the C14N11 standard 5. Hash the resulting string using SHA256 to a binary object 6. Base64 encode the binary object to generate the digest value For the first invoice, the previous invoice hash is "NWZlY2ViNjZmZmM4NmYzOGQ5NTI3ODZjNmQ2OTZjNzljMmRiYzIzOWRkNGU5MWI0NjcyOWQ3M2EyN2ZiNTdlOQ==", the equivalent for base64 encoded SHA256 of "0" (zero) character.
المصدر: ZATCA SDK 3.4.8 · ZATCA KSA rules

متى تفشل (الشرط اللي ينفّذه SDK الهيئة)

not(exists(cbc:EmbeddedDocumentBinaryObject) and (cbc:EmbeddedDocumentBinaryObject) != '' and (cbc:EmbeddedDocumentBinaryObject[normalize-space(@mimeCode) = 'text/plain']))

قواعد قريبة

افحص فاتورتك على قواعد الهيئة

الصق الـ XML وتشوف كل الأخطاء والتحذيرات، والفحص يصير في متصفحك وما ترسل الفاتورة لأي مكان.

افحص فاتورة أو جرّب ماثل