openapi: 3.0.0
info:
  title: API
  version: '1.0'
  description: |
    ###### Основные статусы заказа:

    - *preliminary* - клиент переводит средства на наши реквизиты
    - *new* | *frozen* - проверяем поступление средств
    - Результат:
      - *completed* - заказ обработан (финальный статус)
      - *deleted* | error - заказ удален, содержит ошибки

    ###### Последовательность создания заказа:
    1. directions
    2. payment-systems
    3. exchange-rate-calculate
    4. order-props-get
    5. order-create
    6. order-validate
    7. order-pay-info
    8. order-confirm

    ###### Ошибка
    ```
    {
      "status": "error",
      "msg": "Timeout",
      "errcode": 303,
      "errname": "SERVER_ERROR"
    }
    ```
servers:
  - url: ''
paths:
  /api/1/directions/:
    get:
      summary: Направления обменов
      operationId: get-api-1-directions
      description: ''
      security:
        - apiakey: []
      parameters: []
      responses:
        '200':
          $ref: '#/components/responses/Directions'
      tags:
        - info
    parameters: []
  /api/1/exchange-rate-calculate/:
    get:
      summary: Вычислить курс обмена
      tags:
        - info
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    type: object
                    properties:
                      direction:
                        $ref: '#/components/schemas/Direction'
                      discount:
                        type: object
                        properties:
                          percent:
                            type: number
                          amount:
                            type: number
                          valute:
                            type: string
                      warnings:
                        type: string
                      alert:
                        type: string
      operationId: get-api-1-exchange-rate-calculate
      parameters:
        - schema:
            type: integer
          in: query
          name: psid1
          required: true
        - schema:
            type: integer
          in: query
          name: psid2
          required: true
        - schema:
            type: number
          in: query
          name: amount
          required: true
        - schema:
            type: string
          in: query
          name: direct
        - schema:
            type: string
          in: query
          name: coupon_name
        - $ref: '#/components/parameters/skey'
      security:
        - apiakey: []
      description: Вычислить окончательный курс обмена для заявки с учетом скидок и т.п.
  /api/1/set-callback-url/:
    get:
      summary: Поключение уведомлений
      tags:
        - callback
      operationId: get-api-1-set-callback-url
      security:
        - apiakey: []
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    type: object
                    properties:
                      callback:
                        type: string
                      signature:
                        type: string
      description: Получать уведомление о смене статуса заявок на указанный url
      parameters:
        - schema:
            type: string
          in: query
          name: callback
          required: true
          description: 'https://test.host/callback'
        - schema:
            type: string
          in: query
          name: signature
          required: true
          description: secretphrases
  /api/1/test-callback-url/:
    get:
      summary: Проверка уведомлений
      tags:
        - callback
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                x-examples:
                  example-1:
                    status: success
                    value:
                      request:
                        type: order-status
                        vkey: MOEX2145
                        param: null
                        value:
                          psid1: 9
                          psid2: 172
                          amount1: 105
                          amount2: 105
                          status: completed
                          order_id: '16037897784326'
                          msg: Заявка выполнена
                        test: 1
                      response:
                        status_code: 200
                        body: OK
                properties:
                  status:
                    type: string
                  value:
                    type: object
                    properties:
                      request:
                        type: object
                        properties:
                          type:
                            type: string
                          vkey:
                            type: string
                          value:
                            type: object
                            properties:
                              psid1:
                                type: integer
                              psid2:
                                type: integer
                              amount1:
                                type: integer
                              amount2:
                                type: integer
                              status:
                                type: string
                              order_id:
                                type: string
                              msg:
                                type: string
                          test:
                            type: integer
                      response:
                        type: object
                        properties:
                          status_code:
                            type: integer
                          body:
                            type: string
              examples:
                example-1:
                  value:
                    status: string
                    value:
                      request:
                        type: string
                        vkey: string
                        param: null
                        value:
                          psid1: 0
                          psid2: 0
                          amount1: 0
                          amount2: 0
                          status: string
                          order_id: string
                          msg: string
                        test: 0
                      response:
                        status_code: 0
                        body: string
      operationId: get-api-1-test-callback-url
      security:
        - apiakey: []
      parameters:
        - schema:
            type: string
          in: query
          name: status
          description: 'Желаемый ответ, если не указан, рандомно'
        - schema:
            type: string
          in: query
          name: order_id
          description: В ответе придет указаный номер
        - schema:
            type: string
          in: query
          name: vkey
          description: 'Параметр, указывается при создании заявки "order-created"'
      description: Проверка уведомлений
  /api/1/payment-systems/:
    get:
      summary: Платежные системы
      tags:
        - info
      responses:
        '200':
          $ref: '#/components/responses/PaymentSystem'
      operationId: get-api-1-payment-systems
      security:
        - apiakey: []
      parameters:
        - schema:
            type: boolean
          in: query
          name: std
          description: 'если true, ключ == psid'
  /api/1/directions-available/:
    get:
      summary: Доступные платежные системы
      tags:
        - info
      operationId: get-api-1-directions-available
      description: Получить доступные платежные системы для обмен
      parameters:
        - $ref: '#/components/parameters/direct'
        - $ref: '#/components/parameters/psid_r'
      security:
        - apiakey: []
      responses:
        '200':
          $ref: '#/components/responses/Directions'
  /api/1/payment-systems-for-receive/:
    get:
      summary: Платежные системы на получения (слева)
      tags:
        - info
      responses:
        '200':
          $ref: '#/components/responses/PaymentSystem'
      operationId: get-api-1-payment-systems-for-receive
      security:
        - apiakey: []
      parameters: []
  /api/1/payment-systems-for-send/:
    get:
      summary: Платежные системы на отдачу (справа)
      tags:
        - info
      responses:
        '200':
          $ref: '#/components/responses/PaymentSystem'
      operationId: get-api-1-payment-systems-for-send
      security:
        - apiakey: []
      parameters: []
  /api/1/order-props-get/:
    get:
      summary: Реквизиты заявки
      tags:
        - order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    $ref: '#/components/schemas/Props'
      operationId: get-api-1-order-props-get
      description: Получить список реквизитов платежных систем на прием и отдачу.
      security:
        - apiakey: []
      parameters:
        - $ref: '#/components/parameters/psid1'
        - $ref: '#/components/parameters/psid2'
        - $ref: '#/components/parameters/direct'
        - $ref: '#/components/parameters/skey'
  /api/1/order-create/:
    post:
      summary: Создать заявку
      tags:
        - order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    $ref: '#/components/schemas/Order'
              examples: {}
      operationId: get-api-1-order-create
      security:
        - apiakey: []
      parameters:
        - $ref: '#/components/parameters/skey'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                Order:
                  $ref: '#/components/schemas/OrderCreate'
                redirect:
                  $ref: '#/components/schemas/OrderRedirect'
                confirm:
                  type: boolean
                  description: 'если true, выполнит и вернет статус "order-confirm"'
                  default: false
                pay-info:
                  type: boolean
                  description: 'сли true, вернет результат метода "order-pay-info". Если confirm & pay-info == true, confirm выполнится, результат ответа будет order-pay-info'
                  default: false
                validate:
                  type: boolean
                  description: |
                    если предусмотрена верификация, вернет метод order-validate
                  default: false
                vkey:
                  type: string
                  description: 'Можно указать номер заявки в Вашей системе, будет приходить в callback'
            examples:
              example-1:
                value:
                  Order:
                    HTTP_USER_AGENT: 'Mozilla/5.0 (Windows NT 10.1; Win32; x86) AppleWebKit/777.77 (KHTML, like Gecko) Chrome/777.0.7777.77 Safari/777.77'
                    psid1: 12
                    psid2: 1
                    in: 0.001
                    out: 1
                    direct: 0
                    agreement: 'yes'
                    coupon_name: 9d6f5d27d
                    props:
                      - name: from_acc
                        value: '1111222233334444'
                      - name: email
                        value: test@protonmail.com
                      - name: to_acc
                        value: 345ASAqaKsbCeFMt1NUZj8wdsPV9vr222
                  vkey: external_id
              example-2:
                value:
                  Order:
                    ip: string
                    HTTP_USER_AGENT: string
                    psid1: 0
                    psid2: 0
                    in: 0
                    out: 0
                    direct: 0
                    agreement: string
                    props:
                      - name: string
                        value: string
                  redirect:
                    success: string
                    error: string
                  confirm: false
                  pay-info: false
                  validate: false
      description: |
        Пример расчета суммы:
        ```
        Обмен Сбербанк на QIWI psid1=8&psid2=9
        Ситуация №1. вы хотите получить 1000р QIWI ровно, in=1&out=1000&direct=1 .. клиент заплатит(1000р+%)
        Ситуация №2. вы хотите что бы клиент потратил ровно 1000р Сбербанк
        in=1000&out=1&direct=0 Вы получите (1000р - % )
        ```

        В поле email нужно передавать почту, указаную при получении ключей API
  /api/1/order-validate/:
    get:
      summary: Проверить заявку
      tags:
        - order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                x-examples:
                  example-1:
                    status: success
                    value:
                      status: success
                      msg: Корректная заявка
                      field: null
                      Order: {}
                properties:
                  status:
                    type: string
                  value:
                    type: object
                    properties:
                      status:
                        type: string
                      msg:
                        type: string
                      field:
                        type: string
                      Order:
                        $ref: '#/components/schemas/Order'
              examples:
                success:
                  value:
                    status: success
                    value:
                      status: success
                      msg: Корректная заявка
                      field: ''
                      Order:
                        id: 'f:0f:0b:08:e6:0a:37'
                        created: '2022-05-31 17:20:35'
                        updateAt: '2022-05-31 17:20:35'
                        expired: '2022-05-31 17:35:35'
                        psid1: 12
                        psid2: 1
                        in: 0.01
                        out: 299.42
                        direct: 0
                        agreement: null
                        props:
                          - id: '14382421727721'
                            psid: 0
                            tag: input
                            type: text
                            name: email
                            label: Ваш E-mail ящик или Telegram
                            placeholder: zhtx@protonmail.com
                            value: test@protonmail.com
                            hidden: 0
                            readonly: 0
                            check_empty: 0
                          - id: '16104510920592'
                            psid: 1
                            tag: input
                            type: text
                            name: to_acc
                            label: На кошелек
                            placeholder: 'Например: U57710104'
                            value: U12312312
                            hidden: 0
                            readonly: 0
                            check_empty: 0
                        status: preliminary
                        status_title: Ожидание поступления средств
                        reason: null
                        extra:
                          - blockchain_url: 'https://www.blockchain.com/btc/address/'
                          - []
                        vkey: false
                        rate:
                          - 1
                          - 29942
                        email: test@protonmail.com
                        bonus_bestchange_review:
                          amount: 198
                          status: false
                        bonus_order_review:
                          amount: '10'
                          status: false
                        bestchange_src: 'http://www.bestchange.com'
                card:
                  value:
                    status: success
                    value:
                      status: card
                      msg: <div>Загрузите фото карты</div>
                      field: card
                      Order: {}
      operationId: get-api-1-order-validate
      description: Проверка заявки на корректность введенных данных
      security:
        - apiakey: []
      parameters:
        - $ref: '#/components/parameters/order_id'
        - $ref: '#/components/parameters/skey'
  /api/1/card-load/:
    post:
      summary: Загрузить файл
      tags:
        - order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                x-examples:
                  example-1:
                    status: success
                    value: 16540827569710
                properties:
                  status:
                    type: string
                  value:
                    type: integer
                    description: card_id
      operationId: get-api-1-card-load
      security:
        - apiakey: []
      parameters:
        - $ref: '#/components/parameters/order_id'
        - schema: {}
          in: query
          name: card
          description: тип - файл. название берется из order-validate (value.field)
          required: true
        - $ref: '#/components/parameters/skey'
      description: Загрузить банковскую карту на проверку
  /api/1/card-status/:
    get:
      summary: Проверить карту
      tags:
        - order
      operationId: get-api-1-card-status
      description: |-
        Получить статус проверки карты.

        После получения статуса allow необходимо вызвать order-validate

        Предусмотреть возможность проверять по кругу (order-validate -> card-load -> card-status)
      security:
        - apiakey: []
      parameters:
        - $ref: '#/components/parameters/order_id'
        - schema:
            type: number
          in: query
          name: card_id
          description: Номер карты
          required: true
        - $ref: '#/components/parameters/skey'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                x-examples:
                  example-1:
                    status: success
                    value:
                      status: processing
                      msg: string
                properties:
                  status:
                    type: string
                  value:
                    type: object
                    properties:
                      status:
                        type: string
                      msg:
                        type: string
              examples:
                processing:
                  value:
                    status: success
                    value:
                      status: processing
                      msg: string
                disallow:
                  value:
                    status: success
                    value:
                      status: disallow
                      msg: Необходимо видеть 16 цифр Вашей карты. Остальную информацию по карте скрыть
                allow:
                  value:
                    status: success
                    value:
                      status: allow
                      msg: string
  /api/1/order-pay-info/:
    get:
      summary: Информация для оплаты по заявке
      tags:
        - order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    $ref: '#/components/schemas/OrderPayInfo'
      operationId: get-api-1-order-pay-info
      description: Информация для оплаты по заявке
      security:
        - apiakey: []
      parameters:
        - $ref: '#/components/parameters/order_id'
        - $ref: '#/components/parameters/skey'
  /api/1/order-confirm/:
    get:
      summary: Завершение создания заявки
      tags:
        - order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    type: object
                    properties:
                      Order:
                        $ref: '#/components/schemas/Order'
                      Access:
                        $ref: '#/components/schemas/UserAccess'
              examples: {}
      operationId: get-api-1-order-confirm
      description: Подтверждение оплаты и завершение оформления заявки
      security:
        - apiakey: []
      parameters:
        - $ref: '#/components/parameters/order_id'
        - $ref: '#/components/parameters/skey'
  /api/1/order-cancel/:
    get:
      summary: Отмена оформления заявки
      tags:
        - order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    nullable: true
      operationId: get-api-1-order-cancel
      description: Отмена оформления заявки
      security:
        - apiakey: []
      parameters:
        - $ref: '#/components/parameters/order_id'
        - $ref: '#/components/parameters/skey'
  /api/1/order-get/:
    get:
      summary: Получить заявку
      tags:
        - order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    $ref: '#/components/schemas/Order'
      operationId: get-api-1-order-get
      description: Получить объект заявки
      security:
        - apiakey: []
      parameters:
        - $ref: '#/components/parameters/order_id'
        - $ref: '#/components/parameters/skey'
  /api/1/orders-get/:
    post:
      summary: Получить заявки
      tags:
        - order
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  '':
                    type: array
                    items:
                      $ref: '#/components/schemas/Order'
      operationId: get-api-1-orders-get
      description: Получить объекты заявок
      security:
        - apiakey: []
      parameters:
        - $ref: '#/components/parameters/skey'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                page:
                  type: integer
                limit:
                  type: integer
                status:
                  type: array
                  items: {}
                orders:
                  type: array
                  items: {}
                updateAt:
                  type: string
        description: ''
  /api/1/valutes/:
    get:
      summary: Валюты
      tags:
        - info
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        code:
                          type: string
                        name:
                          type: string
                        precision:
                          type: integer
                x-examples:
                  example-1:
                    status: success
                    value:
                      - id: '34'
                        code: ADA
                        name: Cardano (ADA)
                        precision: 8
                      - id: '76'
                        code: ARCONA
                        name: Arcona
                        precision: 6
      operationId: get-api-1-valutes
      security:
        - apiakey: []
      parameters: []
  /api/1/user-login/:
    get:
      summary: user-login
      tags:
        - user
      responses:
        '200':
          $ref: '#/components/responses/UserSign'
      operationId: get-api-1-user-login
      description: Авторизация в системе
      security:
        - apiakey: []
      parameters:
        - schema:
            type: string
          in: query
          name: email
          required: true
        - schema:
            type: string
          in: query
          name: password
          required: true
  /api/1/user-register/:
    get:
      summary: Новый пользователь
      tags:
        - user
      responses:
        '200':
          $ref: '#/components/responses/UserSign'
      operationId: get-api-1-user-register
      parameters:
        - schema:
            type: string
          in: query
          name: email
        - schema:
            type: string
          in: query
          name: password
        - schema:
            type: string
          in: query
          name: inviter
          description: Идентификатор пригласителя
      security:
        - apiakey: []
  /api/1/user-info/:
    get:
      summary: Информация о пользователе
      tags:
        - user
      responses:
        '200':
          description: OK
          headers: {}
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    $ref: '#/components/schemas/User'
      operationId: get-api-1-user-info
      security:
        - apiakey: []
  /api/1/user-change-password/:
    get:
      summary: Сменить пароль
      tags:
        - user
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                  value:
                    $ref: '#/components/schemas/UserAccess'
      operationId: get-api-1-user-change-password
      description: ''
      security:
        - apiakey: []
      parameters:
        - schema:
            type: string
          in: query
          name: old_password
          description: Старый пароль
          required: true
        - schema:
            type: string
          in: query
          name: new_password
          description: Новый пароль
          required: true
