This commit is contained in:
2026-06-13 09:45:18 -03:00
parent 89c23fb0ed
commit 471c0e21a9
18 changed files with 837 additions and 91 deletions

View File

@@ -0,0 +1,47 @@
from __future__ import annotations
from fastapi import FastAPI, Request
app = FastAPI(title="Mock IMDB TIM", version="1.0.0")
def _payload(msisdn: str | None = None, cpf_cnpj: str | None = None):
return {
"msisdn": msisdn or "62981152324",
"cpfCnpj": cpf_cnpj or "06252533106",
"socialSecNo": cpf_cnpj or "06252533106",
"plan": {
"Type": "POS_PAGO",
"name": "TIM Black Família 50GB",
"commercialName": "TIM Black Família 50GB",
},
"statusType": "ACTIVE",
"statusDescription": "Cliente ativo",
"customer": {
"segment": "consumer",
"status": "active",
"contumazCustomer": False,
"odcCustomer": False,
},
}
@app.get("/health")
async def health():
return {"status": "ok", "service": "mock_imdb"}
@app.get("/access/v1/info")
async def get_access_info(request: Request):
return _payload(
msisdn=request.query_params.get("msisdn"),
cpf_cnpj=request.query_params.get("cpfCnpj") or request.query_params.get("cpf_cnpj"),
)
@app.get("/access/v1/info/{msisdn}")
async def get_access_info_by_msisdn(msisdn: str, request: Request):
return _payload(
msisdn=msisdn,
cpf_cnpj=request.query_params.get("cpfCnpj") or request.query_params.get("cpf_cnpj"),
)