#222 - DNI validation bug solved
This commit is contained in:
parent
ffde937022
commit
fd324df1c9
|
@ -7,5 +7,6 @@
|
|||
"El método de pago seleccionado requiere que se especifique el IBAN": "El método de pago seleccionado requiere que se especifique el IBAN",
|
||||
"Ya existe un usuario con ese nombre": "Ya existe un usuario con ese nombre",
|
||||
"Quantity cannot be zero": "Quantity cannot be zero",
|
||||
"can't be blank": "can't be blank"
|
||||
"can't be blank": "can't be blank",
|
||||
"DNI Incorrecto": "DNI Incorrecto"
|
||||
}
|
|
@ -37,8 +37,8 @@ module.exports = function(tin, country) {
|
|||
let sum = (pairSum + oddSum).toString();
|
||||
let units = parseInt(sum.charAt(sum.length - 1));
|
||||
let control = units == 0 ? 0 : 10 - units;
|
||||
let index = 'JABCDEFGHI'.indexOf(lastDigit);
|
||||
computedDigit = index == -1 ? control.toString() : index;
|
||||
let isLetter = /^[A-Z]$/.test(lastDigit);
|
||||
computedDigit = isLetter ? 'JABCDEFGHI'.charAt(control) : control.toString();
|
||||
} else {
|
||||
// Foreign NIF
|
||||
let index = 'XYZ'.indexOf(tin.charAt(0));
|
||||
|
|
Loading…
Reference in New Issue