VF-2000
El cálculo de la huella suministrada es incorrecta (Huella …, calculada …).
In English The record's fingerprint (Huella) is not the SHA-256, in upper-case hex, of its fields joined as name=value pairs with &: IDEmisorFactura, NumSerieFactura, FechaExpedicionFactura, TipoFactura, CuotaTotal, ImporteTotal, the previous Huella and FechaHoraHusoGenRegistro (the issuer, number, date, previous Huella and time of a cancellation). The record is accepted with errors to correct.
Why it fails
- A field changed after the fingerprint was computed, often FechaHoraHusoGenRegistro written again when the record was sent.
- The first record of a chain hashed with something after Huella=; it takes nothing there.
- The hex digest written in lower case.
How to fix it
Compute the fingerprint last, over the values exactly as the XML carries them without spaces at either end. The AEAT's first example, IDEmisorFactura=89890001K&NumSerieFactura=12345678/G33&FechaExpedicionFactura=01-01-2024&TipoFactura=F1&CuotaTotal=12.35&ImporteTotal=123.45&Huella=&FechaHoraHusoGenRegistro=2024-01-01T19:20:30+01:00, gives 3C464DAF61ACB827C65FDA19F352A4E3BDC2C640E9E9FC4CC058073F38F12F60.
What the rule checks
As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.
[2000] El cálculo de la huella suministrada es incorrecta (Huella …, calculada …).
/*:RegFactuSistemaFacturacion/*:RegistroFactura/*:RegistroAlta[string-length(normalize-space(*:Huella)) = 64]
normalize-space(*:Huella) = $accepted
Checked with VERI*FACTU invoice records
[2000] El cálculo de la huella suministrada es incorrecta (Huella …, calculada …).
/*:RegFactuSistemaFacturacion/*:RegistroFactura/*:RegistroAnulacion[string-length(normalize-space(*:Huella)) = 64]
normalize-space(*:Huella) = $computed
Checked with VERI*FACTU invoice records