{
  "name": "Поставщик сеансов заменяет отвергнутый сеанс один раз за вызов",
  "description": "Сеанс, с которым создан клиент, получил 401 (истёк): клиент забывает его, берёт у поставщика новый и повторяет ту же попытку без паузы. Следующий вызов идёт с новым сеансом. endSession на уже закрытом сеансе (401) — успех, после него клиент берёт сеанс у поставщика. 401 на сеансе, полученном этим же вызовом, — окончательная ошибка authentication: поставщик второй раз не вызывается, а отвергнутый сеанс забыт, поэтому endSession ничего не отправляет.",
  "client": {
    "api": "member",
    "credential": {
      "memberSession": "lms_test_d0f3364baf26.4OuDuCo1m7vWf_OongPoB6orwvXEHwM1vFYHST6ieao",
      "sessionProvider": [
        "lms_test_44fcc049028e.YX6uB4Uy9bSplk5J3N4vxOonenmkJ6GYMB-zwIwDSfs",
        "lms_test_c5603a48a6f4.M6YGDTb54sJm9vWqA-NCCF3qsFrOKz3MmZji6tBQT94"
      ]
    },
    "origin": "http://localhost:3000",
    "baseUrl": "https://api.example.com"
  },
  "calls": [
    {
      "operation": "issuePresentationCode",
      "args": {},
      "expect": {
        "result": {"code": "16234815", "expires_at": "2026-10-13T12:05:00Z", "qr_svg": "data:image/svg+xml;base64,PHN2Zy8+"},
        "meta": {"operationId": "issuePresentationCode", "status": 201, "requestId": "01929c20-0202-7000-8000-000000000202"}
      }
    },
    {
      "operation": "issuePresentationCode",
      "args": {},
      "expect": {"result": {"code": "23481516", "expires_at": "2026-10-13T12:06:00Z", "qr_svg": "data:image/svg+xml;base64,PHN2Zy8+"}}
    },
    {"operation": "endSession", "args": {}, "expect": {"result": null, "meta": {"operationId": "endSession", "status": 401}}},
    {
      "operation": "issuePresentationCode",
      "args": {},
      "expect": {
        "error": {
          "class": "authentication",
          "status": 401,
          "code": "unauthenticated",
          "requestId": "01929c20-0205-7000-8000-000000000205",
          "idempotencyKey": null
        }
      }
    },
    {"operation": "endSession", "args": {}, "expect": {"result": null}}
  ],
  "exchanges": [
    {
      "request": {
        "method": "POST",
        "url": "https://api.example.com/api/member/v1/me/presentation-codes",
        "headers": {
          "authorization": "Bearer lms_test_d0f3364baf26.4OuDuCo1m7vWf_OongPoB6orwvXEHwM1vFYHST6ieao",
          "accept": "application/json",
          "content-type": null,
          "idempotency-key": null,
          "loyal-merchant": null,
          "origin": "http://localhost:3000"
        }
      },
      "response": {
        "status": 401,
        "headers": {"Content-Type": "application/problem+json", "X-Request-Id": "01929c20-0201-7000-8000-000000000201", "WWW-Authenticate": "Bearer realm=\"loyal\""},
        "json": {
          "type": "urn:loyal:problem:unauthenticated",
          "title": "A valid API key is required.",
          "status": 401,
          "code": "unauthenticated",
          "request_id": "01929c20-0201-7000-8000-000000000201"
        }
      }
    },
    {
      "request": {
        "method": "POST",
        "url": "https://api.example.com/api/member/v1/me/presentation-codes",
        "headers": {
          "authorization": "Bearer lms_test_44fcc049028e.YX6uB4Uy9bSplk5J3N4vxOonenmkJ6GYMB-zwIwDSfs",
          "accept": "application/json",
          "content-type": null,
          "idempotency-key": null,
          "loyal-merchant": null,
          "origin": "http://localhost:3000"
        }
      },
      "response": {
        "status": 201,
        "headers": {"Content-Type": "application/json", "X-Request-Id": "01929c20-0202-7000-8000-000000000202"},
        "json": {"code": "16234815", "expires_at": "2026-10-13T12:05:00Z", "qr_svg": "data:image/svg+xml;base64,PHN2Zy8+"}
      }
    },
    {
      "request": {
        "method": "POST",
        "url": "https://api.example.com/api/member/v1/me/presentation-codes",
        "headers": {
          "authorization": "Bearer lms_test_44fcc049028e.YX6uB4Uy9bSplk5J3N4vxOonenmkJ6GYMB-zwIwDSfs",
          "accept": "application/json",
          "content-type": null,
          "idempotency-key": null,
          "loyal-merchant": null,
          "origin": "http://localhost:3000"
        }
      },
      "response": {
        "status": 201,
        "headers": {"Content-Type": "application/json", "X-Request-Id": "01929c20-0203-7000-8000-000000000203"},
        "json": {"code": "23481516", "expires_at": "2026-10-13T12:06:00Z", "qr_svg": "data:image/svg+xml;base64,PHN2Zy8+"}
      }
    },
    {
      "request": {
        "method": "DELETE",
        "url": "https://api.example.com/api/member/v1/session",
        "headers": {
          "authorization": "Bearer lms_test_44fcc049028e.YX6uB4Uy9bSplk5J3N4vxOonenmkJ6GYMB-zwIwDSfs",
          "accept": "application/json",
          "content-type": null,
          "idempotency-key": null,
          "loyal-merchant": null,
          "origin": "http://localhost:3000"
        }
      },
      "response": {
        "status": 401,
        "headers": {"Content-Type": "application/problem+json", "X-Request-Id": "01929c20-0204-7000-8000-000000000204"},
        "json": {
          "type": "urn:loyal:problem:unauthenticated",
          "title": "A valid API key is required.",
          "status": 401,
          "code": "unauthenticated",
          "request_id": "01929c20-0204-7000-8000-000000000204"
        }
      }
    },
    {
      "request": {
        "method": "POST",
        "url": "https://api.example.com/api/member/v1/me/presentation-codes",
        "headers": {
          "authorization": "Bearer lms_test_c5603a48a6f4.M6YGDTb54sJm9vWqA-NCCF3qsFrOKz3MmZji6tBQT94",
          "accept": "application/json",
          "content-type": null,
          "idempotency-key": null,
          "loyal-merchant": null,
          "origin": "http://localhost:3000"
        }
      },
      "response": {
        "status": 401,
        "headers": {"Content-Type": "application/problem+json", "X-Request-Id": "01929c20-0205-7000-8000-000000000205"},
        "json": {
          "type": "urn:loyal:problem:unauthenticated",
          "title": "A valid API key is required.",
          "status": 401,
          "code": "unauthenticated",
          "request_id": "01929c20-0205-7000-8000-000000000205"
        }
      }
    }
  ],
  "sleeps": []
}
