{
  "info": {
    "_postman_id": "ros-connect-v1-demo",
    "name": "ROS Connect v1",
    "description": "Canonical ROS Connect partner collection. Use Mock POS or local/dev only. Placeholders: YOUR_WEBHOOK_SECRET. HMAC is SHA-256 over timestamp + '.' + raw body (X-ROS-Signature: sha256=<hex>). Petpooja/Toast/LucidPOS/Square are NOT implemented.",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    { "key": "base_url", "value": "http://localhost:5002" },
    { "key": "integration_id", "value": "int_demo_0001" },
    { "key": "merchant_id", "value": "merchant_demo" },
    { "key": "outlet_id", "value": "outlet_demo" },
    { "key": "api_key", "value": "key_demo_0001" },
    { "key": "api_secret", "value": "YOUR_WEBHOOK_SECRET" },
    { "key": "idempotency_key", "value": "idem_demo_0001" }
  ],
  "auth": {
    "type": "apikey",
    "apikey": [
      { "key": "key", "value": "X-ROS-Key-Id", "type": "string" },
      { "key": "value", "value": "{{api_key}}", "type": "string" }
    ]
  },
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [
          "const ts = Math.floor(Date.now() / 1000).toString();",
          "const raw = pm.request.body && pm.request.body.raw ? pm.request.body.raw : '';",
          "const secret = pm.variables.get('api_secret') || '';",
          "const sig = CryptoJS.HmacSHA256(ts + '.' + raw, secret).toString();",
          "pm.request.headers.upsert({ key: 'X-ROS-Timestamp', value: ts });",
          "pm.request.headers.upsert({ key: 'X-ROS-Signature', value: 'sha256=' + sig });",
          "pm.request.headers.upsert({ key: 'X-ROS-Event-Id', value: 'evt_demo_' + ts });",
          "pm.request.headers.upsert({ key: 'X-ROS-Key-Id', value: pm.variables.get('api_key') || 'k1' });",
          "pm.request.headers.upsert({ key: 'X-Request-Id', value: 'req_demo_' + ts });"
        ]
      }
    }
  ],
  "item": [
    {
      "name": "Getting Started",
      "item": [
        {
          "name": "Capabilities",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/capabilities"
          }
        },
        {
          "name": "Health",
          "request": {
            "method": "GET",
            "header": [],
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/health"
          }
        }
      ]
    },
    {
      "name": "Authentication",
      "item": [
        {
          "name": "Signed empty GET (capabilities)",
          "request": {
            "method": "GET",
            "header": [
              { "key": "X-ROS-Key-Id", "value": "{{api_key}}" }
            ],
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/capabilities",
            "description": "HMAC over timestamp + '.' + empty body. Never send restaurant user passwords."
          }
        }
      ]
    },
    {
      "name": "Customers",
      "item": [
        {
          "name": "customer.updated",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"eventId\": \"evt_01HDEMOCUSTOMER\",\n  \"eventType\": \"customer.updated\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"merchantId\": \"{{merchant_id}}\",\n  \"outletId\": \"{{outlet_id}}\",\n  \"occurredAt\": \"2026-08-17T12:00:00.000Z\",\n  \"idempotencyKey\": \"cust_demo_v1\",\n  \"data\": {\n    \"externalCustomerId\": \"cust_demo_1\",\n    \"mobile\": \"+910000000099\",\n    \"firstName\": \"Asha\",\n    \"lastName\": \"Khan\",\n    \"source\": \"mock_restaurant_pos\"\n  }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/events/customer.updated"
          }
        },
        {
          "name": "customer.lookup",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Idempotency-Key", "value": "{{idempotency_key}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"commandId\": \"cmd_lookup_1\",\n  \"action\": \"customer.lookup\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"idempotencyKey\": \"{{idempotency_key}}\",\n  \"requestedAt\": \"2026-08-17T12:00:00.000Z\",\n  \"data\": { \"mobile\": \"+910000000099\" }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/actions/customer.lookup"
          }
        },
        {
          "name": "customer.upsert",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"commandId\": \"cmd_upsert_1\",\n  \"action\": \"customer.upsert\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"idempotencyKey\": \"upsert_demo_1\",\n  \"requestedAt\": \"2026-08-17T12:00:00.000Z\",\n  \"data\": { \"externalCustomerId\": \"cust_demo_2\", \"mobile\": \"+910000000088\", \"firstName\": \"Nia\" }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/actions/customer.upsert"
          }
        }
      ]
    },
    {
      "name": "Bills",
      "item": [
        {
          "name": "bill.created",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"eventId\": \"evt_01HDEMOBILL\",\n  \"eventType\": \"bill.created\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"occurredAt\": \"2026-08-17T12:00:00.000Z\",\n  \"idempotencyKey\": \"bill_1480_created_v1\",\n  \"data\": {\n    \"externalBillId\": \"bill_1480\",\n    \"billNumber\": \"MOCK-1480\",\n    \"items\": [\n      { \"name\": \"Chicken Tikka\", \"quantity\": 2, \"unitPriceMinor\": 50000, \"totalMinor\": 100000 },\n      { \"name\": \"Beer\", \"quantity\": 2, \"unitPriceMinor\": 15000, \"totalMinor\": 30000 },\n      { \"name\": \"Fries\", \"quantity\": 1, \"unitPriceMinor\": 18000, \"totalMinor\": 18000 }\n    ],\n    \"totalMinor\": 148000,\n    \"currency\": \"INR\",\n    \"status\": \"COMPLETED\",\n    \"vendorStatus\": \"closed\",\n    \"rosStatus\": \"COMPLETED\"\n  }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/events/bill.created"
          }
        }
      ]
    },
    {
      "name": "Bill Updates",
      "item": [
        {
          "name": "bill.updated",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"eventId\": \"evt_01HDEMOBILLUPD\",\n  \"eventType\": \"bill.updated\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"occurredAt\": \"2026-08-17T12:10:00.000Z\",\n  \"idempotencyKey\": \"bill_1480_updated_v2\",\n  \"data\": {\n    \"externalBillId\": \"bill_1480\",\n    \"revision\": 2,\n    \"occurredAt\": \"2026-08-17T12:10:00.000Z\",\n    \"items\": [{ \"name\": \"Chicken Tikka\", \"quantity\": 2, \"unitPriceMinor\": 50000, \"totalMinor\": 100000 }],\n    \"totalMinor\": 150000,\n    \"currency\": \"INR\",\n    \"tipMinor\": 2000\n  }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/events/bill.updated"
          }
        }
      ]
    },
    {
      "name": "Bill Voids",
      "item": [
        {
          "name": "bill.voided",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"eventId\": \"evt_01HDEMOBILLVOID\",\n  \"eventType\": \"bill.voided\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"occurredAt\": \"2026-08-17T12:20:00.000Z\",\n  \"idempotencyKey\": \"bill_1480_void_v1\",\n  \"data\": { \"externalBillId\": \"bill_1480\", \"reason\": \"guest left\", \"occurredAt\": \"2026-08-17T12:20:00.000Z\" }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/events/bill.voided"
          }
        }
      ]
    },
    {
      "name": "Sale Returns",
      "item": [
        {
          "name": "sale.returned",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"eventId\": \"evt_01HDEMORETURN\",\n  \"eventType\": \"sale.returned\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"occurredAt\": \"2026-08-17T12:30:00.000Z\",\n  \"idempotencyKey\": \"sale_ret_fries_v1\",\n  \"data\": {\n    \"originalTransactionId\": \"bill_1480\",\n    \"returnTransactionId\": \"ret_demo_1\",\n    \"amountMinor\": 18000,\n    \"currency\": \"INR\",\n    \"reason\": \"Fries returned\",\n    \"occurredAt\": \"2026-08-17T12:30:00.000Z\"\n  }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/events/sale.returned"
          }
        }
      ]
    },
    {
      "name": "Payment Types",
      "item": [
        {
          "name": "payment-types.updated",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"eventId\": \"evt_01HDEMOPAY\",\n  \"eventType\": \"payment-types.updated\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"occurredAt\": \"2026-08-17T12:00:00.000Z\",\n  \"idempotencyKey\": \"paytypes_v1\",\n  \"data\": {\n    \"categories\": [\n      { \"name\": \"Cash\", \"types\": [] },\n      { \"name\": \"Card\", \"types\": [\"hdfc\", \"axis\"] },\n      { \"name\": \"Wallet\", \"types\": [\"zomato\", \"dineout\"] }\n    ]\n  }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/events/payment-types.updated"
          }
        },
        {
          "name": "payment-types.push",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"commandId\": \"cmd_paytypes_push\",\n  \"action\": \"payment-types.push\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"idempotencyKey\": \"paytypes_push_v1\",\n  \"requestedAt\": \"2026-08-17T12:00:00.000Z\",\n  \"data\": {\n    \"categories\": [\n      { \"name\": \"Cash\", \"types\": [] },\n      { \"name\": \"Card\", \"types\": [\"hdfc\"] }\n    ]\n  }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/actions/payment-types.push"
          }
        }
      ]
    },
    {
      "name": "Menu",
      "item": [
        {
          "name": "menu.updated",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"eventId\": \"evt_01HDEMOMENU\",\n  \"eventType\": \"menu.updated\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"occurredAt\": \"2026-08-17T12:00:00.000Z\",\n  \"idempotencyKey\": \"menu_v17\",\n  \"data\": {\n    \"menuVersion\": \"17\",\n    \"items\": [{ \"name\": \"Chicken Tikka\" }, { \"name\": \"Beer\" }, { \"name\": \"Fries\" }]\n  }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/events/menu.updated"
          }
        },
        {
          "name": "menu.push",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"commandId\": \"cmd_menu_push_1\",\n  \"action\": \"menu.push\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"idempotencyKey\": \"menu_push_demo\",\n  \"requestedAt\": \"2026-08-17T12:00:00.000Z\",\n  \"data\": { \"menuVersion\": \"17\", \"items\": [{ \"name\": \"Chicken Tikka\" }] }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/actions/menu.push"
          }
        }
      ]
    },
    {
      "name": "Rewards",
      "item": [
        {
          "name": "reward.validate",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"commandId\": \"cmd_rw_val\",\n  \"action\": \"reward.validate\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"idempotencyKey\": \"rw_val_1\",\n  \"requestedAt\": \"2026-08-17T12:00:00.000Z\",\n  \"data\": {\n    \"customerReference\": \"cust_demo_1\",\n    \"billReference\": \"bill_1480\",\n    \"rewardReference\": \"RW_DEMO\",\n    \"amountMinor\": 148000,\n    \"currency\": \"INR\"\n  }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/actions/reward.validate"
          }
        },
        {
          "name": "reward.redeem",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"commandId\": \"cmd_rw_red\",\n  \"action\": \"reward.redeem\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"idempotencyKey\": \"rw_red_1\",\n  \"requestedAt\": \"2026-08-17T12:00:00.000Z\",\n  \"data\": {\n    \"customerReference\": \"cust_demo_1\",\n    \"billReference\": \"bill_1480\",\n    \"rewardReference\": \"RW_DEMO\",\n    \"amountMinor\": 148000,\n    \"currency\": \"INR\"\n  }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/actions/reward.redeem"
          }
        },
        {
          "name": "reward.revert",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"commandId\": \"cmd_rw_rev\",\n  \"action\": \"reward.revert\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"idempotencyKey\": \"rw_rev_1\",\n  \"requestedAt\": \"2026-08-17T12:00:00.000Z\",\n  \"data\": { \"originalRedemptionReference\": \"red_RW_DEMO\", \"reason\": \"bill voided\" }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/actions/reward.revert"
          }
        }
      ]
    },
    {
      "name": "Webhooks",
      "item": [
        {
          "name": "Generic ingest",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"eventId\": \"evt_01HDEMOWH\",\n  \"eventType\": \"customer.updated\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"occurredAt\": \"2026-08-17T12:00:00.000Z\",\n  \"idempotencyKey\": \"wh_cust_1\",\n  \"data\": { \"externalCustomerId\": \"cust_wh_1\", \"mobile\": \"+910000000099\" }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/webhooks"
          }
        }
      ]
    },
    {
      "name": "Errors",
      "item": [
        {
          "name": "Invalid signature (omit header after send)",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{ \"eventId\": \"evt_bad\", \"eventType\": \"customer.updated\", \"schemaVersion\": \"1.0\", \"integrationId\": \"{{integration_id}}\", \"occurredAt\": \"2026-08-17T12:00:00.000Z\", \"idempotencyKey\": \"bad_sig\", \"data\": { \"externalCustomerId\": \"x\" } }"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/events/customer.updated",
            "description": "Replace X-ROS-Signature with sha256=deadbeef to see SIGNATURE_INVALID."
          }
        }
      ]
    },
    {
      "name": "Idempotency",
      "item": [
        {
          "name": "Replay same customer.updated",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"eventId\": \"evt_01HDEMOCUSTOMER\",\n  \"eventType\": \"customer.updated\",\n  \"schemaVersion\": \"1.0\",\n  \"integrationId\": \"{{integration_id}}\",\n  \"occurredAt\": \"2026-08-17T12:00:00.000Z\",\n  \"idempotencyKey\": \"cust_demo_v1\",\n  \"data\": { \"externalCustomerId\": \"cust_demo_1\", \"mobile\": \"+910000000099\" }\n}"
            },
            "url": "{{base_url}}/v1/integrations/{{integration_id}}/events/customer.updated",
            "description": "Second send with the same idempotencyKey returns 409 DUPLICATE_EVENT."
          }
        }
      ]
    }
  ]
}
