{
  "v": 12,
  "name": "CTC API · Clientes externos",
  "folders": [
    {
      "v": 12,
      "name": "01 · Consultas",
      "folders": [],
      "requests": [
        {
          "v": "17",
          "name": "GET Catálogo de productos ★",
          "method": "GET",
          "endpoint": "<<host>>/api/v1/tae/products",
          "params": [],
          "headers": [
            {
              "key": "x-api-key",
              "value": "<<apiKey>>",
              "active": true,
              "description": ""
            }
          ],
          "preRequestScript": "",
          "testScript": "pw.test(\"Sobre estándar (error, message, data, results)\", () => {\n  pw.expect(pw.response.body.error).toBeType(\"boolean\");\n  pw.expect(pw.response.body.message).toBeType(\"string\");\n});\npw.test(\"200 OK\", () => pw.expect(pw.response.status).toBe(200));\nconst items = pw.response.body.data || [];\nconst first = g => items.find(p => p.carrier_group === g && p.input_type !== \"ESIM\");\nconst esim = items.find(p => p.input_type === \"ESIM\");\nif (first(\"TAE\")) pw.env.set(\"carrierId\", String(first(\"TAE\").id));\nif (first(\"SERVICIO\")) pw.env.set(\"serviceCarrierId\", String(first(\"SERVICIO\").id));\nif (first(\"PIN\")) pw.env.set(\"pinCarrierId\", String(first(\"PIN\").id));\nif (esim) pw.env.set(\"esimCarrierId\", String(esim.id));\npw.test(\"Catálogo con productos\", () => pw.expect(items.length > 0).toBe(true));",
          "auth": {
            "authType": "none",
            "authActive": true
          },
          "body": {
            "contentType": null,
            "body": null
          },
          "requestVariables": [],
          "responses": {},
          "description": null
        },
        {
          "v": "17",
          "name": "GET Saldo ★",
          "method": "GET",
          "endpoint": "<<host>>/api/v1/tae/balance",
          "params": [],
          "headers": [
            {
              "key": "x-api-key",
              "value": "<<apiKey>>",
              "active": true,
              "description": ""
            }
          ],
          "preRequestScript": "",
          "testScript": "pw.test(\"Sobre estándar (error, message, data, results)\", () => {\n  pw.expect(pw.response.body.error).toBeType(\"boolean\");\n  pw.expect(pw.response.body.message).toBeType(\"string\");\n});\npw.test(\"200 OK\", () => pw.expect(pw.response.status).toBe(200));\nconst w = (pw.response.body.data || {}).wallets || {};\npw.test(\"Bolsas TAE y SERVICIOS\", () => {\n  pw.expect(w.TAE.currentBalance).toBeType(\"number\");\n  pw.expect(w.SERVICIOS.currentBalance).toBeType(\"number\");\n});",
          "auth": {
            "authType": "none",
            "authActive": true
          },
          "body": {
            "contentType": null,
            "body": null
          },
          "requestVariables": [],
          "responses": {},
          "description": null
        }
      ],
      "auth": {
        "authType": "inherit",
        "authActive": true
      },
      "headers": [],
      "variables": [],
      "description": null,
      "preRequestScript": "",
      "testScript": ""
    },
    {
      "v": 12,
      "name": "02 · Ventas",
      "folders": [],
      "requests": [
        {
          "v": "17",
          "name": "POST Recarga TAE ★",
          "method": "POST",
          "endpoint": "<<host>>/api/v1/tae/do-transaction",
          "params": [],
          "headers": [
            {
              "key": "x-api-key",
              "value": "<<apiKey>>",
              "active": true,
              "description": ""
            },
            {
              "key": "Content-Type",
              "value": "application/json",
              "active": true,
              "description": ""
            }
          ],
          "preRequestScript": "const p = pw.env.get(\"folioPrefix\") || \"API\";\npw.env.set(\"folio\", p + \"-\" + Date.now() + \"-\" + Math.floor(Math.random() * 1000));",
          "testScript": "pw.test(\"Sobre estándar (error, message, data, results)\", () => {\n  pw.expect(pw.response.body.error).toBeType(\"boolean\");\n  pw.expect(pw.response.body.message).toBeType(\"string\");\n});\nconst b = pw.response.body;\npw.test(\"Venta procesada (200)\", () => pw.expect(pw.response.status).toBe(200));\nif (pw.response.status === 200) {\n  pw.env.set(\"transactionId\", String(b.data.transaction_id));\n  pw.test(\"code = 00\", () => pw.expect(b.data.code).toBe(\"00\"));\n}\n// 502 / 500 / timeout: NO reintentar con folio nuevo; ejecuta \"Consultar estado por folio\".",
          "auth": {
            "authType": "none",
            "authActive": true
          },
          "body": {
            "contentType": "application/json",
            "body": "{\n  \"carrier_id\": <<carrierId>>,\n  \"amount\": <<taeAmount>>,\n  \"dn\": \"<<phone>>\",\n  \"folio\": \"<<folio>>\"\n}"
          },
          "requestVariables": [],
          "responses": {},
          "description": null
        },
        {
          "v": "17",
          "name": "POST Pago de servicio",
          "method": "POST",
          "endpoint": "<<host>>/api/v1/tae/do-transaction",
          "params": [],
          "headers": [
            {
              "key": "x-api-key",
              "value": "<<apiKey>>",
              "active": true,
              "description": ""
            },
            {
              "key": "Content-Type",
              "value": "application/json",
              "active": true,
              "description": ""
            }
          ],
          "preRequestScript": "const p = pw.env.get(\"folioPrefix\") || \"API\";\npw.env.set(\"folio\", p + \"-\" + Date.now() + \"-\" + Math.floor(Math.random() * 1000));",
          "testScript": "pw.test(\"Sobre estándar (error, message, data, results)\", () => {\n  pw.expect(pw.response.body.error).toBeType(\"boolean\");\n  pw.expect(pw.response.body.message).toBeType(\"string\");\n});\nconst b = pw.response.body;\npw.test(\"Venta procesada (200)\", () => pw.expect(pw.response.status).toBe(200));\nif (pw.response.status === 200) {\n  pw.env.set(\"transactionId\", String(b.data.transaction_id));\n  pw.test(\"code = 00\", () => pw.expect(b.data.code).toBe(\"00\"));\n}\n// 502 / 500 / timeout: NO reintentar con folio nuevo; ejecuta \"Consultar estado por folio\".",
          "auth": {
            "authType": "none",
            "authActive": true
          },
          "body": {
            "contentType": "application/json",
            "body": "{\n  \"carrier_id\": <<serviceCarrierId>>,\n  \"amount\": <<serviceAmount>>,\n  \"dn\": \"<<serviceReference>>\",\n  \"folio\": \"<<folio>>\"\n}"
          },
          "requestVariables": [],
          "responses": {},
          "description": null
        },
        {
          "v": "17",
          "name": "POST Venta de PIN",
          "method": "POST",
          "endpoint": "<<host>>/api/v1/tae/do-transaction",
          "params": [],
          "headers": [
            {
              "key": "x-api-key",
              "value": "<<apiKey>>",
              "active": true,
              "description": ""
            },
            {
              "key": "Content-Type",
              "value": "application/json",
              "active": true,
              "description": ""
            }
          ],
          "preRequestScript": "const p = pw.env.get(\"folioPrefix\") || \"API\";\npw.env.set(\"folio\", p + \"-\" + Date.now() + \"-\" + Math.floor(Math.random() * 1000));",
          "testScript": "pw.test(\"Sobre estándar (error, message, data, results)\", () => {\n  pw.expect(pw.response.body.error).toBeType(\"boolean\");\n  pw.expect(pw.response.body.message).toBeType(\"string\");\n});\nconst b = pw.response.body;\npw.test(\"Venta procesada (200)\", () => pw.expect(pw.response.status).toBe(200));\nif (pw.response.status === 200) {\n  pw.env.set(\"transactionId\", String(b.data.transaction_id));\n  pw.test(\"code = 00\", () => pw.expect(b.data.code).toBe(\"00\"));\n}\n// 502 / 500 / timeout: NO reintentar con folio nuevo; ejecuta \"Consultar estado por folio\".",
          "auth": {
            "authType": "none",
            "authActive": true
          },
          "body": {
            "contentType": "application/json",
            "body": "{\n  \"carrier_id\": <<pinCarrierId>>,\n  \"amount\": <<pinAmount>>,\n  \"dn\": \"<<phone>>\",\n  \"folio\": \"<<folio>>\"\n}"
          },
          "requestVariables": [],
          "responses": {},
          "description": null
        },
        {
          "v": "17",
          "name": "POST Venta de eSIM",
          "method": "POST",
          "endpoint": "<<host>>/api/v1/tae/do-transaction",
          "params": [],
          "headers": [
            {
              "key": "x-api-key",
              "value": "<<apiKey>>",
              "active": true,
              "description": ""
            },
            {
              "key": "Content-Type",
              "value": "application/json",
              "active": true,
              "description": ""
            }
          ],
          "preRequestScript": "const p = pw.env.get(\"folioPrefix\") || \"API\";\npw.env.set(\"folio\", p + \"-\" + Date.now() + \"-\" + Math.floor(Math.random() * 1000));",
          "testScript": "pw.test(\"Sobre estándar (error, message, data, results)\", () => {\n  pw.expect(pw.response.body.error).toBeType(\"boolean\");\n  pw.expect(pw.response.body.message).toBeType(\"string\");\n});\nconst b = pw.response.body;\npw.test(\"Venta procesada (200)\", () => pw.expect(pw.response.status).toBe(200));\nif (pw.response.status === 200) {\n  pw.env.set(\"transactionId\", String(b.data.transaction_id));\n  pw.test(\"code = 00\", () => pw.expect(b.data.code).toBe(\"00\"));\n}\n// 502 / 500 / timeout: NO reintentar con folio nuevo; ejecuta \"Consultar estado por folio\".",
          "auth": {
            "authType": "none",
            "authActive": true
          },
          "body": {
            "contentType": "application/json",
            "body": "{\n  \"carrier_id\": <<esimCarrierId>>,\n  \"amount\": <<esimAmount>>,\n  \"dn\": \"<<phone>>\",\n  \"folio\": \"<<folio>>\",\n  \"customer_name\": \"<<customerName>>\",\n  \"customer_email\": \"<<customerEmail>>\"\n}"
          },
          "requestVariables": [],
          "responses": {},
          "description": null
        }
      ],
      "auth": {
        "authType": "inherit",
        "authActive": true
      },
      "headers": [],
      "variables": [],
      "description": null,
      "preRequestScript": "",
      "testScript": ""
    },
    {
      "v": 12,
      "name": "03 · Estado de transacción",
      "folders": [],
      "requests": [
        {
          "v": "17",
          "name": "GET Consultar estado por folio ★",
          "method": "GET",
          "endpoint": "<<host>>/api/v1/tae/check-transaction/<<folio>>",
          "params": [],
          "headers": [
            {
              "key": "x-api-key",
              "value": "<<apiKey>>",
              "active": true,
              "description": ""
            }
          ],
          "preRequestScript": "",
          "testScript": "pw.test(\"Sobre estándar (error, message, data, results)\", () => {\n  pw.expect(pw.response.body.error).toBeType(\"boolean\");\n  pw.expect(pw.response.body.message).toBeType(\"string\");\n});\npw.test(\"200 OK\", () => pw.expect(pw.response.status).toBe(200));\nconst rows = pw.response.body.data || [];\nconst last = rows[rows.length - 1];\n// El estado de la venta es el code del ÚLTIMO intento: 00 exitosa, 04 rechazada, 25 en proceso.\npw.test(\"Estado final (00 o 04)\", () => pw.expect([\"00\", \"04\"].includes(last && last.code)).toBe(true));",
          "auth": {
            "authType": "none",
            "authActive": true
          },
          "body": {
            "contentType": null,
            "body": null
          },
          "requestVariables": [],
          "responses": {},
          "description": null
        }
      ],
      "auth": {
        "authType": "inherit",
        "authActive": true
      },
      "headers": [],
      "variables": [],
      "description": null,
      "preRequestScript": "",
      "testScript": ""
    }
  ],
  "requests": [],
  "auth": {
    "authActive": true,
    "authType": "inherit"
  },
  "headers": [],
  "variables": [],
  "description": null,
  "preRequestScript": "",
  "testScript": ""
}