Сделать ставку

Порядок работы для агента · Методы API и схема OpenAPI.

Назначение

Передайте data.demandId, data.executorId и цену с валютой в data.price. Метод может сразу принять заказ, например при достижении цены выкупа, в режиме «кто первый» или при прямом назначении. Если такой исход возможен или условия торгов неизвестны, до вызова получите подтверждение готовности принять заказ за эту цену. Укажите исходную цену base, валюту currency и признак data.price.isVatPayer. Для плательщика заполните в цене vatAmount (сумма НДС) и subTotalPrice (итоговая цена с учётом НДС). Сохраните data.id и перечитайте заказ, чтобы отличить ставку от принятия заказа.

Блоки запроса и ответов ниже сгенерированы из OpenAPI. Подстановки вроде example показывают структуру JSON. Для вызова возьмите значения из сценария, справочников или предыдущих ответов API.

Request

POST

https://partner-test-yamagistrali.ru/api/bet/create/v1

Тестовый стенд

Body

application/json
{
  "data": {
    "betMultimodal": {
      "isPriceByArc": true,
      "route": [
        {}
      ]
    },
    "comment": "example",
    "condition": "example",
    "demandId": "example",
    "executorId": "example",
    "extId": "example",
    "notVatPayer": true,
    "price": {
      "base": "100.18",
      "currency": "RUB",
      "isVatPayer": false,
      "subTotalPrice": "122.21",
      "vat": "22",
      "vatAmount": "22.03"
    },
    "tariffMatrix": {
      "tariffMatrixId": "example"
    },
    "useMultimodal": true,
    "useTariffMatrix": true
  }
}

Name

Description

data

Type: BetCreateV1Request

Example
{
  "betMultimodal": {
    "isPriceByArc": true,
    "route": [
      {
        "addressFrom": "example",
        "addressTo": "example",
        "comment": "example",
        "price": {}
      }
    ]
  },
  "comment": "example",
  "condition": "example",
  "demandId": "example",
  "executorId": "example",
  "extId": "example",
  "notVatPayer": true,
  "price": null,
  "tariffMatrix": {
    "tariffMatrixId": "example"
  },
  "useMultimodal": true,
  "useTariffMatrix": true
}

TaxablePriceIO

Name

Description

base

Type: string | null

Цена исходная

Pattern: ^[1-9][0-9]*(\.[0-9]*[1-9])?$

Example: 100.18

currency

Type: string

ISO 4217 код валюты

Example: RUB

isVatPayer

Type: boolean

Признак плательщика НДС. Для плательщика укажите ставку vat или сумму vatAmount.

Default: false

subTotalPrice

Type: string | null

Итоговая цена с учётом НДС

Pattern: ^[1-9][0-9]*(\.[0-9]*[1-9])?$

Example: 122.21

vat

Type: string | null

Ставка НДС (в % от 0 до 100)

Pattern: ^[1-9][0-9]*(\.[0-9]*[1-9])?$

Example: 22

vatAmount

Type: string | null

Сумма НДС (ВАЖНО может быть без указания ставки НДС!!!)

Pattern: ^[1-9][0-9]*(\.[0-9]*[1-9])?$

Example: 22.03

Example
{
  "base": "100.18",
  "currency": "RUB",
  "isVatPayer": false,
  "subTotalPrice": "122.21",
  "vat": "22",
  "vatAmount": "22.03"
}

BetCreateV1BetMultimodalRoteArc

Name

Description

addressFrom

Type: string

Example: example

addressTo

Type: string

Example: example

comment

Type: string

Example: example

price

Type: TaxablePriceIO

Example
{
  "base": "100.18",
  "currency": "RUB",
  "isVatPayer": false,
  "subTotalPrice": "122.21",
  "vat": "22",
  "vatAmount": "22.03"
}
Example
{
  "addressFrom": "example",
  "addressTo": "example",
  "comment": "example",
  "price": {
    "base": "100.18",
    "currency": "RUB",
    "isVatPayer": false,
    "subTotalPrice": "122.21",
    "vat": "22",
    "vatAmount": "22.03"
  }
}

BetCreateV1BetMultimodal

Name

Description

isPriceByArc

Type: boolean

route

Type: BetCreateV1BetMultimodalRoteArc[] | null

