from fastapi import FastAPI, Header from typing import Optional app = FastAPI(title="TIM Mock Backend") # ------------------------------------------------------------------ # COMPLETE INVOICES # ------------------------------------------------------------------ @app.post("/customers/v1/completeInvoices") async def complete_invoices( payload: dict, authorization: Optional[str] = Header(None), ): return { "ok": True, "msisdn": payload.get("msisdn"), "invoices": [ { "invoiceId": "FAT123456", "amount": 189.90, "dueDate": "2026-06-25", "status": "OPEN" } ] } # ------------------------------------------------------------------ # PERFIL FATURA # ------------------------------------------------------------------ @app.post("/customers/v1/completeInvoices/profile") async def profile_bill(payload: dict): return { "ok": True, "customer": { "name": "Cliente Teste", "msisdn": payload.get("msisdn") } } # ------------------------------------------------------------------ # CONTRATO # ------------------------------------------------------------------ @app.post("/access/v1/contractInformation") async def contract_information(payload: dict): return { "ok": True, "contractId": "CTR001", "plan": "TIM Black Família" } # ------------------------------------------------------------------ # CONSULTA VAS # ------------------------------------------------------------------ @app.post("/access/v1/productsSingleVas") async def query_vas(payload: dict): return { "ok": True, "products": [ { "id": "VAS001", "name": "TIM Banca", "status": "ACTIVE" }, { "id": "VAS002", "name": "Babbel", "status": "ACTIVE" } ] } # ------------------------------------------------------------------ # CANCELAMENTO VAS # ------------------------------------------------------------------ @app.delete("/access/v1/singleVas") async def cancel_vas(payload: dict): return { "ok": True, "message": "VAS cancelado com sucesso" } # ------------------------------------------------------------------ # BLOQUEIO VAS # ------------------------------------------------------------------ @app.post("/customers/v1/createPartialBlocking") async def block_vas(payload: dict): return { "ok": True, "operation": "block", "status": "SUCCESS" } # ------------------------------------------------------------------ # RECUPERAR PDF FATURA # ------------------------------------------------------------------ @app.post("/invoices/v1/invoiceRecover") async def invoice_recover(payload: dict): return { "ok": True, "url": "https://mock.tim.com/faturas/FAT123456.pdf" } # ------------------------------------------------------------------ # PROTOCOLO / SR # ------------------------------------------------------------------ @app.post("/customers/v1/backOfficeSRopening") async def protocol(payload: dict): return { "ok": True, "protocol": "202606150001" } # ------------------------------------------------------------------ # CONTESTAÇÃO # ------------------------------------------------------------------ @app.post("/interactions/v1/customerContestation") async def contestation(payload: dict): return { "ok": True, "protocol": "CNT987654", "status": "OPEN" } # ------------------------------------------------------------------ # STATUS SR # ------------------------------------------------------------------ @app.post("/interactions/v1/statusServiceRequest") async def sr_status(payload: dict): return { "ok": True, "protocol": payload.get("protocol"), "status": "IN_PROGRESS" } # ------------------------------------------------------------------ # SMS # ------------------------------------------------------------------ @app.post("/customers/v1/smsSend") async def sms_send(payload: dict): return { "ok": True, "messageId": "SMS001" } # ------------------------------------------------------------------ # TRACKING # ------------------------------------------------------------------ @app.post("/customers/v1/trackingActivities") async def tracking(payload: dict): return { "ok": True, "activities": [ { "date": "2026-06-15", "description": "Solicitação registrada" } ] } # ------------------------------------------------------------------ # HEALTH # ------------------------------------------------------------------ @app.get("/health") async def health(): return {"status": "UP"}