File size: 591 Bytes
aa8ade0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# BORRAR ESTE MODULO:
from fastapi import HTTPException


def check_country_code(request):
    if request.country not in ["CL", "MX"]:
        raise HTTPException(
            status_code=400, detail=f"Invalid country code: {request.country}"
        )
    else:
        return print("correct country code")


def check_valid_ids(request, df):
    invalid_ids = set(request.invoiceId) - set(df.index)
    if invalid_ids:
        raise HTTPException(
            status_code=400, detail=f"Invalid invoiceId(s): {invalid_ids}"
        )
    else:
        return print("invoice ids are valid")