Ejemplo n.º 1
0
def get(restaurant_id):
    certification = ""
    try:
        certification = cert_base.get(int(restaurant_id))
    except BaseException as e:
        raise_user_exc(CERT_NOT_EXISTS_ERR, restaurant_id=restaurant_id)
    return {"certification": certification}
Ejemplo n.º 2
0
def get(restaurant_id):
    certification=''
    try:
        certification = cert_base.get(int(restaurant_id))
    except BaseException as e:
        raise_user_exc(CERT_NOT_EXISTS_ERR, restaurant_id=restaurant_id)
    return {'certification': certification}
Ejemplo n.º 3
0
def processing():
    args = args_parser.parse_all()
    status_to = int(args.get("status"))
    comment = args.get("comment", "")
    restaurant_id = int(args.get("restaurant_id"))
    cert = cert_base.get(restaurant_id)

    if status_to != CERTIFICATION_CONST.STATUS_PASSED and status_to != CERTIFICATION_CONST.STATUS_FAILED:
        raise_user_exc(CERT_PROC_ILL_ERR)

    if cert.status != CERTIFICATION_CONST.STATUS_PENDING:
        raise_user_exc(CERT_NOT_PENDING_ERR)

    cert_base.process_certification(restaurant_id, status_to)

    record_base.add(restaurant_id, cert.type, cert.status, status_to, comment)
    return ""
Ejemplo n.º 4
0
def processing():
    args = args_parser.parse_all()
    status_to = int(args.get('status'))
    comment = args.get('comment', '')
    restaurant_id = int(args.get('restaurant_id'))
    cert = cert_base.get(restaurant_id)

    if status_to != CERTIFICATION_CONST.STATUS_PASSED and \
       status_to != CERTIFICATION_CONST.STATUS_FAILED:
        raise_user_exc(CERT_PROC_ILL_ERR)

    if cert.status != CERTIFICATION_CONST.STATUS_PENDING:
        raise_user_exc(CERT_NOT_PENDING_ERR)

    cert_base.process_certification(restaurant_id, status_to)

    record_base.add(restaurant_id, cert.type,
                        cert.status, status_to, comment)
    return ''
Ejemplo n.º 5
0
def _get_certification_with_url(restaurant_id):
    cert = cert_base.get(restaurant_id)

    file_names = ['identity_card_image_front',
               'identity_card_image_back',
               'health_card_image_front',
               'health_card_image_back',
               'license_image',
               'restaurant_service_license_copy']
    for file_name in file_names:
        obj = getattr(cert, file_name, None)
        if obj:
            try:
                url=file_base.get_file_url(obj, isprivate=True)
                if url:
                    setattr(
                        cert, file_name, url)
            except Exception as e:
                continue
    return cert
Ejemplo n.º 6
0
def _get_certification_with_url(restaurant_id):
    cert = cert_base.get(restaurant_id)

    file_names = [
        "identity_card_image_front",
        "identity_card_image_back",
        "health_card_image_front",
        "health_card_image_back",
        "license_image",
        "restaurant_service_license_copy",
    ]
    for file_name in file_names:
        obj = getattr(cert, file_name, None)
        if obj:
            try:
                url = file_base.get_file_url(obj, isprivate=True)
                if url:
                    setattr(cert, file_name, url)
            except Exception as e:
                continue
    return cert