[ Base URL: https://api.plazius.ru/pub ]

В данном разделе описаны основные действия, доступные для работы с гостем.

  • Примеры запросов приведены ниже в Swagger.
  • Протестировать запросы через Postman можно с помощью коллекции. В них добавлен раздел Работа с гостями.
Номер телефона гостя является его ключевым идентификатором и должен быть уникальным в рамках одной организации/сети Plazius.

О сценариях использования запросов API читайте в отдельном разделе.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/guests/save": { "post": { "tags": [ "Создание/обновление гостя" ], "summary": "Сохранить данные о госте", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SaveGuestRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/SaveGuestResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "Sex": { "enum": [ "notSpecified", "male", "female" ], "type": "string", "description": "Пол" }, "GuestDto": { "required": [ "phone" ], "type": "object", "properties": { "phone": { "type": "string", "description": "Номер телефона", "example": "+79990001122" }, "firstName": { "type": "string", "description": "Имя", "nullable": true, "example": "Иван" }, "middleName": { "type": "string", "description": "Отчество", "nullable": true, "example": "Иванович" }, "lastName": { "type": "string", "description": "Фамилия", "nullable": true, "example": "Иванов" }, "email": { "type": "string", "description": "Email", "nullable": true, "example": "test_email@gmail.com" }, "birthday": { "type": "string", "description": "Дата рождения", "format": "date", "nullable": true, "example": "1989-01-17" }, "sex": { "$ref": "#/components/schemas/Sex" } }, "additionalProperties": false, "description": "Данные гостя" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "SaveGuestRequestDto": { "required": [ "guest", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" } }, "additionalProperties": false, "description": "Аргументы операции сохранения данных о госте" }, "SaveGuestResponseDto": { "required": [ "guest" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestDto" } }, "additionalProperties": false, "description": "Результат операции сохранения данных о госте" }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" } } } }

Запрос /loyalty/guests/save сохраняет данные гостя в базе лояльности.

При создании гостя, он автоматически становится участником программы лояльности.

Если гость с таким же номером телефона уже существует, то запрос обновит данные. При обновлении будут заменены все данные, которые переданы в запросе. Поэтому чтобы изменить значение одного параметра, необходимо передать все текущие параметры с одним измененным. Для обновления только одного параметра, воспользуйтесь запросом /update по частичному обновлению гостя.

Изменить номер телефона пользователя можно только вручную. Для этого обратитесь в техническую поддержку.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/guests/update": { "post": { "tags": [ "Частичное обновление гостя" ], "summary": "Частично обновить данные о госте", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateGuestRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateGuestResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "StringUpdatableFieldDto": { "required": [ "hasValue" ], "type": "object", "properties": { "hasValue": { "type": "boolean", "description": "Необходимость применить новое значение" }, "value": { "type": "string", "description": "Новое значение", "nullable": true } }, "additionalProperties": false, "description": "Модель обновления поля сущности" }, "DateTimeNullableUpdatableFieldDto": { "required": [ "hasValue" ], "type": "object", "properties": { "hasValue": { "type": "boolean", "description": "Необходимость применить новое значение" }, "value": { "type": "string", "description": "Новое значение", "format": "date-time", "nullable": true } }, "additionalProperties": false, "description": "Модель обновления поля сущности" }, "Sex": { "enum": [ "notSpecified", "male", "female" ], "type": "string", "description": "Пол" }, "SexUpdatableFieldDto": { "required": [ "hasValue" ], "type": "object", "properties": { "hasValue": { "type": "boolean", "description": "Необходимость применить новое значение" }, "value": { "$ref": "#/components/schemas/Sex" } }, "additionalProperties": false, "description": "Модель обновления поля сущности" }, "UpdateGuestInformationDto": { "type": "object", "properties": { "firstName": { "$ref": "#/components/schemas/StringUpdatableFieldDto" }, "middleName": { "$ref": "#/components/schemas/StringUpdatableFieldDto" }, "lastName": { "$ref": "#/components/schemas/StringUpdatableFieldDto" }, "email": { "$ref": "#/components/schemas/StringUpdatableFieldDto" }, "birthday": { "$ref": "#/components/schemas/DateTimeNullableUpdatableFieldDto" }, "sex": { "$ref": "#/components/schemas/SexUpdatableFieldDto" } }, "additionalProperties": false, "description": "Модель обновления данных гостя" }, "UpdateGuestRequestDto": { "required": [ "guest", "guestInformation", "organization" ], "type": "object", "properties": { "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "guestInformation": { "$ref": "#/components/schemas/UpdateGuestInformationDto" } }, "additionalProperties": false, "description": "Аргументы операции обновления данных гостя" }, "GuestDto": { "required": [ "phone" ], "type": "object", "properties": { "phone": { "type": "string", "description": "Номер телефона", "example": "+79990001122" }, "firstName": { "type": "string", "description": "Имя", "nullable": true, "example": "Иван" }, "middleName": { "type": "string", "description": "Отчество", "nullable": true, "example": "Иванович" }, "lastName": { "type": "string", "description": "Фамилия", "nullable": true, "example": "Иванов" }, "email": { "type": "string", "description": "Email", "nullable": true, "example": "test_email@gmail.com" }, "birthday": { "type": "string", "description": "Дата рождения", "format": "date", "nullable": true, "example": "1989-01-17" }, "sex": { "$ref": "#/components/schemas/Sex" } }, "additionalProperties": false, "description": "Данные гостя" }, "UpdateGuestResponseDto": { "required": [ "guest" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestDto" } }, "additionalProperties": false, "description": "Результат операции обновления данных гостя" }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" } } } }

Запрос /loyalty/guests/update частично обновляет данные гостя в базе лояльности.

С его помощью обновляются только те данные, которые были переданы в запросе, и только с параметром HasValue = true. Для удаления свойства или возвращения его к значению по умолчанию необходимо:

  • Параметр HasValue = true передать
  • Параметр Value не передавать.

Обратите внимание: запрос может обновить данные только существующего гостя с указанным номером.

Изменить номер телефона пользователя можно только вручную. Для этого обратитесь в техническую поддержку.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/guests/get": { "post": { "tags": [ "Получение гостя" ], "summary": "Получить данные о госте", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetGuestRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetGuestResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "GetGuestRequestDto": { "required": [ "guest", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" } }, "additionalProperties": false, "description": "Аргументы операции получения данных о госте" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "GuestLoyaltyCardDto": { "required": [ "isVirtual", "number", "track" ], "type": "object", "properties": { "track": { "type": "string", "description": "Трек номер карты - уникальный идентификатор карты. Может быть использован в запросе удаления карты у пользователя", "example": "1A56CD0" }, "number": { "type": "string", "description": "Номер карты для отображения пользователю", "example": "23000001GF" }, "isVirtual": { "type": "boolean", "description": "Признак, указывающий что карта виртуальная.\r\nЕсли установлен в false - предполагается, что это магнитная пластиковая карта, которая выдана гостю" } }, "additionalProperties": false, "description": "Данные карты лояльности" }, "GetGuestResponseDto": { "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestDto" }, "loyaltyCards": { "type": "array", "items": { "$ref": "#/components/schemas/GuestLoyaltyCardDto" }, "description": "Список карт лояльности пользователя, в т.ч. виртуальных. Могут отсутствовать", "nullable": true } }, "additionalProperties": false, "description": "Результат операции получения данных о госте" }, "GuestDto": { "required": [ "phone" ], "type": "object", "properties": { "phone": { "type": "string", "description": "Номер телефона", "example": "+79990001122" }, "firstName": { "type": "string", "description": "Имя", "nullable": true, "example": "Иван" }, "middleName": { "type": "string", "description": "Отчество", "nullable": true, "example": "Иванович" }, "lastName": { "type": "string", "description": "Фамилия", "nullable": true, "example": "Иванов" }, "email": { "type": "string", "description": "Email", "nullable": true, "example": "test_email@gmail.com" }, "birthday": { "type": "string", "description": "Дата рождения", "format": "date", "nullable": true, "example": "1989-01-17" }, "sex": { "type": "integer", "description": "Пол. 1 - мужской, 2 - женский, 0 - не указано", "format": "int32", "example": 1 } }, "additionalProperties": false, "description": "Данные гостя" } } } }

