@@ -31,7 +31,7 @@ |
||
| 31 | 31 | 'type' => $this->faker->randomElement(array_column(InvoiceType::cases(), 'value')), |
| 32 | 32 | 'external_reference' => $this->faker->optional()->bothify('EXT-####'), |
| 33 | 33 | 'description' => $this->faker->sentence, |
| 34 | - 'status' => $this->faker->randomElement(['draft', 'sent', 'paid', 'cancelled']), |
|
| 34 | + 'status' => $this->faker->randomElement([ 'draft', 'sent', 'paid', 'cancelled' ]), |
|
| 35 | 35 | 'issued_at' => $this->faker->optional()->dateTimeThisYear(), |
| 36 | 36 | 'cancelled_at' => null, |
| 37 | 37 | ]; |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | 'address' => $this->faker->address, |
| 21 | 21 | 'email' => $this->faker->optional()->safeEmail, |
| 22 | 22 | 'phone' => $this->faker->optional()->phoneNumber, |
| 23 | - 'type' => $this->faker->optional()->randomElement(['VAT', 'PASSPORT', 'NATIONAL_ID', 'RESIDENCE_CERTIFICATE', 'OTHER_DOCUMENT', 'UNREGISTERED']), |
|
| 23 | + 'type' => $this->faker->optional()->randomElement([ 'VAT', 'PASSPORT', 'NATIONAL_ID', 'RESIDENCE_CERTIFICATE', 'OTHER_DOCUMENT', 'UNREGISTERED' ]), |
|
| 24 | 24 | ]; |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | \ No newline at end of file |
@@ -30,16 +30,16 @@ |
||
| 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 |