Введение

В этой статье будет рассмотрена следующая ситуация: в заведении действует анонимная акция на чек от 100 рублей.

Для применения анонимной лояльности:

  1. Подсчитайте лояльность для заказа
  2. Подтвердите применение скидки  
  3. Завершите заказ.

Запросы

Так как заведению не важна информация о госте, ее можно не получать.

После создания заказа отправьте запрос для подсчета лояльности с параметром guest: null:

{ "openapi": "3.0.1", "paths": {"/b2b/v1/loyalty/orders/calculate": { "post": { "tags": [ "Подсчет лояльности для заказа" ], "summary": "Посчитать лояльность для заказа", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CalculateOrderRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CalculateOrderResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "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": "Ошибка" }, "ProductDto": { "required": [ "code", "name" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)", "example": "12345" }, "name": { "type": "string", "description": "Название товара", "example": "Пирог с малиной" }, "group": { "type": "string", "description": "Группа товара", "nullable": true, "example": "Мучное" }, "categories": { "type": "array", "items": { "type": "string" }, "description": "Категории товара", "nullable": true } }, "additionalProperties": false, "description": "Данные о товаре" }, "OrderItemModifierDto": { "required": [ "cost", "discount", "modifier", "price", "quantity" ], "type": "object", "properties": { "modifier": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость модификатора по прайсу", "format": "double", "example": 50 }, "cost": { "type": "number", "description": "Полная стоимость модификатора с учетом внеших скидок и наценок", "format": "double", "example": 30 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки", "format": "double", "example": 20 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц модификатора", "format": "double", "example": 4 } }, "additionalProperties": false, "description": "Данные о модификаторе" }, "OrderItemDto": { "required": [ "cost", "price", "product", "quantity" ], "type": "object", "properties": { "product": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость позиции по прайсу", "format": "double", "example": 170 }, "cost": { "type": "number", "description": "Полная стоимость позиции с учетом внеших скидок и наценок", "format": "double", "example": 140 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки (справочная информация, необходимая для отчетов)", "format": "double", "example": 30 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки (справочная информация, необходимая для отчетов)", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц товара в позиции", "format": "double", "example": 4 }, "modifiers": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItemModifierDto" }, "description": "Модификаторы позиции", "nullable": true } }, "additionalProperties": false, "description": "Данные о позиции заказа" }, "OrderDto": { "required": [ "items", "openedAt" ], "type": "object", "properties": { "openedAt": { "type": "string", "description": "Дата/время открытия заказа", "format": "date-time" }, "items": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItemDto" }, "description": "Позиции заказа" } }, "additionalProperties": false, "description": "Данные о заказе" }, "ExpeditionTypeDto": { "enum": [ "delivery", "pickup" ], "type": "string", "description": "Способ получения заказа" }, "ExpeditionDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/ExpeditionTypeDto" } }, "additionalProperties": false, "description": "Данные о способе получения заказа" }, "DeliveryDto": { "required": [ "expedition" ], "type": "object", "properties": { "expedition": { "$ref": "#/components/schemas/ExpeditionDto" } }, "additionalProperties": false, "description": "Данные о доставке заказа" }, "PromocodeDto": { "required": [ "value" ], "type": "object", "properties": { "value": { "type": "string", "description": "Промокод" } }, "additionalProperties": false, "description": "Данные по промокоду" }, "BonusesProgramResultDto": { "required": [ "max", "min", "notifications", "progress" ], "type": "object", "properties": { "progress": { "$ref": "#/components/schemas/BonusesProgramProgressDto" }, "min": { "$ref": "#/components/schemas/BonusesDto" }, "max": { "$ref": "#/components/schemas/BonusesDto" }, "notifications": { "type": "array", "items": { "$ref": "#/components/schemas/NotificationDto" }, "description": "Уведомления о деталях срабатывания бонусной программы" } }, "additionalProperties": false, "description": "Расчет бонусной программы для заказа" }, "LoyaltyResultDetailsDto": { "required": [ "programs" ], "type": "object", "properties": { "programs": { "type": "array", "items": { "$ref": "#/components/schemas/CampaignResultDto" }, "description": "Акции" }, "bonuses": { "$ref": "#/components/schemas/BonusesProgramResultDto" } }, "additionalProperties": false, "description": "Детали расчета лояльности для заказа" }, "LoyaltyResultDto": { "required": [ "details", "fingerprint", "summary" ], "type": "object", "properties": { "fingerprint": { "type": "string", "description": "Отпечаток (хранит метаинформацию о расчете для подтверждения заказа)", "example": "UGVyc29uYWxpemVk" }, "summary": { "$ref": "#/components/schemas/LoyaltyResultSummaryDto" }, "details": { "$ref": "#/components/schemas/LoyaltyResultDetailsDto" } }, "additionalProperties": false, "description": "Расчет лояльности для заказа" }, "CalculateOrderResponseDto": { "required": [ "loyalty" ], "type": "object", "properties": { "loyalty": { "$ref": "#/components/schemas/LoyaltyResultDto" } }, "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": "Идентификатор заведения" }, "DiscountsByCodeDto": { "required": [ "code", "total" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)" }, "total": { "type": "number", "description": "Общая сумма скидки для товара", "format": "double" } }, "additionalProperties": false, "description": "Общая сумма скидки в разрезе товара" }, "DiscountsDto": { "required": [ "total", "totalByCode" ], "type": "object", "properties": { "total": { "type": "number", "description": "Общая сумма скидки в валюте заказа (например, в рублях)", "format": "double", "example": 112 }, "totalByCode": { "type": "array", "items": { "$ref": "#/components/schemas/DiscountsByCodeDto" }, "description": "Общая сумма скидки в разрезе товара в валюте заказа (например, в рублях)" } }, "additionalProperties": false, "description": "Скидки для заказа" }, "LoyaltyResultSummaryDto": { "required": [ "discounts" ], "type": "object", "properties": { "discounts": { "$ref": "#/components/schemas/DiscountsDto" }, "bonuses": { "$ref": "#/components/schemas/BonusesResultSummaryDto" } }, "additionalProperties": false, "description": "Сводка расчета лояльности для заказа" }, "NotificationDto": { "required": [ "primary", "secondary" ], "type": "object", "properties": { "primary": { "type": "string", "description": "Главное уведомление", "example": "Вы получили 50.00 бонусных баллов по акции \"Промобонусы в подарок за первый заказ\"." }, "secondary": { "type": "string", "description": "Дополнительное уведомление", "example": "Вы сможете воспользоваться специальным предложением по акции \"Промобонусы в подарок за первый заказ\" еще 3 раза." } }, "additionalProperties": false, "description": "Уведомление о деталях срабатывания акции" }, "BonusesDto": { "type": "object", "properties": { "payment": { "type": "number", "description": "(OBSOLETE!!!) Сумма оплаты в бонусных баллах", "format": "double", "example": 33, "deprecated": true }, "accrual": { "type": "number", "description": "(OBSOLETE!!!) Сумма начисления в бонусных баллах", "format": "double", "example": 17, "deprecated": true }, "payments": { "$ref": "#/components/schemas/BonusesPaymentsDto" }, "accruals": { "$ref": "#/components/schemas/BonusesAccrualsDto" } }, "additionalProperties": false, "description": "Оплата/начисление бонусных баллов" }, "BonusesPaymentsByCodeDto": { "required": [ "code", "total" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)" }, "total": { "type": "number", "description": "Общая сумма оплаты бонусными баллами товара", "format": "double" } }, "additionalProperties": false, "description": "Общая сумма оплаты бонусными баллами в разрезе товара" }, "BonusesPaymentsDto": { "required": [ "total", "totalByCode" ], "type": "object", "properties": { "total": { "type": "number", "description": "Общая сумма оплаты бонусными баллами", "format": "double", "example": 33 }, "totalByCode": { "type": "array", "items": { "$ref": "#/components/schemas/BonusesPaymentsByCodeDto" }, "description": "Общая сумма оплаты бонусными баллами в разрезе товара" } }, "additionalProperties": false, "description": "Оплата бонусными баллами для заказа" }, "BonusesAccrualsDto": { "required": [ "total" ], "type": "object", "properties": { "total": { "type": "number", "description": "Сумма начисления в бонусных баллах", "format": "double", "example": 17 } }, "additionalProperties": false, "description": "Начисление бонусных баллов для заказа" }, "BonusesResultSummaryDto": { "required": [ "max", "min" ], "type": "object", "properties": { "min": { "$ref": "#/components/schemas/BonusesDto" }, "max": { "$ref": "#/components/schemas/BonusesDto" } }, "additionalProperties": false, "description": "Сводка оплаты/начисления бонусных баллов для заказа" }, "RankProgressDto": { "required": [ "cashbackPercentage", "index", "name" ], "type": "object", "properties": { "name": { "type": "string", "description": "Название ранга" }, "index": { "type": "integer", "description": "Индекс текущего ранга (в списке рангов, отсчет с 0)", "format": "int32" }, "cashbackPercentage": { "type": "number", "description": "Процент бонусов\r\n<example>12.5</example>", "format": "double" }, "confirmation": { "$ref": "#/components/schemas/RankConfirmationDto" } }, "additionalProperties": false, "description": "Описывает специфичную информацию о текущем бонусном ранге пользователя" }, "RankConfirmationDto": { "required": [ "hoursLeft", "sumLeft" ], "type": "object", "properties": { "sumLeft": { "type": "number", "description": "Сумма которую необходимо потратить для подтверждения ранга", "format": "double" }, "hoursLeft": { "type": "integer", "description": "Количество часов за которые необходимо потратить сумму подтверждения", "format": "int32" } }, "additionalProperties": false, "description": "Описание требования подтверждения ранга" }, "BonusesProgramProgressDto": { "required": [ "balance", "rank" ], "type": "object", "properties": { "balance": { "type": "number", "description": "Количество бонусов в кошельке", "format": "double" }, "rank": { "$ref": "#/components/schemas/RankProgressDto" } }, "additionalProperties": false, "description": "Прогресс гостя в рамках болнусной программы" }, "CampaignResultDto": { "required": [ "notifications", "program" ], "type": "object", "properties": { "program": { "$ref": "#/components/schemas/CampaignDto" }, "discounts": { "$ref": "#/components/schemas/DiscountsDto" }, "notifications": { "type": "array", "items": { "$ref": "#/components/schemas/NotificationDto" }, "description": "Уведомления о деталях срабатывания акции" } }, "additionalProperties": false, "description": "Расчет акции для заказа" }, "CampaignDto": { "required": [ "id", "name" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор акции", "format": "uuid", "example": "1de9a2d7-2ce7-4845-960b-988df56872ce" }, "name": { "type": "string", "description": "Название акции", "example": "Промобонусы в подарок за первый заказ" } }, "additionalProperties": false, "description": "Данные о акции" }, "CalculateOrderRequestDto": { "required": [ "order", "organization" ], "type": "object", "properties": { "order": { "$ref": "#/components/schemas/OrderDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "delivery": { "$ref": "#/components/schemas/DeliveryDto" }, "promocodes": { "type": "array", "items": { "$ref": "#/components/schemas/PromocodeDto" }, "description": "Промокоды для применения к заказу", "nullable": true } }, "additionalProperties": false, "description": "Аргументы операции предрасчета лояльности для заказа" } } } }

В ответе вернется информация о скидке в размере 20% от суммы чека. Теперь эту скидку необходимо зафиксировать. Подтвердите заказ с использованием скидки, используя запрос:

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/orders/confirm": { "post": { "tags": [ "Подтвердить заказ" ], "summary": "Подтвердить заказ", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConfirmOrderRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ConfirmOrderResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "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": "Ошибка" }, "LoyaltyConfirmationPatternDto": { "enum": [ "fingerprint" ], "type": "string", "description": "Тип подтверждения лояльности" }, "ConfirmOrderRequestDto": { "required": [ "id", "order", "organization" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" }, "order": { "$ref": "#/components/schemas/OrderDto" }, "organization": { "$ref": "#/components/schemas/OrganizationIdentityDto" }, "guest": { "$ref": "#/components/schemas/GuestIdentityDto" }, "delivery": { "$ref": "#/components/schemas/DeliveryDto" }, "loyalty": { "$ref": "#/components/schemas/LoyaltyConfirmationDto" } }, "additionalProperties": false, "description": "Аргументы операции подтверждения заказа" }, "LoyaltyConfirmationPatternDto": { "enum": [ "fingerprint" ], "type": "string", "description": "Тип подтверждения лояльности" }, "FingerprintConfirmationBonusesOptionDto": { "required": [ "payment" ], "type": "object", "properties": { "payment": { "type": "number", "description": "Сумма оплаты в бонусых баллах", "format": "double", "example": 37 } }, "additionalProperties": false, "description": "Подтверждение оплаты бонусами для заказа" }, "FingerprintConfirmationOptionsDto": { "type": "object", "properties": { "hold": { "type": "boolean", "description": "(Obsolete!!!) Выполнять ли холдирование? Поле необходимо для обратной совместимости" }, "bonuses": { "$ref": "#/components/schemas/FingerprintConfirmationBonusesOptionDto" } }, "additionalProperties": false, "description": "Конфигурация подтверждения по отпечатку рассчета лояльности" }, "FingerprintConfirmationDto": { "required": [ "value" ], "type": "object", "properties": { "value": { "type": "string", "description": "Отпечаток расчета", "example": "UGVyc29uYWxpemVk" }, "options": { "$ref": "#/components/schemas/FingerprintConfirmationOptionsDto" } }, "additionalProperties": false, "description": "Подтверждение по отпечатку расчета лояльности" }, "LoyaltyConfirmationDto": { "required": [ "pattern" ], "type": "object", "properties": { "pattern": { "$ref": "#/components/schemas/LoyaltyConfirmationPatternDto" }, "fingerprint": { "$ref": "#/components/schemas/FingerprintConfirmationDto" } }, "additionalProperties": false, "description": "Подтверждение лояльности для заказа" }, "ExpeditionTypeDto": { "enum": [ "delivery", "pickup" ], "type": "string", "description": "Способ получения заказа" }, "ExpeditionDto": { "required": [ "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/ExpeditionTypeDto" } }, "additionalProperties": false, "description": "Данные о способе получения заказа" }, "DeliveryDto": { "required": [ "expedition" ], "type": "object", "properties": { "expedition": { "$ref": "#/components/schemas/ExpeditionDto" } }, "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": "Идентификатор гостя" }, "OrganizationIdentityDto": { "required": [ "id", "type" ], "type": "object", "properties": { "type": { "$ref": "#/components/schemas/OrganizationIdentityType" }, "id": { "type": "string", "description": "Идентификатор", "example": "4174244" } }, "additionalProperties": false, "description": "Идентификатор заведения" }, "OrganizationIdentityType": { "enum": [ "rkObjectId" ], "type": "string", "description": "Тип идентификатора заведения" }, "OrderDto": { "required": [ "items", "openedAt" ], "type": "object", "properties": { "openedAt": { "type": "string", "description": "Дата/время открытия заказа", "format": "date-time" }, "items": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItemDto" }, "description": "Позиции заказа" } }, "additionalProperties": false, "description": "Данные о заказе" }, "OrderItemDto": { "required": [ "cost", "price", "product", "quantity" ], "type": "object", "properties": { "product": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость позиции по прайсу", "format": "double", "example": 170 }, "cost": { "type": "number", "description": "Полная стоимость позиции с учетом внеших скидок и наценок", "format": "double", "example": 140 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки (справочная информация, необходимая для отчетов)", "format": "double", "example": 30 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки (справочная информация, необходимая для отчетов)", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц товара в позиции", "format": "double", "example": 4 }, "modifiers": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItemModifierDto" }, "description": "Модификаторы позиции", "nullable": true } }, "additionalProperties": false, "description": "Данные о позиции заказа" }, "OrderItemModifierDto": { "required": [ "cost", "discount", "modifier", "price", "quantity" ], "type": "object", "properties": { "modifier": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость модификатора по прайсу", "format": "double", "example": 50 }, "cost": { "type": "number", "description": "Полная стоимость модификатора с учетом внеших скидок и наценок", "format": "double", "example": 30 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки", "format": "double", "example": 20 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц модификатора", "format": "double", "example": 4 } }, "additionalProperties": false, "description": "Данные о модификаторе" }, "OrderItemDto": { "required": [ "cost", "price", "product", "quantity" ], "type": "object", "properties": { "product": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость позиции по прайсу", "format": "double", "example": 170 }, "cost": { "type": "number", "description": "Полная стоимость позиции с учетом внеших скидок и наценок", "format": "double", "example": 140 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки (справочная информация, необходимая для отчетов)", "format": "double", "example": 30 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки (справочная информация, необходимая для отчетов)", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц товара в позиции", "format": "double", "example": 4 }, "modifiers": { "type": "array", "items": { "$ref": "#/components/schemas/OrderItemModifierDto" }, "description": "Модификаторы позиции", "nullable": true } }, "additionalProperties": false, "description": "Данные о позиции заказа" }, "OrderItemModifierDto": { "required": [ "cost", "discount", "modifier", "price", "quantity" ], "type": "object", "properties": { "modifier": { "$ref": "#/components/schemas/ProductDto" }, "price": { "type": "number", "description": "Полная стоимость модификатора по прайсу", "format": "double", "example": 50 }, "cost": { "type": "number", "description": "Полная стоимость модификатора с учетом внеших скидок и наценок", "format": "double", "example": 30 }, "discount": { "type": "number", "description": "Общая сумма внешней скидки", "format": "double", "example": 20 }, "extraCharge": { "type": "number", "description": "Общая сумма наценки", "format": "double", "example": 0 }, "quantity": { "type": "number", "description": "Количество единиц модификатора", "format": "double", "example": 4 } }, "additionalProperties": false, "description": "Данные о модификаторе" }, "ProductDto": { "required": [ "code", "name" ], "type": "object", "properties": { "code": { "type": "string", "description": "Код товара (артикул)", "example": "12345" }, "name": { "type": "string", "description": "Название товара", "example": "Пирог с малиной" }, "group": { "type": "string", "description": "Группа товара", "nullable": true, "example": "Мучное" }, "categories": { "type": "array", "items": { "type": "string" }, "description": "Категории товара", "nullable": true } }, "additionalProperties": false, "description": "Данные о товаре" }, "ConfirmOrderResponseDto": { "required": [ "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" } }, "additionalProperties": false, "description": "Результат операции подтверждения заказа" } } } }

Осталось закрыть заказ с примененной скидкой. Для этого используйте запрос:

{ "openapi": "3.0.1", "paths": { "/b2b/v1/loyalty/orders/close": { "post": { "tags": [ "Закрыть заказ" ], "summary": "Закрыть заказ.", "requestBody": { "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CloseOrderRequestDto" } } } }, "responses": { "200": { "description": "Результат успешной операции", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CloseOrderResponseDto" } } } }, "400": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } }, "500": { "description": "Ответ с информацией об ошибке", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponseDto" } } } } } } } }, "components": { "schemas": { "ErrorResponseDto": { "required": [ "error" ], "type": "object", "properties": { "error": { "$ref": "#/components/schemas/ErrorDto" } }, "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": "Ошибка" }, "CloseOrderRequestDto": { "required": [ "closedAt", "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" }, "closedAt": { "type": "string", "description": "Дата/время закрытия заказа", "format": "date-time" } }, "additionalProperties": false, "description": "Аргументы операции закрытия заказа" }, "CloseOrderResponseDto": { "required": [ "id" ], "type": "object", "properties": { "id": { "type": "string", "description": "Идентификатор заказа", "format": "uuid", "example": "46b7c469-d99c-4499-acc7-8ca26ea2117d" } }, "additionalProperties": false, "description": "Результат операции закрытия заказа" } } } }

Готово, заказ закрыт на сумму со скидкой — 80 рублей.