Skip to content

Commit 080fda3

Browse files
committed
fix(validacion): corrige validacion con sisa cuando cae servicio
1 parent a1b10c4 commit 080fda3

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

core-v2/mpi/validacion/validacion.controller.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ function formatearCUIL(cuil: string) {
7171

7272

7373
export async function validar(documento: string, sexo: string) {
74+
let ciudadanoRenaper = null;
7475
try {
75-
const ciudadanoRenaper = await renaperv3({ documento, sexo }, busInteroperabilidad, renaperToAndes);
76+
ciudadanoRenaper = await renaperv3({ documento, sexo }, busInteroperabilidad, renaperToAndes);
7677
if (ciudadanoRenaper) {
7778
// Valida el tamaño de la foto
7879
ciudadanoRenaper.foto = ciudadanoRenaper.foto?.includes('image/jpg') ? await validarTamañoFoto(ciudadanoRenaper.foto) : null;
@@ -86,6 +87,9 @@ export async function validar(documento: string, sexo: string) {
8687
ciudadanoRenaper.validateAt = new Date();
8788
if (identidadSinAcentos(ciudadanoRenaper)) {
8889
return ciudadanoRenaper;
90+
} else {
91+
// valida igual con atributo error a reportar
92+
ciudadanoRenaper.errorData = true;
8993
}
9094
}
9195
const ciudadanoSisa = await sisa({ documento, sexo }, sisaConfig, sisaToAndes);
@@ -103,7 +107,11 @@ export async function validar(documento: string, sexo: string) {
103107
return ciudadanoRenaper;
104108
}
105109
} catch (error) {
106-
return null;
110+
if (ciudadanoRenaper) {
111+
return ciudadanoRenaper;
112+
} else {
113+
return null;
114+
}
107115
}
108116

109117
}

0 commit comments

Comments
 (0)