|
@@ -30,16 +30,16 @@ |
|
|
block discarded – undo |
|
30
|
30
|
public static function generateInvoiceHash(array $data): array |
|
31
|
31
|
{ |
|
32
|
32
|
self::validateData(self::$invoiceRequiredFields, $data); |
|
33
|
|
- $inputString = self::field('IDEmisorFactura', $data['issuer_tax_id']); |
|
34
|
|
- $inputString .= self::field('NumSerieFactura', $data['invoice_number']); |
|
35
|
|
- $inputString .= self::field('FechaExpedicionFactura', $data['issue_date']); |
|
36
|
|
- $inputString .= self::field('TipoFactura', $data['invoice_type']); |
|
37
|
|
- $inputString .= self::field('CuotaTotal', $data['total_tax']); |
|
38
|
|
- $inputString .= self::field('ImporteTotal', $data['total_amount']); |
|
39
|
|
- $inputString .= self::field('Huella', $data['previous_hash']); |
|
40
|
|
- $inputString .= self::field('FechaHoraHusoGenRegistro', $data['generated_at'], false); |
|
|
33
|
+ $inputString = self::field('IDEmisorFactura', $data[ 'issuer_tax_id' ]); |
|
|
34
|
+ $inputString .= self::field('NumSerieFactura', $data[ 'invoice_number' ]); |
|
|
35
|
+ $inputString .= self::field('FechaExpedicionFactura', $data[ 'issue_date' ]); |
|
|
36
|
+ $inputString .= self::field('TipoFactura', $data[ 'invoice_type' ]); |
|
|
37
|
+ $inputString .= self::field('CuotaTotal', $data[ 'total_tax' ]); |
|
|
38
|
+ $inputString .= self::field('ImporteTotal', $data[ 'total_amount' ]); |
|
|
39
|
+ $inputString .= self::field('Huella', $data[ 'previous_hash' ]); |
|
|
40
|
+ $inputString .= self::field('FechaHoraHusoGenRegistro', $data[ 'generated_at' ], false); |
|
41
|
41
|
$hash = strtoupper(hash('sha256', $inputString, false)); |
|
42
|
|
- return ['hash' => $hash, 'inputString' => $inputString]; |
|
|
42
|
+ return [ 'hash' => $hash, 'inputString' => $inputString ]; |
|
43
|
43
|
} |
|
44
|
44
|
|
|
45
|
45
|
private static function validateData(array $requiredFields, array $data): void |