Запрос /loyalty/guests/get получает данные гостя по его номеру телефона.

Запрос также возвращает бонусные карты, которые привязаны к гостю: пластиковые, виртуальные и Wallet.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/guests/getWallet": { "post": { "tags": [ "Получение кошелька гостя" ], "summary": "Получить данные о кошельке гостя", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetGuestWalletRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetGuestWalletResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "GetGuestWalletRequestDto": { "required": [ "guest", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" } }, "additionalProperties": false, "description": "Аргументы операции получения данных о кошельке госте" }, "RankConfirmationInfoDto": { "required": [ "hoursLeft", "sumLeft" ], "type": "object", "properties": { "sumLeft": { "type": "number", "description": "Сумма которую необходимо потратить для подтверждения ранга", "format": "double", "example": 500.5 }, "hoursLeft": { "type": "integer", "description": "Количество часов за которые необходимо потратить сумму подтверждения", "format": "int32", "example": 12 } }, "additionalProperties": false, "description": "Описание требования подтверждения ранга" }, "CurrentGuestRankDto": { "required": [ "cashbackPercentage", "index", "name" ], "type": "object", "properties": { "name": { "type": "string", "description": "Название ранга", "example": "Gold" }, "index": { "type": "integer", "description": "Индекс текущего ранга (в списке рангов, отсчет с 0)", "format": "int32", "example": 1 }, "confirmation": { "$ref": "#/components/schemas/RankConfirmationInfoDto" }, "cashbackPercentage": { "type": "number", "description": "Процент бонусов, например 12.5", "format": "double", "example": 12.5 } }, "additionalProperties": false, "description": "Описывает специфичную информацию о текущем бонусном ранге пользователя" }, "GetGuestWalletResponseDto": { "required": [ "balance" ], "type": "object", "properties": { "balance": { "type": "number", "description": "Количество бонусов в кошельке", "format": "double", "example": 155 }, "currentRank": { "$ref": "#/components/schemas/CurrentGuestRankDto" } }, "additionalProperties": false, "description": "Результат операции получения данных о кошельке госте" } } } }