Example
[
  {
    "addressFrom": "example",
    "addressTo": "example",
    "comment": "example",
    "price": {
      "base": "100.18",
      "currency": "RUB",
      "isVatPayer": false,
      "subTotalPrice": "122.21",
      "vat": "22",
      "vatAmount": "22.03"
    }
  }
]
Example
{
  "isPriceByArc": true,
  "route": [
    {
      "addressFrom": "example",
      "addressTo": "example",
      "comment": "example",
      "price": {
        "base": "100.18",
        "currency": "RUB",
        "isVatPayer": false,
        "subTotalPrice": "122.21",
        "vat": "22",
        "vatAmount": "22.03"
      }
    }
  ]
}

BetCreateV1TariffMatrix

Name

Description

tariffMatrixId

Type: string

Example: example

Example
{
  "tariffMatrixId": "example"
}

BetCreateV1Request

Name

Description

comment

Type: string

Example: example

condition

Type: string

Example: example

demandId

Type: string

Example: example

executorId

Type: string

Example: example

extId

Type: string

Example: example

notVatPayer

Type: boolean

price

Type: TaxablePriceIO

Example
{
  "base": "100.18",
  "currency": "RUB",
  "isVatPayer": false,
  "subTotalPrice": "122.21",
  "vat": "22",
  "vatAmount": "22.03"
}

useMultimodal

Type: boolean

useTariffMatrix

Type: boolean

betMultimodal

Any of 2 types
  • Type: BetCreateV1BetMultimodal

    Example
    {
      "isPriceByArc": true,
      "route": [
        {
          "addressFrom": "example",
          "addressTo": "example",
          "comment": "example",
          "price": {
            "base": "100.18",
            "currency": "RUB",
            "isVatPayer": false,
            "subTotalPrice": "122.21",
            "vat": "22",
            "vatAmount": "22.03"
          }
        }
      ]
    }
    
  • Type: object | null

    Const: null

    Example
    {}
    
Example
{
  "isPriceByArc": true,
  "route": [
    {
      "addressFrom": "example",
      "addressTo": "example",
      "comment": "example",
      "price": {
        "base": "100.18",
        "currency": "RUB",
        "isVatPayer": false,
        "subTotalPrice": "122.21",
        "vat": "22",
        "vatAmount": "22.03"
      }
    }
  ]
}

tariffMatrix

Any of 2 types
Example
{
  "tariffMatrixId": "example"
}
Example
{
  "betMultimodal": {
    "isPriceByArc": true,
    "route": [
      {
        "addressFrom": "example",
        "addressTo": "example",
        "comment": "example",
        "price": {}
      }
    ]
  },
  "comment": "example",
  "condition": "example",
  "demandId": "example",
  "executorId": "example",
  "extId": "example",
  "notVatPayer": true,
  "price": null,
  "tariffMatrix": {
    "tariffMatrixId": "example"
  },
  "useMultimodal": true,
  "useTariffMatrix": true
}

Responses

200 OK

OK

Body

application/json
{
  "data": {
    "id": "example"
  }
}

Name

Description

data

Type: BetCreateV1Response

Example
{
  "id": "example"
}

BetCreateV1Response

Name

Description

id

Type: string

Example: example

Example
{
  "id": "example"
}

400 Bad Request

Bad Request

Body

application/json
{
  "error": {
    "info": {},
    "message": "example",
    "message_code": "example"
  }
}

Name

Description

error

Type: Error

Example
{
  "info": {},
  "message": "example",
  "message_code": "example"
}

Error

Name

Description

info

Type: object

Example
{}

message

Type: string

Example: example

message_code

Type: string

Example: example

Example
{
  "info": {},
  "message": "example",
  "message_code": "example"
}

403 Forbidden

Forbidden

Body

application/json
{
  "error": {
    "info": {},
    "message": "example",
    "message_code": "example"
  }
}

Name

Description

error

Type: Error

Example
{
  "info": {},
  "message": "example",
  "message_code": "example"
}

500 Internal Server Error

Internal Server Error

Body

application/json
{
  "error": {
    "info": {},
    "message": "example",
    "message_code": "example"
  }
}

Name

Description

error

Type: Error

Example
{
  "info": {},
  "message": "example",
  "message_code": "example"
}