Введение

Для создания анонимного заказа без применения скидки:

  1. Подтвердите заказ без применения скидки
  2. Закройте заказ.

Запросы

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

  • guest: null
  • loyalty: null
{ "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": "Результат операции закрытия заказа" } } } }

Готово, заказ закрыт на полную стоимость. Лояльность не была применена.