Запрос /loyalty/guests/getWallet позволяет получить информацию о текущих привилегиях гостя, передав его номер телефона.

Если в запросе указать идентификаторы ресторана, которые относятся к одной сети, то кошелек гостя будет один и тот же, так как является общим на всю сеть. 

В зависимости от настроек ранговой механики ресторана в ответе могут отсутствовать данные о подтверждении — confirmation — ранга.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/guests/addBonus": { "post": { "tags": [ "Начисление бонусов гостю" ], "summary": "Добавить бонусы на баланс гостя", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChangeBonusBalanceRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции" }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "ChangeBonusBalanceRequestDto": { "required": [ "amount", "comment", "guest", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "amount": { "type": "number", "description": "Сумма изменения баланса. Всегда больше 0", "format": "double", "example": 155 }, "comment": { "type": "string", "description": "Комментарий. Используется для отображения в истории бонусов пользователя", "example": "В день рождения" } }, "additionalProperties": false } } } }

Запрос /loyalty/guests/addBonus добавляет бонусы гостю по его номеру телефона.

Указанный в запросе комментарий будет отображаться в истории изменений баланса бонусов гостя. Бонусный счет один на организацию или сеть.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/guests/writeoffBonus": { "post": { "tags": [ "Списание бонусов гостя" ], "summary": "Списать бонусы с баланса гостя", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ChangeBonusBalanceRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции" }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "ChangeBonusBalanceRequestDto": { "required": [ "amount", "comment", "guest", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "amount": { "type": "number", "description": "Сумма изменения баланса. Всегда больше 0", "format": "double", "example": 155 }, "comment": { "type": "string", "description": "Комментарий. Используется для отображения в истории бонусов пользователя", "example": "В день рождения" } }, "additionalProperties": false } } } }

Запрос /loyalty/guests/writeoffBonus списывает бонусы гостя по его номеру телефона.

Указанный в запросе комментарий будет отображаться в истории изменений баланса бонусов гостя.

Бонусный баланс

  • Должен быть всегда положительным, даже после списания бонусов
  • Один на организацию или сеть.
{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/guests/addLoyaltyCard": { "post": { "tags": [ "Привязка карты лояльности" ], "summary": "Создать новую карту гостю", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/AddLoyaltyCardRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции" }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "AddLoyaltyCardRequestDto": { "required": [ "cardNumber", "cardTrack", "guest", "isVirtual", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "cardTrack": { "type": "string", "description": "Трек номер карты - уникальный идентификатор карты. Может быть использован в запросе удаления карты у пользователя.\r\nМожет совпадать с CardNumber.\r\nДолжен содержать не менее 3 символов", "example": "1A56CD0" }, "cardNumber": { "type": "string", "description": "Номер карты для отображения пользователю", "example": "23000001GF" } }, "additionalProperties": false } } } }

Запрос /loyalty/guests/addLoyaltyCard привязывает существующую карту лояльности к гостю.

Можно создать карту лояльности для всей сети. Для этого укажите в запросе идентификатор ресторана, который относится к сети.

