Skip to main content

/api/lite/pub/orders

Создание заказа для виджета

/api/lite/pub/orders

(метод требует авторизации по домену)

Создание заказа для корзины и других клиентов по АПИ

Создает новый заказ в системе Кактус.

Цены задавать нельзя, они подставятся в бэкенде из актуальных

Доставка перерасчитается в бэкенде по указанным данным заказа


Пример запроса:

{
  "comment": "",
  "paymentMethodCode": "cod-cash",
  "orderTag": "tag1",
  "totalOrderSum": 5490,
  "delivery": {
    "code": "PICKPOINT",
    "pickupPointId": "2201-001",
    "desiredDeliveryDate": "2020-02-14",
    "desiredDeliveryTimeFrom": "09:00",
    "desiredDeliveryTimeTo": "20:00",
    "deliveryComment": "Поскорее",
    "receiver": {
      "name": "петр",
      "surname": "толстой",
      "patronymic": "",
      "fullName": "",
      "phone": "89011111111",
      "alternativePhone": "",
      "email": "petr@petr.net"
    },
    "address": {
    "region": "Алтайский",
    "area": null,
    "city": "Барнаул",
    "settlement": null,
    "street": "Барнаульская",
    "house": "1",
    "block": "",
    "building": "",
    "flat": "",
    "fullAddress": "",
    "zip": "",
    "regionFias": "8276c6a1-1a86-4f0d-8920-aba34d4cc34a",
    "areaFias": null,
    "cityFias": "d13945a8-7017-46ab-b1e6-ede1e89317ad",
    "settlementFias": null,
    "country": "RU"
    }
  },
  "items": [
    {
      "num": 1,
      "variantId": "1001", 
      "variantExtId": null,     
      "quantity": 1,
      "bundleOptionalVariants": [
        "1012"
      ]
    },
    {
      "num": 2,
      "variantId": "delivery",
      "variantExtId": null
    }
  ],
  "promocode":null,
  "customData":"some data",
  "urlParams":[
  {
    "name":"name1",
    "value":"value1"
  }
 ],
  "deliveryServiceOptions": {
        "PICKPOINT_DELIVERY": "TRYING;PARTIAL_DELIVERY"
   },
  "consentToNewsletter": true
}

В ответ возвращается:

{
    "success": true,
    "orderId": "1285-1002",
    "c": "2b92b631-7f1b-c52a-897e-30bc628f87e5"
}

Ошибка: 

{
"success": false,
"errors": [
 {
 "code": 0,
 "message": "Текст ошибки"
 }
]
}

 

Запрос списка заказов

/api/lite/pub/orders

Метод возвращает запрошенный заказ по его номеру (id) и проверочному коду (с)

Пример запроса: api/lite/pub/orders?id=7277-1002&c=f300ae30-507c-2d36-d37c-e6397084b6e2

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

/api/lite/orders

Примечание: Возвращается неполный список полей по сравнению с GET /api/lite/orders.

 

Пример результата запроса:

{
    "success": true,
    "orders": [
        {
            "id": "7277-1002",
            "date": "2020-01-22 16:37:56",
            "updateTs": "2020-01-22 16:37:57.528",
            "status": "ORDER_INFO_DRAFT",
            "totalOrderSum": 999,
            "paymentStatus": "NOT_PAID",
            "paymentMethodCode": "online",
            "needCustomerPayment": false,
            "comment": "",
            "delivery": {
                "code": "PICKPOINT",
                "type": "PVZ",
                "title": "PickPoint",
                "pickupPointId": "12345",
                "logoUrl": null,
                "trackingNumber": null,
                "trackingURL": null,
                "desiredDeliveryDate": "2020-02-14",
                "desiredDeliveryTimeFrom": "09:00",
                "desiredDeliveryTimeTo": "20:00",
                "deliveryComment": "Поскорее",
                "address": {
                    "country": "Россия",
                    "countryCode": "RU",
                    "region": "Алтайский",
                    "area": null,
                    "city": "Барнаул",
                    "settlement": null,
                    "street": "",
                    "house": "",
                    "block": "",
                    "building": "",
                    "flat": "",
                    "fullAddress": "Алтайский, Барнаул",
                    "fullCity": null,
                    "rawData": null,
                    "zip": "",
                    "regionFias": "8276c6a1-1a86-4f0d-8920-aba34d4cc34a",
                    "areaFias": null,
                    "cityFias": "d13945a8-7017-46ab-b1e6-ede1e89317ad",
                    "settlementFias": null
                },
                "receiver": {
                    "name": "Петр",
                    "surname": "толстой",
                    "patronymic": "",
                    "phone": "89011111111",
                    "alternativePhone": "",
                    "email": "petr@petr.net",
                    "post": null,
                    "personType": null
                }
            },
            "items": [
                {
                    "num": 1,
                    "productId": "1001",
                    "productExtId": null,
                    "variantId": "1001",
                    "variantExtId": null,                   
                    "name": "Кактус Цереус",
                    "quantity": 1,
                    "price": 999,
                    "img": "https://img.kak2c.ru/i/j/j/tYqAVdh1_c.jpg?1579689505",
                    "skuType": "SKU"
                },
                {
                    "num": 2,
                    "productId": null,
                    "variantId": "delivery",
                    "name": "Доставка",
                    "quantity": 1,
                    "price": 0,
                    "skuType": "SERVICE"
                }
            ],
            "customerPaymentInProcess": false,
          	"shopUrl": "https://shop6750043.kak2c.ru",
            "c": "f300ae30-507c-2d36-d37c-e6397084b6e2"
        }
    ]
}