components:
  schemas:
    Direction:
      title: Direction
      type: object
      properties:
        id:
          type: integer
        enabled:
          type: integer
        direct:
          type: integer
        psid1:
          type: integer
        psid2:
          type: integer
        in:
          type: string
        in_valute:
          type: string
        in_name:
          type: string
        in_min:
          type: number
        in_max:
          type: number
        out_min:
          type: number
        in_group:
          type: string
        out_group:
          type: string
        reserve:
          type: string
      description: ''
      x-examples:
        example-1:
          id: 1
          enabled: 1
          direct: 0
          psid1: 12
          psid2: 9
          in: '2'
          in_valute: BTC
          in_name: Bitcoin
          out: '3302925.4'
          out_valute: RUR
          out_name: QIWI RUB
          in_min: 0.001
          in_max: 100
          out_min: 0
          in_group: crypto
          out_group: ps
          reserve: '12917'
    PaymentSystem:
      type: object
      properties:
        psid:
          type: integer
        name:
          type: string
        valute:
          type: string
        reserve:
          type: integer
        with_codes:
          type: integer
        group:
          type: string
        payin:
          type: integer
        payout:
          type: integer
      x-examples:
        example-1:
          psid: 324
          name: BBTC ERC20
          valute: BTC
          reserve: 0
          with_codes: 0
          group: crypto
          payin: 0
          payout: 0
    Props:
      type: array
      x-examples:
        example-1:
          - id: '14382421727721'
            psid: 0
            tag: input
            type: text
            name: email
            label: Ваш E-mail ящик или Telegram
            placeholder: lksr@protonmail.com
            value: null
            hidden: 0
            readonly: 0
            check_empty: 0
          - id: '16104510920592'
            psid: 1
            tag: input
            type: text
            name: to_acc
            label: На кошелек
            placeholder: 'Например: U50867651'
            value: null
            hidden: 0
            readonly: 0
            check_empty: 0
      items:
        type: object
        properties:
          id:
            type: string
          psid:
            type: integer
          tag:
            type: string
          type:
            type: string
          name:
            type: string
          label:
            type: string
          placeholder:
            type: string
          value: {}
          hidden:
            type: integer
          readonly:
            type: integer
          check_empty:
            type: integer
    OrderRedirect:
      type: object
      properties:
        success:
          type: string
        error:
          type: string
      x-examples:
        example-1:
          success: 'https://your.site/success'
          error: 'https://your.site/error'
    OrderCreate:
      type: object
      x-examples:
        example-1:
          ip: 123.213.21.12
          HTTP_USER_AGENT: 'Mozilla/5.0 (Windows NT 10.3; Win32; x32) AppleWebKit/500.31 (KHTML, like Gecko) Chrome/1.0.1.67 Safari/500.31'
          psid1: 12
          psid2: 1
          in: 1
          out: 10
          direct: 0
          agreement: 'yes'
          props:
            - name: email
              value: name@protomail.ch
            - name: from_acc
              value: '5234567222223456'
            - name: from_fio
              value: Иванов Иван Иванович
            - name: to_acc
              value: 17kYrRDhvNy2Btn8ovnTYaLVeVuMm4jNOo
      properties:
        ip:
          type: string
        HTTP_USER_AGENT:
          type: string
        psid1:
          type: integer
        psid2:
          type: integer
        in:
          type: number
        out:
          type: number
        direct:
          type: integer
        agreement:
          type: string
        props:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              value:
                type: string
    Order:
      type: object
      x-examples:
        example-1:
          id: 'f:0f:0b:08:e6:0a:37'
          created: '2022-05-31 17:20:35'
          updateAt: '2022-05-31 17:20:35'
          expired: '2022-05-31 17:35:35'
          psid1: 12
          psid2: 1
          in: 0.01
          out: 299.42
          direct: 0
          agreement: null
          props:
            - id: '14382421727721'
              psid: 0
              tag: input
              type: text
              name: email
              label: Ваш E-mail ящик или Telegram
              placeholder: 1vw4l@protonmail.com
              value: test@protonmail.com
              hidden: 0
              readonly: 0
              check_empty: 0
            - id: '16104510920592'
              psid: 1
              tag: input
              type: text
              name: to_acc
              label: На кошелек
              placeholder: 'Например: U85153664'
              value: U12312312
              hidden: 0
              readonly: 0
              check_empty: 0
          status: preliminary
          status_title: Ожидание поступления средств
          reason: null
          extra:
            - blockchain_url: 'https://www.blockchain.com/btc/address/1DnsNV3zhzZz3K1XadrE23Yb1b84EFH1d2'
            - []
          vkey: false
          rate:
            - 1
            - 29942
          email: test@protonmail.com
          bonus_bestchange_review:
            amount: 198
            status: false
          bonus_order_review:
            amount: '10'
            status: false
          bestchange_src: 'http://www.bestchange.ru/'
      properties:
        id:
          type: string
        created:
          type: string
        updateAt:
          type: string
        expired:
          type: string
        psid1:
          type: integer
        psid2:
          type: integer
        in:
          type: number
        out:
          type: number
        direct:
          type: integer
        agreement:
          nullable: true
        props:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
              psid:
                type: integer
              tag:
                type: string
              type:
                type: string
              name:
                type: string
              label:
                type: string
              placeholder:
                type: string
              value:
                type: string
              hidden:
                type: integer
              readonly:
                type: integer
              check_empty:
                type: integer
        status:
          $ref: '#/components/schemas/OrderLocation'
        status_title:
          type: string
        reason:
          nullable: true
        extra:
          type: array
          items:
            type: object
            properties:
              blockchain_url:
                type: string
        vkey:
          type: boolean
        rate:
          type: array
          items:
            type: integer
        email:
          type: string
        bonus_bestchange_review:
          type: object
          properties:
            amount:
              type: integer
            status:
              type: boolean
        bonus_order_review:
          type: object
          properties:
            amount:
              type: string
            status:
              type: boolean
        bestchange_src:
          type: string
    OrderPayInfo:
      type: object
      x-examples:
        example-1:
          info:
            - title: Откройте клиент-Bitcoin и сделайте перевод по реквизитам
              value: 1nsNV3zhzZz3KhXadrE45Yb1b84EFH1d5
              extra: Кошелек
              psid: 12
              qr: '<img src="data:image/png;base64,"/>'
            - title: На сумму
              value: 0.01
              extra: BTC
              psid: 12
            - title: 'Кошелек, куда Вы получаете'
              value: U12312312
              extra: Кошелек
              psid: 1
            - title: Сумма зачисления
              value: 299.42
              extra: USD
              psid: 1
          alert: <ul><li>some alert</li></ul>
          SCI:
            status: 0
            link: null
            html: null
          extra: <div>some text</div>
          redirect: 0
          order_id: 'f:0f:0b:08:e6:0a:37'
          pd:
            - title: Кошелек
              alias: account
              value: 1nsNV3zhzZz3KhXadrE45Yb1b84EFH1d5
      properties:
        info:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
              value:
                type: string
              extra:
                type: string
              psid:
                type: integer
              qr:
                type: string
        alert:
          type: string
        SCI:
          type: object
          properties:
            status:
              type: integer
            link: {}
            html: {}
        extra:
          type: string
        redirect:
          type: integer
        order_id:
          type: string
        pd:
          type: array
          items:
            type: object
            properties:
              title:
                type: string
              alias:
                type: string
              value:
                type: string
    User:
      type: object
      properties:
        id:
          type: string
        created:
          type: string
        email:
          type: string
        discount:
          type: integer
        percentage:
          type: number
        exchange_amount:
          type: string
        verification:
          type: string
        email_confirmed:
          type: boolean
        account_type:
          type: string
        bonus:
          type: integer
      x-examples:
        example-1:
          id: '16540731756427'
          created: '2022-06-01 11:46:15'
          email: test@protonmail.com
          discount: 2
          percentage: 0.6
          exchange_amount: '0'
          verification: fatal
          email_confirmed: false
          account_type: Individual
          bonus: 0
    UserAccess:
      type: object
      x-examples:
        example-1:
          akey: null
          skey: '4105316657947165767079513146'
      properties:
        akey:
          type: string
        skey:
          type: string
    OrderLocation:
      x-examples:
        example-1: new
      oneOf:
        - default: preliminary
          description: Предварительная
        - default: frozen
          description: Ожидает оплаты
        - properties: {}
          default: new
          description: Проверка оплаты
        - properties: {}
          default: deleted
          description: Удалена
        - properties: {}
          default: error
          description: Содержит ошибки
        - properties: {}
          default: completed
          description: Обработана (финальный статус)
      type: string
  securitySchemes:
    apiakey:
      name: akey
      type: apiKey
      in: query
      description: API key
  parameters:
    psid_r:
      name: psid
      in: query
      schema:
        type: number
      description: Идентификатор платежной системы
      required: true
    direct:
      name: direct
      in: query
      required: false
      schema:
        type: integer
        example: 1
      description: Флаг направления обмена
    psid1:
      name: psid1
      in: query
      required: true
      schema:
        type: integer
        example: 12
      description: 'ID направления, откуда клиент переводит средства'
    psid2:
      name: psid2
      in: query
      required: true
      schema:
        type: integer
        example: 1
      description: 'ID направления, куда клиент хочет получить средства'
    order_id:
      name: order_id
      in: query
      required: true
      schema:
        type: number
      description: Номер заявки
    skey:
      name: skey
      in: query
      required: false
      schema:
        type: string
      description: Секретный ключ пользователя
  responses:
    PaymentSystem:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
              value:
                type: array
                items:
                  $ref: '#/components/schemas/PaymentSystem'
    Directions:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
              value:
                type: array
                items:
                  $ref: '#/components/schemas/Direction'
    UserSign:
      description: Example response
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
              value:
                type: object
                properties:
                  User:
                    $ref: '#/components/schemas/User'
                  Access:
                    $ref: '#/components/schemas/UserAccess'
          examples:
            security-telegram:
              value:
                status: string
                value:
                  security:
                    template: fields
                    data:
                      error:
                        status: error
                        msg: 'Введите проверочный код:'
                        field: telegram
                      action_id: login
                      login: test@protonmail.com
                      props:
                        telegram:
                          provider: telegram
                          enabled: true
                          sendCode: true
                          code_expires_in: null
                          label: 'Проверочный код Telegram:'
                          placeholder: Telegram Код
                          name: login_telegram
                          _name: Telegram
                          value: ''
  requestBodies: {}
security:
  - apiakey: []