Обратите внимание: трек-номер и номер карты должны быть уникальны в разрезе одной организации или сети.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/guests/generateLoyaltyCard": { "post": { "tags": [ "Создание новой карты лояльности" ],         "summary": "Создать гостю виртуальную карту. Виртуальная карта может быть только одна", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GenerateLoyaltyCardRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GenerateLoyaltyCardResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "minLength": 1, "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "minLength": 1, "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "GenerateLoyaltyCardRequestDto": { "required": [ "guest", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" } }, "additionalProperties": false }, "GenerateLoyaltyCardResponseDto": { "required": [ "card" ], "type": "object", "properties": { "card": { "$ref": "#/components/schemas/GuestLoyaltyCardDto" } }, "additionalProperties": false }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestLoyaltyCardDto": { "required": [ "isVirtual", "number", "track" ], "type": "object", "properties": { "track": { "minLength": 1, "type": "string", "description": "Трек номер карты - уникальный идентификатор карты. Может быть использован в запросе удаления карты у пользователя", "example": "1A56CD0" }, "number": { "minLength": 1, "type": "string", "description": "Номер карты для отображения пользователю", "example": "23000001GF" }, "isVirtual": { "type": "boolean", "description": "Признак, указывающий что карта виртуальная.\r\nЕсли установлен в false - предполагается, что это магнитная пластиковая карта, которая выдана гостю", "example": true } }, "additionalProperties": false, "description": "Данные карты лояльности" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "minLength": 1, "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" } } } }

Запрос /loyalty/guests/generateLoyaltyCard создаёт новую виртуальную карту лояльности и привязывает к гостю.

Виртуальная карта может быть только одна. Wallet является виртуальной картой.
Запрос автоматически назначит свободный номер для карты и вернёт его в ответе.

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/guests/getOrdersHistory": { "post": { "tags": [ "Получение истории заказов" ], "summary": "Получить данные истории заказов гостя", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetOrdersHistoryRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetOrdersHistoryResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "OrderStatus": { "enum": [ "open", "closed", "aborted" ], "type": "string" }, "OrdersHistoryFilterDto": { "type": "object", "properties": { "fromDate": { "type": "string", "description": "Фильтр по дате создания заказа. Получить данные начиная с указанной даты. В UTC", "format": "date-time", "nullable": true }, "toDate": { "type": "string", "description": "Фильтр по дате создания заказа. Получить данные заканчивая указанной датой. В UTC", "format": "date-time", "nullable": true }, "skip": { "type": "integer", "description": "Количество заказов, которое нужно пропустить (для пагинации)", "format": "int32", "nullable": true, "example": 0 }, "take": { "type": "integer", "description": "Количество заказов, которое нужно получить (для пагинации)", "format": "int32", "nullable": true, "example": 50 }, "orderStatus": { "$ref": "#/components/schemas/OrderStatus" }, "organizationsInNetwork": { "type": "array", "items": { "type": "string" }, "description": "Фильтр по организациям внутри сети. Массив RkObjectId. Данные доступны только для тех ресторанов в сети, которые включены в ApiKey", "nullable": true } }, "additionalProperties": false, "description": "Фильтры истории заказов" }, "GetOrdersHistoryRequestDto": { "required": [ "guest", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "filter": { "$ref": "#/components/schemas/OrdersHistoryFilterDto" }, "fillOrderDetails": { "type": "boolean", "description": "Признак необходимости наполнения заказа дополнительными деталями" } }, "additionalProperties": false, "description": "Аргументы операции получения истории заказов пользователя" }, "OrdersHistoryProductDto": { "required": [ "code", "cost", "name", "price", "quantity" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)", "example": "12345" }, "name": { "type": "string", "description": "Название товара", "example": "Пирог с малиной" }, "group": { "type": "string", "description": "Группа товара", "nullable": true, "example": "Мучное" }, "price": { "type": "number", "description": "Суммарная стоимость товаров в позиции по прайсу без учёта скидок. Например, для 2х кофе по 85 рублей, вернётся 170", "format": "double", "example": 170 }, "cost": { "type": "number", "description": "Суммарная стоимость товаров с учётом всех скидок", "format": "double", "example": 140 }, "quantity": { "type": "number", "description": "Количество единиц товара в позиции", "format": "double", "example": 2 } }, "additionalProperties": false, "description": "Данные о товаре" }, "OrderSource": { "enum": [ "indoor", "delivery" ], "type": "string" }, "OrdersHistoryOrderDto": { "required": [ "bonusPaymentRollbackSum", "freeProductSum", "fullSum", "id", "openTime", "organizationId", "paidWithBonuses", "products", "source", "status", "sumToPay", "еarnedBonuses" ], "type": "object", "properties": { "id": { "type": "string", "description": "ИД заказа", "format": "uuid" }, "number": { "type": "integer", "description": "Кассовый номер заказа, если есть", "format": "int32", "nullable": true }, "fullSum": { "type": "number", "description": "Суммарная стоимость заказа по прайсу без учёта скидок", "format": "double", "example": 1500 }, "sumToPay": { "type": "number", "description": "Суммарная стоимость заказа, которую необходимо оплатить (уплачена) после учёта всех скидок", "format": "double", "example": 1200 }, "freeProductSum": { "type": "number", "description": "Суммарная скидка по применённым акциям", "format": "double", "example": 150 }, "paidWithBonuses": { "type": "number", "description": "Сколько бонусов был списано для оплаты заказа", "format": "double", "example": 150 }, "еarnedBonuses": { "type": "number", "description": "Сколько бонусов был начислено за заказ", "format": "double", "example": 100 }, "bonusPaymentRollbackSum": { "type": "number", "description": "Сумма возврата бонусов (для отменённых заказов)", "format": "double", "example": 100 }, "openTime": { "type": "string", "description": "Дата открытия заказа", "format": "date-time" }, "closeTime": { "type": "string", "description": "Дата закрытия заказа", "format": "date-time", "nullable": true }, "status": { "$ref": "#/components/schemas/OrderStatus" }, "products": { "type": "array", "items": { "$ref": "#/components/schemas/OrdersHistoryProductDto" }, "description": "Позиции в заказе" }, "organizationId": { "type": "string", "description": "Id организации, в которой был сделан заказ", "format": "uuid" }, "source": { "$ref": "#/components/schemas/OrderSource" } }, "additionalProperties": false, "description": "Данные о заказе" }, "GetOrdersHistoryResponseDto": { "required": [ "orders", "totalCount" ], "type": "object", "properties": { "orders": { "type": "array", "items": { "$ref": "#/components/schemas/OrdersHistoryOrderDto" }, "description": "Список заказов" }, "totalCount": { "type": "integer", "description": "Полное количество заказов", "format": "int32", "example": 25 } }, "additionalProperties": false, "description": "Результат операции получения истории заказов пользователя" }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" } } } }