Ошибка:

{
"success": false,
"errors": [
 {
 "code": 0,
 "message": "Текст ошибки"
 }
]
}

 

Расчет скидки по заказу

/api/lite/pub/orders/discount

Запрос расчета скидки по заказу, по указанному промокоду. Структура запроса такая же как в создании заказа.

Пример запроса:

{
  "comment": "",
  "paymentMethodCode": "online",
  "totalOrderSum": 5490,
  "delivery": {
    "сode": "PICKPOINT",
    "pickupPointId": "12345",
    "desiredDeliveryDate": "22.02.2020",
    "desiredDeliveryTimeFrom": "09:00",
    "desiredDeliveryTimeTo": "20:00",
    "deliveryComment": "Поскорее",
    "receiver": {
      "name": "петр",
      "surname": "толстой",
      "patronymic": "",
      "fullName": "",
      "phone": "23232323",
      "alternativePhone": "",
      "email": "petr@petr.net"
    },
    "address": {
    "region": "Алтайский",
    "area": null,
    "city": "Барнаул",
    "settlement": null,
    "street": "",
    "house": "",
    "block": "",
    "building": "",
    "flat": "",
    "fullAddress": "",
    "zip": "",
    "regionFias": "8276c6a1-1a86-4f0d-8920-aba34d4cc34a",
    "areaFias": null,
    "cityFias": "d13945a8-7017-46ab-b1e6-ede1e89317ad",
    "settlementFias": null,
    "country": "RU"
    }
  },
  "items": [
    {
      "num": 1,
      "variantId": "1001",
      "productId":"1001",
      "quantity": 1
    },
    {
      "num": 2,
      "variantId": "delivery",
      "productId":"delivery"
    }
  ],
  "promocode":"PROMO",
  "customData":"some data",
  "urlParams":[
  {
    "name":"name1",
    "value":"value1"
  }
 ],
  "deliveryServiceOptions": {
        "PICKPOINT_DELIVERY": "TRYING;PARTIAL_DELIVERY"
   }
}

В ответ возвращается:

{
    "success": true,
    "discounts": [
        {
            "discountValue": 123.45,
            "deliveryDiscountValue": 123.45,
            "discountType": "PROMOCODE"  // PAYMENT_TYPE
        }
    ]
   
}

Ошибка: 

{
"success": false,
"errors": [
 {
 "code": 0,
 "message": "Текст ошибки"
 }
]
}

 

Проверка промокодов

/api/lite/pub/promocode/conditions/check

Для валидации условий промокода, необходимо передать весь заказ целиком, с заполненным промокодом (аналогично /api/lite/pub/orders)

Пример запроса:

{
  "comment": "",
  "paymentMethodCode": "online",
  "totalOrderSum": 5490,
  "delivery": {
    "сode": "PICKPOINT",
    "pickupPointId": "12345",
    "desiredDeliveryDate": "22.02.2020",
    "desiredDeliveryTimeFrom": "09:00",
    "desiredDeliveryTimeTo": "20:00",
    "deliveryComment": "Поскорее",
    "receiver": {
      "name": "петр",
      "surname": "толстой",
      "patronymic": "",
      "fullName": "",
      "phone": "23232323",
      "alternativePhone": "",
      "email": "petr@petr.net"
    },
    "address": {
    "region": "Алтайский",
    "area": null,
    "city": "Барнаул",
    "settlement": null,
    "street": "",
    "house": "",
    "block": "",
    "building": "",
    "flat": "",
    "fullAddress": "",
    "zip": "",
    "regionFias": "8276c6a1-1a86-4f0d-8920-aba34d4cc34a",
    "areaFias": null,
    "cityFias": "d13945a8-7017-46ab-b1e6-ede1e89317ad",
    "settlementFias": null,
    "country": "RU"
    }
  },
  "items": [
    {
      "num": 1,
      "variantId": "1001",
      "productId":"1001",
      "quantity": 1
    },
    {
      "num": 2,
      "variantId": "delivery",
      "productId":"delivery"
    }
  ],
  "promocode":"TEST",
  "customData":"some data",
  "urlParams":[
  {
    "name":"name1",
    "value":"value1"
  }
 ],
  "deliveryServiceOptions": {
        "PICKPOINT_DELIVERY": "TRYING;PARTIAL_DELIVERY"
   }
}

Результат запроса: 

{
   "success":true,
   "code":"code",
   "isActive":true,
   "discountType":"FIX",
   "discountValue":836,
   "hasConditions":true,
   "deliveryDiscountValue":50, //Скидка на доставку в %
   "bonusSkus":[
    {

      "productId":"123",

      "variantId":"456",

      "quantity": 2
    }  
   ]
}

Ошибка:

{
  "success": false,
  "errors": [
    {
      "code": 0,
      "message": "текст ошибки"
    }
  ]
}