mirror of
https://github.com/hoshikawa2/compass_backoffice.git
synced 2026-07-09 13:54:20 +00:00
bugfixes
This commit is contained in:
@@ -1,47 +1,67 @@
|
||||
from __future__ import annotations
|
||||
# /compass_backoffice/legacy_backend/
|
||||
# uvicorn mock_imdb_server:app --port 8011
|
||||
|
||||
from fastapi import FastAPI, Request
|
||||
|
||||
app = FastAPI(title="Mock IMDB TIM", version="1.0.0")
|
||||
app = FastAPI(title="Mock IMDB TIM")
|
||||
|
||||
|
||||
def _payload(msisdn: str | None = None, cpf_cnpj: str | None = None):
|
||||
@app.get("/access/v1/info")
|
||||
async def get_access_info(request: Request):
|
||||
return {
|
||||
"msisdn": msisdn or "62981152324",
|
||||
"cpfCnpj": cpf_cnpj or "06252533106",
|
||||
"socialSecNo": cpf_cnpj or "06252533106",
|
||||
"cpfCnpj": request.query_params.get("cpfCnpj") or "06252533106",
|
||||
"msisdn": request.query_params.get("msisdn") or "62981152324",
|
||||
"plan": {
|
||||
"Type": "POS_PAGO",
|
||||
"name": "TIM Black Família 50GB",
|
||||
"commercialName": "TIM Black Família 50GB",
|
||||
"name": "TIM Black Família 50GB"
|
||||
},
|
||||
"statusType": "ACTIVE",
|
||||
"statusDescription": "Cliente ativo",
|
||||
"customer": {
|
||||
"segment": "consumer",
|
||||
"status": "active",
|
||||
"contumazCustomer": False,
|
||||
"odcCustomer": False,
|
||||
"odcCustomer": False
|
||||
},
|
||||
"contracts": [
|
||||
{
|
||||
"contractId": "mock-contract-001",
|
||||
"status": "active",
|
||||
"product": "Celular Pós-pago"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@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"),
|
||||
)
|
||||
async def get_access_info_by_msisdn(msisdn: str):
|
||||
return {
|
||||
"msisdn": msisdn,
|
||||
"cpfCnpj": "06252533106",
|
||||
"plan": {
|
||||
"Type": "POS_PAGO",
|
||||
"name": "TIM Black Família 50GB"
|
||||
},
|
||||
"customer": {
|
||||
"segment": "consumer",
|
||||
"status": "active",
|
||||
"contumazCustomer": False,
|
||||
"odcCustomer": False
|
||||
}
|
||||
}
|
||||
|
||||
from uuid import uuid4
|
||||
|
||||
@app.post("/customers/v1/backOfficeSRopening")
|
||||
async def backoffice_sr_opening(payload: dict):
|
||||
protocol = f"SR-MOCK-{uuid4().hex[:8].upper()}"
|
||||
|
||||
return {
|
||||
"status": "success",
|
||||
"interactionProtocol": protocol,
|
||||
"crmProtocol": protocol,
|
||||
"fieldsToUpdate": {
|
||||
"status": "Aberto",
|
||||
"reason": "Mock Siebel SR Opening"
|
||||
},
|
||||
"case_response": {
|
||||
"message": "Chamado Siebel aberto com sucesso no mock"
|
||||
},
|
||||
"transitions": []
|
||||
}
|
||||
Reference in New Issue
Block a user