{
  "name": "Ответы не от API: не JSON при успехе, перенаправление, обрезанный JSON",
  "description": "Страница авторизации Wi-Fi с 200, перенаправление 302 (не выполняется: ключ не уходит на другой хост) и обрезанный JSON — unexpected_response без повтора. Ошибочный статус без problem+json даёт класс по статусу и пустой код.",
  "client": {
    "api": "runtime",
    "credential": {"terminalKey": "lk_test_k7m2p9q4r8s3.RqTvNAJirupwDOPZ8O48PZpsbGlZGfecp04FD7w06kw"},
    "baseUrl": "https://api.example.com"
  },
  "calls": [
    {
      "operation": "getBalance",
      "args": {"member": "01929c1e-0040-7040-8040-000000000040"},
      "expect": {"error": {"class": "unexpected_response", "status": 200}}
    },
    {
      "operation": "getReceipt",
      "args": {"receipt": "01929c1e-0050-7050-8050-000000000050"},
      "expect": {"error": {"class": "unexpected_response", "status": 302}}
    },
    {
      "operation": "calculateReceipt",
      "args": {
        "body": {
          "purchased_at": "2026-10-11T15:05:00+03:00",
          "lines": [{"id": "1", "sku": "LATTE-M", "name": "Латте 300 мл", "quantity": 2000, "amount": 50000}]
        }
      },
      "expect": {"error": {"class": "unexpected_response", "status": 200}}
    },
    {
      "operation": "getBalance",
      "args": {"member": "01929c1e-0040-7040-8040-000000000040"},
      "expect": {"error": {"class": "not_found", "status": 404, "code": null, "requestId": null}}
    }
  ],
  "exchanges": [
    {
      "request": {
        "method": "GET",
        "url": "https://api.example.com/api/v1/members/01929c1e-0040-7040-8040-000000000040/balance",
        "headers": {
          "authorization": "Bearer lk_test_k7m2p9q4r8s3.RqTvNAJirupwDOPZ8O48PZpsbGlZGfecp04FD7w06kw",
          "accept": "application/json",
          "content-type": null,
          "idempotency-key": null,
          "loyal-merchant": null
        }
      },
      "response": {
        "status": 200,
        "headers": {"Content-Type": "text/html; charset=utf-8"},
        "text": "<html><body><form action=\"/login\">Wi-Fi</form></body></html>"
      }
    },
    {
      "request": {
        "method": "GET",
        "url": "https://api.example.com/api/v1/receipts/01929c1e-0050-7050-8050-000000000050",
        "headers": {
          "authorization": "Bearer lk_test_k7m2p9q4r8s3.RqTvNAJirupwDOPZ8O48PZpsbGlZGfecp04FD7w06kw",
          "accept": "application/json",
          "content-type": null,
          "idempotency-key": null,
          "loyal-merchant": null
        }
      },
      "response": {"status": 302, "headers": {"Location": "https://login.example.net/portal"}}
    },
    {
      "request": {
        "method": "POST",
        "url": "https://api.example.com/api/v1/receipts:calculate",
        "headers": {
          "authorization": "Bearer lk_test_k7m2p9q4r8s3.RqTvNAJirupwDOPZ8O48PZpsbGlZGfecp04FD7w06kw",
          "accept": "application/json",
          "content-type": "application/json",
          "idempotency-key": null,
          "loyal-merchant": null
        },
        "json": {
          "purchased_at": "2026-10-11T15:05:00+03:00",
          "lines": [{"id": "1", "sku": "LATTE-M", "name": "Латте 300 мл", "quantity": 2000, "amount": 50000}]
        }
      },
      "response": {
        "status": 200,
        "headers": {"Content-Type": "application/json"},
        "text": "{\"id\": null, \"status\": nul"
      }
    },
    {
      "request": {
        "method": "GET",
        "url": "https://api.example.com/api/v1/members/01929c1e-0040-7040-8040-000000000040/balance",
        "headers": {
          "authorization": "Bearer lk_test_k7m2p9q4r8s3.RqTvNAJirupwDOPZ8O48PZpsbGlZGfecp04FD7w06kw",
          "accept": "application/json",
          "content-type": null,
          "idempotency-key": null,
          "loyal-merchant": null
        }
      },
      "response": {"status": 404, "headers": {"Content-Type": "text/html"}, "text": "<h1>Not Found</h1>"}
    }
  ],
  "sleeps": []
}
