{
  "info": {
    "name": "VALIDATA Channel API v1 (sintética)",
    "description": "Datos ficticios. base_url es un marcador: aun no hay un entorno publico. key_id y secret son los sinteticos de los vectores de firma y no autentican en ningun entorno.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://base-url-pendiente.invalid"
    },
    {
      "key": "key_id",
      "value": "vectorkey0000001"
    },
    {
      "key": "secret",
      "value": "WlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlpaWlo"
    }
  ],
  "item": [
    {
      "name": "Validación: continuar COD (…0000)",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// Calcula la firma v1 = HMAC-SHA256(secret, '<timestamp>.<cuerpo crudo>'). Solo credenciales sintéticas.",
              "const ts = String(Math.floor(Date.now() / 1000));",
              "const raw = pm.request.body ? pm.request.body.raw : '';",
              "const secret = pm.collectionVariables.get('secret');",
              "pm.request.headers.upsert({ key: 'X-Validata-Timestamp', value: ts });",
              "pm.request.headers.upsert({ key: 'X-Validata-Signature', value: 'v1=' + CryptoJS.HmacSHA256(ts + '.' + raw, secret).toString(CryptoJS.enc.Hex) });"
            ]
          }
        }
      ],
      "request": {
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json"
          },
          {
            "key": "Idempotency-Key",
            "value": "postman-demo-0000-aaaa"
          },
          {
            "key": "X-Validata-Key-Id",
            "value": "{{key_id}}"
          },
          {
            "key": "X-Validata-Timestamp",
            "value": ""
          },
          {
            "key": "X-Validata-Signature",
            "value": ""
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\"schema_version\":\"channel.validation.v1\",\"channel\":\"whatsapp\",\"external_order_ref\":\"ORD-1001\",\"buyer\":{\"phone\":\"+57 300 000 0000\"},\"delivery\":{\"mode\":\"HOME_DELIVERY\",\"country\":\"CO\",\"department\":\"Cundinamarca\",\"city\":\"Bogotá\",\"address_line\":\"Calle 00 # 00-00\"},\"order\":{\"total\":\"120000\",\"currency\":\"COP\",\"payment_intent\":\"cod\"},\"event_at\":\"2026-10-19T15:00:00Z\"}"
        },
        "url": {
          "raw": "{{base_url}}/v1/channel/validations",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "v1",
            "channel",
            "validations"
          ]
        }
      }
    },
    {
      "name": "Readback de postman-demo-0000-aaaa",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "// Calcula la firma v1 = HMAC-SHA256(secret, '<timestamp>.<cuerpo crudo>'). Solo credenciales sintéticas.",
              "const ts = String(Math.floor(Date.now() / 1000));",
              "const raw = pm.request.body ? pm.request.body.raw : '';",
              "const secret = pm.collectionVariables.get('secret');",
              "pm.request.headers.upsert({ key: 'X-Validata-Timestamp', value: ts });",
              "pm.request.headers.upsert({ key: 'X-Validata-Signature', value: 'v1=' + CryptoJS.HmacSHA256(ts + '.' + raw, secret).toString(CryptoJS.enc.Hex) });"
            ]
          }
        }
      ],
      "request": {
        "method": "GET",
        "header": [
          {
            "key": "Idempotency-Key",
            "value": "postman-demo-0000-aaaa"
          },
          {
            "key": "X-Validata-Key-Id",
            "value": "{{key_id}}"
          },
          {
            "key": "X-Validata-Timestamp",
            "value": ""
          },
          {
            "key": "X-Validata-Signature",
            "value": ""
          }
        ],
        "url": {
          "raw": "{{base_url}}/v1/channel/validations/readback",
          "host": [
            "{{base_url}}"
          ],
          "path": [
            "v1",
            "channel",
            "validations",
            "readback"
          ]
        }
      }
    }
  ]
}