Open ossama0808 opened 1 month ago
Hi @alyousfy77885 , I'm trying to mimic your code but I feel like there is missing steps in the below function. ` public function signInvoice(array $invoice, array $egs_unit, string $certificate, string $private_key): array {
$signed_properties_props = [ 'sign_timestamp' => date('Y-m-d\TH:i:s\Z'), 'certificate_hash' => $hash, // SignedSignatureProperties/SigningCertificate/CertDigest/<ds:DigestValue>SET_CERTIFICATE_HASH</ds:DigestValue> 'certificate_issuer' => $issuer, 'certificate_serial_number' => $serialNumber ]; $ubl_signature_signed_properties_xml_string_for_signing = $zatca_simplified_tax_invoice->defaultUBLExtensionsSignedPropertiesForSigning($signed_properties_props); $ubl_signature_signed_properties_xml_string = $zatca_simplified_tax_invoice->defaultUBLExtensionsSignedProperties($signed_properties_props); $signed_properties_hash = base64_encode(openssl_digest($ubl_signature_signed_properties_xml_string_for_signing, 'sha256')); // UBL Extensions $ubl_signature_xml_string = $zatca_simplified_tax_invoice->defaultUBLExtensions( $invoice_hash, // <ds:DigestValue>SET_INVOICE_HASH</ds:DigestValue> $signed_properties_hash, // SignatureInformation/Signature/SignedInfo/Reference/<ds:DigestValue>SET_SIGNED_PROPERTIES_HASH</ds:DigestValue> $digital_signature, $certificate, $ubl_signature_signed_properties_xml_string ); // Set signing elements $unsigned_invoice_str = $invoice_xml->saveXML(); $unsigned_invoice_str = str_replace('SET_UBL_EXTENSIONS_STRING', $ubl_signature_xml_string, $unsigned_invoice_str); $unsigned_invoice_str = str_replace('SET_QR_CODE_DATA', $qr, $unsigned_invoice_str); $signed_invoice = new DOMDocument(); $signed_invoice->loadXML($unsigned_invoice_str); $signed_invoice_string = $signed_invoice->saveXML(); //$signed_invoice_string = $zatca_simplified_tax_invoice->signedPropertiesIndentationFix($signed_invoice_string); return [$signed_invoice_string, $invoice_hash, $qr,$public_key]; }
`
The SET_UBL_EXTENSIONS_STRING as well as SET_QR_CODE_DATA does not exist at all
SET_UBL_EXTENSIONS_STRING
SET_QR_CODE_DATA
Hi @alyousfy77885 , I'm trying to mimic your code but I feel like there is missing steps in the below function. ` public function signInvoice(array $invoice, array $egs_unit, string $certificate, string $private_key): array {
`