Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions core-v2/mpi/validacion/validacion.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ function formatearCUIL(cuil: string) {


export async function validar(documento: string, sexo: string) {
let ciudadanoRenaper = null;
try {
const ciudadanoRenaper = await renaperv3({ documento, sexo }, busInteroperabilidad, renaperToAndes);
ciudadanoRenaper = await renaperv3({ documento, sexo }, busInteroperabilidad, renaperToAndes);
if (ciudadanoRenaper) {
// Valida el tamaño de la foto
ciudadanoRenaper.foto = ciudadanoRenaper.foto?.includes('image/jpg') ? await validarTamañoFoto(ciudadanoRenaper.foto) : null;
Expand All @@ -86,6 +87,9 @@ export async function validar(documento: string, sexo: string) {
ciudadanoRenaper.validateAt = new Date();
if (identidadSinAcentos(ciudadanoRenaper)) {
return ciudadanoRenaper;
} else {
// valida igual con atributo error a reportar
ciudadanoRenaper.errorData = true;
}
}
const ciudadanoSisa = await sisa({ documento, sexo }, sisaConfig, sisaToAndes);
Expand All @@ -103,7 +107,11 @@ export async function validar(documento: string, sexo: string) {
return ciudadanoRenaper;
}
} catch (error) {
return null;
if (ciudadanoRenaper) {
return ciudadanoRenaper;
} else {
return null;
}
}

}
Expand Down
Loading