mirror of
https://github.com/hoshikawa2/compass_backoffice.git
synced 2026-07-09 13:54:20 +00:00
bugfixes
This commit is contained in:
47
mock_servers/mock_imdb_server.py
Normal file
47
mock_servers/mock_imdb_server.py
Normal 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"),
|
||||
)
|
||||
Reference in New Issue
Block a user