openapi: 3.0.4
info:
  title: Customers Integration API
  description: API для интеграции  клиентов
  version: doublegis
paths:
  /openapi/customers/2gis/Calc:
    post:
      tags:
        - Calc
      summary: Расчёт доставки для 2GIS
      description: Выполняет расчёт доставки. Работает с данными в формате 2GIS
      requestBody:
        description: Параметры для поиска вариантов доставки
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DoubleGisCalcRequest'
      responses:
        '200':
          description: Возможные варианты доставки
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DoubleGisCalcResponse'
        '400':
          description: Информация об ошибке
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorContainer'
components:
  schemas:
    ApiError:
      required:
        - code
        - message
      type: object
      properties:
        code:
          minLength: 1
          type: string
          description: Код ошибки <a href="/docs/specification/errors/">Справочник</a>
        message:
          minLength: 1
          type: string
          description: >-
            Текстовое сообщение с объяснением какая ошибка произошла и как её
            исправить
        target:
          type: string
          description: Путь к полю в запросе, из-за которого возникла ошибка
          nullable: true
      additionalProperties: false
    ApiErrorContainer:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ApiError'
          description: Перечень ошибок, которые возникли во время выполнения запроса
          nullable: true
      additionalProperties: false
    DoubleGisCalcRequest:
      required:
        - point1
        - point2
      type: object
      properties:
        point1:
          $ref: '#/components/schemas/GisRoutePoint'
        point2:
          $ref: '#/components/schemas/GisRoutePoint'
        locale:
          type: string
          description: Локализация - пока только ru
          nullable: true
          example: ru
      additionalProperties: false
    DoubleGisCalcResponse:
      type: object
      properties:
        claims_offers:
          type: array
          items:
            $ref: '#/components/schemas/DoubleGisClaimsOffer'
          description: Варианты доставки
          nullable: true
      additionalProperties: false
    DoubleGisClaimsOffer:
      type: object
      properties:
        tariff_info:
          $ref: '#/components/schemas/DoubleGisTariffInfo'
        price:
          $ref: '#/components/schemas/DoubleGisPriceInfo'
        visiting_intervals:
          type: array
          items:
            $ref: '#/components/schemas/DoubleGisVisitingInterval'
          description: Сведения о дате забора и сроках доставки
          nullable: true
      additionalProperties: false
    DoubleGisPriceInfo:
      type: object
      properties:
        total_price:
          type: string
          description: Общая стоимость
          nullable: true
        total_price_with_vat:
          type: string
          description: Общая стоимость доставки с НДС
          nullable: true
        currency:
          type: string
          description: Валюта
          nullable: true
      additionalProperties: false
    DoubleGisTariffExtraInfo:
      type: object
      properties:
        description:
          type: string
          description: Описание тарифа
          nullable: true
      additionalProperties: false
      description: Дополнительная информация по тарифу
    DoubleGisTariffInfo:
      type: object
      properties:
        title:
          type: string
          description: Название тарифа для отображения пользователю
          nullable: true
        tariff:
          type: string
          description: >-
            Идентификатор тарифа. Состоит из кода поставщика + код тарифа
            поставщика
          nullable: true
        deliveryType:
          type: string
          description: >-
            Тип доставка (дверь-дверь, склад-дверь и тп). Для внутреннего
            использования
          nullable: true
        link:
          type: string
          description: Ссылка на данный вариант доставки
          nullable: true
        tariff_extra_info:
          $ref: '#/components/schemas/DoubleGisTariffExtraInfo'
      additionalProperties: false
    DoubleGisVisitingInterval:
      type: object
      properties:
        type:
          type: string
          nullable: true
        from:
          type: string
          format: date-time
        to:
          type: string
          format: date-time
      additionalProperties: false
    GisRoutePoint:
      required:
        - lat
        - lon
      type: object
      properties:
        region_id:
          type: string
          description: Код страны. По-умолчанию RU
          nullable: true
        lat:
          type: number
          description: Широта
          format: double
        latitudeStr:
          type: string
          nullable: true
          readOnly: true
        lon:
          type: number
          description: Долгота
          format: double
        longitudeStr:
          type: string
          nullable: true
          readOnly: true
        timezone_offset:
          type: integer
          description: Часовой пояс - пока не используется
          format: int32
      additionalProperties: false
