Skip to content

Commit

Permalink
Mejorando mensaje en modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfareiza committed Aug 30, 2024
1 parent 9ceb027 commit 8001691
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions core/apps/base/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def clean(self):
resp_eps = read_json('resources/fake_sin_autorizacion.json')
elif entidad:
resp_eps = obtener_datos_identificacion(entidad, tipo, value)
validate_identificacion_exists(resp_eps, f"{tipo}{value}")
validate_identificacion_exists(entidad, resp_eps, f"{tipo}{value}")
validate_empty_empty_response(resp_eps, resp['documento'])
self.extra_valitations(entidad, resp_eps, tipo, value)
else:
Expand All @@ -97,7 +97,7 @@ def extra_valitations(self, entidad, resp_api, tipo, value):
Realiza validaciones extra una vez se tenga información de respuesta de api.
"""
if entidad == 'cajacopi':
validate_identificacion_exists(resp_api, f"{tipo}:{value}")
validate_identificacion_exists(entidad, resp_api, f"{tipo}:{value}")
validate_status_afiliado(resp_api, 'ESTADO', f"{tipo}:{value}")
elif entidad == 'fomag':
# Validaciones extra cuando se consulta usuario fomag sin autorización
Expand Down
6 changes: 3 additions & 3 deletions core/apps/base/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def validate_status_aut(resp_eps: dict, num_aut: int) -> ValidationError:
raise forms.ValidationError("El estado de la autorización no está activa.")


def validate_identificacion_exists(resp: dict, info: str) -> ValidationError:
def validate_identificacion_exists(entidad: str, resp: dict, info: str) -> ValidationError:
"""
Valida que la identificacion existe, considerando la respuesta
de la API.
Expand All @@ -200,9 +200,9 @@ def validate_identificacion_exists(resp: dict, info: str) -> ValidationError:
Ej: 'CC:123456789'
"""
if resp.get('NOMBRE') and 'no existe' in resp['NOMBRE']:
logger.info(f"El afiliado {info} no fue encontrado.")
logger.info(f"El afiliado {info} no fue encontrado en {entidad}.")
raise forms.ValidationError(
mark_safe("Disculpa, no hemos podido encontrar información con ese documento.<br><br>"
mark_safe(f"Disculpa, no hemos podido encontrar información con ese documento en {entidad.title()}.<br><br>"
"Por favor verifica e intenta nuevamente."))


Expand Down

0 comments on commit 8001691

Please sign in to comment.