Запрос /loyalty/guests/getOrdersHistory получает историю заказов пользователя по его номеру телефона.

Работа запроса для сетевых заведений:

  • Если в запросе указать идентификатор ресторана, который относится к сети, то в ответе будет история заказов для всей сети. 
  • Для получения истории заказов конкретного ресторана сети используйте фильтр.
  • Данные доступны только для тех ресторанов в сети, к которым есть доступ у переданного ApiKey.

По умолчанию история заказов возвращается без детализации, то есть без списка блюд. Чтобы получить детализацию передайте флаг fillOrderDetails.

По умолчанию для пагинации используются параметры, при которых будут получены первые 50 заказов. Сортировка осуществляется по убыванию даты открытия заказа.

{ "openapi": "3.0.1", "paths": {"/b2b/v1/loyalty/guests/getBonusHistory": { "post": { "tags": [ "Получение истории изменения бонусного баланса" ], "summary": "Получить данные истории изменений бонусного баланса", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetBonusHistoryRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetBonusHistoryResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "BonusHistoryFilterDto": { "type": "object", "properties": { "fromDate": { "type": "string", "description": "Фильтр по дате операции. Получить данные начиная с указанной даты. В UTC", "format": "date-time", "nullable": true }, "toDate": { "type": "string", "description": "Фильтр по дате операции. Получить данные заканчивая указанной датой. В UTC", "format": "date-time", "nullable": true }, "skip": { "type": "integer", "description": "Количество операций, которое нужно пропустить (для пагинации)\r\nЗначение по умолчанию - 0", "format": "int32", "default": 0, "nullable": true, "example": 0 }, "take": { "type": "integer", "description": "Количество операций, которое нужно получить (для пагинации)\r\nМаксимальное значение 100000\r\nЗначение по умолчанию - 50", "format": "int32", "default": 50, "nullable": true, "example": 50 } }, "additionalProperties": false, "description": "Фильтры истории операций изменения бонусного баланса" }, "GetBonusHistoryRequestDto": { "required": [ "guest", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "filter": { "$ref": "#/components/schemas/BonusHistoryFilterDto" } }, "additionalProperties": false, "description": "Аргументы операции получения истории изменения бонусного баланса" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "BonusOperationType": { "enum": [ "order", "bizUser", "campaign", "api" ], "type": "string" }, "OrganizationShortDto": { "required": [ "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "ИД организации", "format": "uuid" }, "name": { "type": "string", "description": "Наименование организации", "nullable": true, "example": "Пироги да Фрукты" } }, "additionalProperties": false, "description": "Данные о организации" }, "OrderShortDto": { "required": [ "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "ИД заказа", "format": "uuid" }, "number": { "type": "string", "description": "Номера заказа", "nullable": true, "example": "22" } }, "additionalProperties": false, "description": "Данные о заказе" }, "BonusOperationDto": { "required": [ "amount", "date", "operationType" ], "type": "object", "properties": { "amount": { "type": "number", "description": "Велечена изменения бонусного баланса", "format": "double", "example": 999 }, "date": { "type": "string", "description": "Дата выполнения операции (UTC)", "format": "date-time" }, "operationType": { "$ref": "#/components/schemas/BonusOperationType" }, "organization": { "$ref": "#/components/schemas/OrganizationShortDto" }, "order": { "$ref": "#/components/schemas/OrderShortDto" }, "comment": { "type": "string", "description": "Комментарий к операции списания/начисления бонусных баллов", "nullable": true, "example": "В день рождения" } }, "additionalProperties": false, "description": "Данные об операции изменения бонусного баланса" }, "GetBonusHistoryResponseDto": { "required": [ "operations", "totalCount" ], "type": "object", "properties": { "totalCount": { "type": "integer", "description": "Полное количество операций (без учета пагинации)", "format": "int32", "example": 100 }, "operations": { "type": "array", "items": { "$ref": "#/components/schemas/BonusOperationDto" }, "description": "Список заказов" } }, "additionalProperties": false, "description": "Результат операции получения истории изменения бонусного баланса" } } } }

Запрос /loyalty/guests/getBonusHistory получает историю изменения бонусного баланса гостя по его номеру телефона.

Работа запроса для сетевых заведений:

  • Если в запросе указать идентификатор ресторана, который относится к сети, то в ответе будет история заказов для всей сети. 
  • Для получения истории заказов конкретного ресторана сети используйте фильтр.

По умолчанию для пагинации используются параметры, при которых будут получены первые 50 заказов. Сортировка осуществляется по убыванию даты открытия заказа.

{ "openapi": "3.0.1", "paths": {"/b2b/v1/loyalty/guests/generateCode": { "post": { "tags": [ "Получение разового платёжного кода" ],         "summary": "Получить разовый платежный код пользователя для чекина", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GenerateCodeRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GenerateCodeResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "minLength": 1, "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "minLength": 1, "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "GenerateCodeRequestDto": { "required": [ "guest", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "activationPeriod": { "$ref": "#/components/schemas/TimeSpan" } }, "additionalProperties": false, "description": "Аргументы операции получения одноразового платёжного кода гостя" }, "GenerateCodeResponseDto": { "type": "object", "properties": { "code": { "type": "integer", "description": "Первые 7 цифр баркода в стандарте EAN-8 (без контрольной суммы).", "format": "int32", "example": 5024790 }, "ttlSeconds": { "type": "integer", "description": "Оставшееся время действия кода в секундах.", "format": "int32", "example": 300 } }, "additionalProperties": false, "description": "Результат операции получения одноразового платёжного кода гостя" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "minLength": 1, "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "TimeSpan": { "type": "object", "properties": { "ticks": { "type": "integer", "format": "int64", "readOnly": true }, "days": { "type": "integer", "format": "int32", "readOnly": true }, "hours": { "type": "integer", "format": "int32", "readOnly": true }, "milliseconds": { "type": "integer", "format": "int32", "readOnly": true }, "minutes": { "type": "integer", "format": "int32", "readOnly": true }, "seconds": { "type": "integer", "format": "int32", "readOnly": true }, "totalDays": { "type": "number", "format": "double", "readOnly": true }, "totalHours": { "type": "number", "format": "double", "readOnly": true }, "totalMilliseconds": { "type": "number", "format": "double", "readOnly": true }, "totalMinutes": { "type": "number", "format": "double", "readOnly": true }, "totalSeconds": { "type": "number", "format": "double", "readOnly": true } }, "additionalProperties": false } } } }

Запрос /loyalty/guests/generateCode возвращает разовый платёжный код (РПК) для чекина гостя в заказ.

{ "openapi": "3.0.1", "paths": {"/b2b/v1/loyalty/guests/getMarketingCampaigns": { "post": { "tags": [ "Получение акций, доступных гостю" ],         "summary": "Получить доступные гостю акции с их текущим прогрессом", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetGuestMarketingCampaignsRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetGuestMarketingCampaignsResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ActivatableCampaignDescriptorDto": { "required": [ "activated" ], "type": "object", "properties": { "activated": { "type": "boolean", "description": "Признак, что акция была активирована пользователем.", "readOnly": true, "example": true } }, "additionalProperties": false, "description": "Дополнительные данные для активируемой акции." }, "BonusGiftDescriptionDto": { "required": [ "value" ], "type": "object", "properties": { "value": { "type": "integer", "description": "Количество бонусов, которые будут начислены, в базовой ед. валюты.", "format": "int64", "example": 100 } }, "additionalProperties": false, "description": "Описание подарка - начисление бонусов." }, "ErrorDto": { "required": [ "code", "message" ], "type": "object", "properties": { "code": { "minLength": 1, "type": "string", "description": "Код ошибки", "example": "6666" }, "message": { "minLength": 1, "type": "string", "description": "Сообщение о ошибке", "example": "Some error description." } }, "additionalProperties": false, "description": "Ошибка" }, "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "additionalProperties": false, "description": "Результат операции, завершившейся ошибкой" }, "GetGuestMarketingCampaignsRequestDto": { "required": [ "guest", "organization" ], "type": "object", "properties": { "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" } }, "additionalProperties": false, "description": "Аргументы операции получения доступных гостю акций с их текущим прогрессом" }, "GetGuestMarketingCampaignsResponseDto": { "type": "object", "properties": { "marketingCampaigns": { "type": "array", "items": { "$ref": "#/components/schemas/MarketingCampaignDto" }, "description": "Список акций", "nullable": true } }, "additionalProperties": false, "description": "Результат операции получения доступных гостю акций с их текущим прогрессом" }, "GiftDescriptionDto": { "required": [ "giftDescription", "iconImageUrl", "imageUrl", "name", "smallImageUrl", "type" ], "type": "object", "properties": { "name": { "minLength": 1, "type": "string", "description": "Наименование подарка", "example": "Подарок ждет вас!" }, "giftDescription": { "minLength": 1, "type": "string", "description": "Описание подарка", "example": "Соба с креветкой в подарок" }, "imageUrl": { "minLength": 1, "type": "string", "description": "Ссылка на картинку", "example": "https://2585.ru/images_test/...277061f.jpg" }, "smallImageUrl": { "minLength": 1, "type": "string", "description": "Ссылка на уменьшенную картинку", "example": "https://2585.ru/images_test/...5ec198.jpg" }, "iconImageUrl": { "minLength": 1, "type": "string", "description": "Ссылка на иконку подарка", "example": "https://2585.ru/images/assets/.../Simple.png" }, "type": { "$ref": "#/components/schemas/GiftType" }, "bonus": { "$ref": "#/components/schemas/BonusGiftDescriptionDto" } }, "additionalProperties": false, "description": "Описание подарка" }, "GiftDto": { "required": [ "chosenGift", "expirationDate", "settingsId", "status" ], "type": "object", "properties": { "settingsId": { "type": "string", "description": "Id настроек подарка", "format": "uuid", "example": "bed60739-bc07-4369-8768-3c551e483146" }, "campaignId": { "type": "string", "description": "Идентификатор акции, к которой относится подарок.", "format": "uuid", "example": "864a74f7-5f1e-4359-87a5-fce625cee7ad" }, "chosenGift": { "$ref": "#/components/schemas/GiftDescriptionDto" }, "expirationDate": { "type": "string", "description": "Дата \"сгорания\" подарка, после которой он будет недоступен", "format": "date-time", "example": "2023-11-11T14:39:24.223" }, "status": { "$ref": "#/components/schemas/GiftStatus" }, "stampIndex": { "type": "integer", "description": "Порядковый номер штампика, на которой был начислен подарок", "format": "int32", "nullable": true, "example": 3 } }, "additionalProperties": false, "description": "Подарок" }, "GiftStatus": { "enum": [ "precalculated", "active", "expired", "received" ], "type": "string", "description": "Состояние подарка" }, "GiftType": { "enum": [ "simple", "bonus", "abonnement" ], "type": "string", "description": "Тип подарка" }, "GuestIdentityDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/GuestIdentityType" }, "phone": { "type": "string", "description": "Номер телефона", "nullable": true, "example": "+79990001122" } }, "additionalProperties": false, "description": "Идентификатор гостя" }, "GuestIdentityType": { "enum": [ "phone" ], "type": "string", "description": "Тип идентификатора гостя" }, "MarketingCampaignDto": { "required": [ "description", "from", "gifts", "id", "isActive", "name" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор", "format": "uuid", "example": "864a74f7-5f1e-4359-87a5-fce625cee7ad" }, "name": { "minLength": 1, "type": "string", "description": "Название", "example": "Соба с креветкой за штампики" }, "description": { "minLength": 1, "type": "string", "description": "Описание", "example": "Накопите 3 штампика и получите Собу с креветкой в подарок" }, "imageUrl": { "type": "string", "description": "Ссылка на картинку", "nullable": true, "example": "https://2585.ru/images/...cc2e13fe2c9b.jpg" }, "from": { "minLength": 1, "type": "string", "description": "Начало действия, в формате System.Runtime.Serialization.DateTimeFormat", "example": "2023-08-23 00:00:00" }, "to": { "type": "string", "description": "Окончание действия, в формате System.Runtime.Serialization.DateTimeFormat", "nullable": true, "example": "2023-10-18 00:00:00" }, "globalPromocode": { "type": "string", "description": "Общий промокод", "nullable": true, "example": "ВЕСНА24" }, "price": { "type": "integer", "description": "Стоимость акции", "format": "int64", "nullable": true }, "oldPrice": { "type": "integer", "description": "Стоимость акции", "format": "int64", "nullable": true }, "type": { "$ref": "#/components/schemas/MarketingCampaignType" }, "isActive": { "type": "boolean", "description": "“true” - акция действует, “false” - акция не действует.\r\nЭтот признак зависит в том числе от периода действия акции.", "example": true }, "gifts": { "type": "array", "items": { "$ref": "#/components/schemas/GiftDto" }, "description": "Подарки, полученные пользователем в рамках акции за всю историю. Поле не может быть null, если нет подарков, то возвращается пустой массив." }, "stampMarketingCampaign": { "$ref": "#/components/schemas/StampMarketingCampaignDescriptorDto" }, "referralCampaign": { "$ref": "#/components/schemas/ReferralMarketingCampaignDescriptorDto" }, "activatableCampaign": { "$ref": "#/components/schemas/ActivatableCampaignDescriptorDto" }, "canBeSaved": { "type": "boolean", "description": "Может ли пользователь сохранить себе акцию.", "example": false } }, "additionalProperties": false, "description": "Маркетинговая акция" }, "MarketingCampaignType": { "enum": [ "nonBought", "bought", "stamp", "referral" ], "type": "string", "description": "Типы маркетинговых акций" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "minLength": 1, "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "ReferralMarketingCampaignDescriptorDto": { "required": [ "referralGift", "referrerGift" ], "type": "object", "properties": { "referrerGift": { "$ref": "#/components/schemas/GiftDescriptionDto" }, "referralGift": { "$ref": "#/components/schemas/GiftDescriptionDto" }, "referrerStatus": { "$ref": "#/components/schemas/ReferrerStatus" } }, "additionalProperties": false, "description": "Настройки реферальной акции и статус пользователя по ней." }, "ReferrerStatus": { "enum": [ "canNotBeReferrer", "canBeReferrer", "isReferrer" ], "type": "string", "description": "Статус пользователя в качестве мастера (распространителя ссылок) по реферальной маркетинговой акции." }, "StampGiftSettingDto": { "required": [ "giftDescription", "stampsCount" ], "type": "object", "properties": { "stampsCount": { "type": "integer", "description": "Количество штампиков, необходимых для получения подарка", "format": "int32", "example": 3 }, "giftDescription": { "$ref": "#/components/schemas/GiftDescriptionDto" } }, "additionalProperties": false, "description": "Настройка подарка по штампиковой акции" }, "StampMarketingCampaignDescriptorDto": { "required": [ "giftSettings", "stampReceivingConditions", "userProgress" ], "type": "object", "properties": { "giftSettings": { "type": "array", "items": { "$ref": "#/components/schemas/StampGiftSettingDto" }, "description": "Настройки подарков (подарочные штампы)" }, "userProgress": { "$ref": "#/components/schemas/StampMarketingCampaignProgressDto" }, "stampReceivingConditions": { "minLength": 1, "type": "string", "description": "Условия получения штампиков", "example": "1 штампик за каждые 100руб в чеке" } }, "additionalProperties": false, "description": "Описание штампиковой маркетиноговой компании" }, "StampMarketingCampaignProgressDto": { "required": [ "stampCount" ], "type": "object", "properties": { "stampCount": { "type": "integer", "description": "Количество заработанных штампиков", "format": "int32", "example": 2 } }, "additionalProperties": false, "description": "Прогресс пользователя в штампиковой маркетинговой акции" } } } }

Запрос /loyalty/guests/getMarketingCampaigns возвращает список акций, доступных гостю, с текущим прогрессом по ним (например, накопленные штампики).

Возможные ошибки и их решение

Код ошибкиОписаниеВозможные причины
3007Гость не найден

Гость еще не создан

9004Ошибка валидации входных данных

Не все обязательные данные переданы в запросе или данные в запросе содержат ошибку.