<filename>app/utils/validations/get_approve_validator.py
# valida el input del cuarto endpoint (/sifco_approve)


from app.utils.validations.separated import validate_cards, validate_nit, validate_phone, validate_flag
from app.utils.errors import KeyErrorException, BadLengthException


def get_approve_validator(request):
    if set(request.keys()) != set(['card', 'flag', 'nit', 'phone']):
        raise KeyErrorException("Los valores del input son 'card', 'flag', 'nit' y 'phone'")
    if set({''}).issubset(set(list(request.values()))):
        raise BadLengthException("Algún input está vacío")
    response_card = validate_cards(request["card"])
    response_flag = validate_flag(request["flag"])
    response_nit = validate_nit(request["nit"])
    response_phone = validate_phone(request["phone"])
    if response_card is not None:
        return response_card
    if response_nit is not None:
        return response_nit
    if response_phone is not None:
        return response_phone
    if response_flag is not None:
        return response_flag
    return None

<filename>app/utils/validations/get_approve_validator.py
# valida el input del cuarto endpoint (/sifco_approve)


from app.utils.validations.separated import validate_cards, validate_nit, validate_phone, validate_flag
from app.utils.errors import KeyErrorException, BadLengthException


def get_approve_validator(request):
    if set(request.keys()) != set(['card', 'flag', 'nit', 'phone']):
        raise KeyErrorException("Los valores del input son 'card', 'flag', 'nit' y 'phone'")
    if set({''}).issubset(set(list(request.values()))):
        raise BadLengthException("Algún input está vacío")
    response_card = validate_cards(request["card"])
    response_flag = validate_flag(request["flag"])
    response_nit = validate_nit(request["nit"])
    response_phone = validate_phone(request["phone"])
    if response_card is not None:
        return response_card
    if response_nit is not None:
        return response_nit
    if response_phone is not None:
        return response_phone
    if response_flag is not None:
        return response_flag
    return None

# valida el input del cuarto endpoint (/sifco_approve)