- Auth
  - postRegister as user
  - postLogin
  - postLogout
  - postRefresh auth tokens
  - postForgot password
  - postReset password
  - postSend verification email
  - postverify email
- Orders
  - postОбработка IPN уведомления
  - postСоздание регистрационного платежа
  - postСоздание депозита в кошелёк
- Users
  - postСоздать пользователя
  - getПолучить всех пользователей
  - getПолучить пользователя
  - patchОбновить пользователя

API docs by Redocly

# API Цифрового Кооператива (1)

Download OpenAPI specification:Download

License: MIT

# Auth

Authentication

## Register as user

##### Request Body schema: application/json

name required | string
email required | string <email> must be unique
password required | string <password> >= 8 characters At least one number and one letter

### Responses

http://localhost:2998/v1/auth/register

### Request samples

- Payload

Content type
application/json
`
{

- "name": "fake name",
- "email": "fake@example.com",
- "password": "password1"

}`

### Response samples

- 201
- 400

Content type
application/json
`
{

- "user":
  {
  - "username": "string",
  - "status": "created",
  - "is_registered": true,
  - "type": "individual",
  - "public_key": "string",
  - "referer": "string",
  - "email": "user@example.com",
  - "role": "string",
  - "is_email_verified": true,
  - "private_data":
    {
    - "first_name": "string",
    - "last_name": "string",
    - "middle_name": "string",
    - "birthdate": "string",
    - "phone": "string",
    - "email": "user@example.com",
    - "country": "Russia",
    - "city": "string",
    - "full_address": "string",
    - "details":
      {
      - "inn": "string",
      - "ogrn": "string"
      },
    - "bank_account":
      {
      - "currency": "RUB",
      - "card_number": "string",
      - "bank_name": "string",
      - "account_number": "string",
      - "details":
        {
        - "bik": "string",
        - "inn": "string",
        - "corr": "string",
        - "kpp": "string"
        }
      }
    }
  },
- "tokens":
  {
  - "access":
    {
    - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZWJhYzUzNDk1NGI1NDEzOTgwNmMxMTIiLCJpYXQiOjE1ODkyOTg0ODQsImV4cCI6MTU4OTMwMDI4NH0.m1U63blB0MLej_WfB7yC2FTMnCziif9X8yzwDEfJXAg",
    - "expires": "2020-05-12T16:18:04.793Z"
    },
  - "refresh":
    {
    - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZWJhYzUzNDk1NGI1NDEzOTgwNmMxMTIiLCJpYXQiOjE1ODkyOTg0ODQsImV4cCI6MTU4OTMwMDI4NH0.m1U63blB0MLej_WfB7yC2FTMnCziif9X8yzwDEfJXAg",
    - "expires": "2020-05-12T16:18:04.793Z"
    }
  }

}`

## Login

##### Request Body schema: application/json

email required | string <email>
password required | string <password>

### Responses

http://localhost:2998/v1/auth/login

### Request samples

- Payload

Content type
application/json
`
{

- "email": "fake@example.com",
- "password": "password1"

}`

### Response samples

- 200
- 401

Content type
application/json
`
{

- "user":
  {
  - "username": "string",
  - "status": "created",
  - "is_registered": true,
  - "type": "individual",
  - "public_key": "string",
  - "referer": "string",
  - "email": "user@example.com",
  - "role": "string",
  - "is_email_verified": true,
  - "private_data":
    {
    - "first_name": "string",
    - "last_name": "string",
    - "middle_name": "string",
    - "birthdate": "string",
    - "phone": "string",
    - "email": "user@example.com",
    - "country": "Russia",
    - "city": "string",
    - "full_address": "string",
    - "details":
      {
      - "inn": "string",
      - "ogrn": "string"
      },
    - "bank_account":
      {
      - "currency": "RUB",
      - "card_number": "string",
      - "bank_name": "string",
      - "account_number": "string",
      - "details":
        {
        - "bik": "string",
        - "inn": "string",
        - "corr": "string",
        - "kpp": "string"
        }
      }
    }
  },
- "tokens":
  {
  - "access":
    {
    - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZWJhYzUzNDk1NGI1NDEzOTgwNmMxMTIiLCJpYXQiOjE1ODkyOTg0ODQsImV4cCI6MTU4OTMwMDI4NH0.m1U63blB0MLej_WfB7yC2FTMnCziif9X8yzwDEfJXAg",
    - "expires": "2020-05-12T16:18:04.793Z"
    },
  - "refresh":
    {
    - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZWJhYzUzNDk1NGI1NDEzOTgwNmMxMTIiLCJpYXQiOjE1ODkyOTg0ODQsImV4cCI6MTU4OTMwMDI4NH0.m1U63blB0MLej_WfB7yC2FTMnCziif9X8yzwDEfJXAg",
    - "expires": "2020-05-12T16:18:04.793Z"
    }
  }

}`

## Logout

##### Request Body schema: application/json

refreshToken required | string

### Responses

http://localhost:2998/v1/auth/logout

### Request samples

- Payload

Content type
application/json
`
{

- "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZWJhYzUzNDk1NGI1NDEzOTgwNmMxMTIiLCJpYXQiOjE1ODkyOTg0ODQsImV4cCI6MTU4OTMwMDI4NH0.m1U63blB0MLej_WfB7yC2FTMnCziif9X8yzwDEfJXAg"

}`

### Response samples

- 404

Content type
application/json
`
{

- "code": 404,
- "message": "Not found"

}`

## Refresh auth tokens

##### Request Body schema: application/json

refreshToken required | string

### Responses

http://localhost:2998/v1/auth/refresh-tokens

### Request samples

- Payload

Content type
application/json
`
{

- "refreshToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZWJhYzUzNDk1NGI1NDEzOTgwNmMxMTIiLCJpYXQiOjE1ODkyOTg0ODQsImV4cCI6MTU4OTMwMDI4NH0.m1U63blB0MLej_WfB7yC2FTMnCziif9X8yzwDEfJXAg"

}`

### Response samples

- 200
- 401

Content type
application/json
`
{

- "access":
  {
  - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZWJhYzUzNDk1NGI1NDEzOTgwNmMxMTIiLCJpYXQiOjE1ODkyOTg0ODQsImV4cCI6MTU4OTMwMDI4NH0.m1U63blB0MLej_WfB7yC2FTMnCziif9X8yzwDEfJXAg",
  - "expires": "2020-05-12T16:18:04.793Z"
  },
- "refresh":
  {
  - "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI1ZWJhYzUzNDk1NGI1NDEzOTgwNmMxMTIiLCJpYXQiOjE1ODkyOTg0ODQsImV4cCI6MTU4OTMwMDI4NH0.m1U63blB0MLej_WfB7yC2FTMnCziif9X8yzwDEfJXAg",
  - "expires": "2020-05-12T16:18:04.793Z"
  }

}`

## Forgot password

An email will be sent to reset password.

##### Request Body schema: application/json

email required | string <email>

### Responses

http://localhost:2998/v1/auth/forgot-password

### Request samples

- Payload

Content type
application/json
`
{

- "email": "fake@example.com"

}`

### Response samples

- 404

Content type
application/json
`
{

- "code": 404,
- "message": "Not found"

}`

## Reset password

##### query Parameters

token required | string The reset password token

##### Request Body schema: application/json

password required | string <password> >= 8 characters At least one number and one letter

### Responses

http://localhost:2998/v1/auth/reset-password

### Request samples

- Payload

Content type
application/json
`
{

- "password": "password1"

}`

### Response samples

- 401

Content type
application/json
`
{

- "code": 401,
- "message": "Password reset failed"

}`

## Send verification email

An email will be sent to verify email.

##### Authorizations:

bearerAuth

### Responses

http://localhost:2998/v1/auth/send-verification-email

### Response samples

- 401

Content type
application/json
`
{

- "code": 401,
- "message": "Please authenticate"

}`

## verify email

##### query Parameters

token required | string The verify email token

### Responses

http://localhost:2998/v1/auth/verify-email

### Response samples

- 401

Content type
application/json
`
{

- "code": 401,
- "message": "verify email failed"

}`

# Orders

Управление платежами

## Обработка IPN уведомления

Маршрут для обработки IPN уведомления.

### Responses

http://localhost:2998/v1/orders/ipn

## Создание регистрационного платежа

Маршрут для создания регистрационного платежа.

##### Authorizations:

bearerAuth

##### Request Body schema: application/json

username required | string

### Responses

http://localhost:2998/v1/orders/initial

### Request samples

- Payload

Content type
application/json
`
{

- "username": "string"

}`

### Response samples

- 200

Content type
application/json
`
{

- "order_id": 0,
- "confirmation_token": "string"

}`

## Создание депозита в кошелёк

Маршрут для создания депозита.

##### Authorizations:

bearerAuth

##### Request Body schema: application/json

username required | string
quantity required | string

### Responses

http://localhost:2998/v1/orders/deposit

### Request samples

- Payload

Content type
application/json
`
{

- "username": "string",
- "quantity": "string"

}`

### Response samples

- 200

Content type
application/json
`
{

- "order_id": 0,
- "confirmation_token": "string"

}`

# Users

Управление пользователями

## Создать пользователя

Только администраторы могут создавать новых пользователей.

##### Authorizations:

bearerAuth

##### Request Body schema: application/json

email required | string <email>
password required | string
role required | string Enum: "user" "admin"
public_key required | string
username required | string
referer | string = 12 characters
type required | string Enum: "individual" "entrepreneur" "organization"
| object (IIndividualData)
| object (IOrganizationData)
| object (IEntrepreneurData)

### Responses

http://localhost:2998/v1/users

### Request samples

- Payload

Content type
application/json
`
{

- "email": "user@example.com",
- "password": "string",
- "role": "user",
- "public_key": "string",
- "username": "string",
- "referer": "stringstring",
- "type": "individual",
- "individual_data":
  {
  - "first_name": "string",
  - "last_name": "string",
  - "middle_name": "string",
  - "birthdate": "string",
  - "full_address": "string",
  - "phone": "string",
  - "email": "user@example.com"
  },
- "organization_data":
  {
  - "is_cooperative": false,
  - "short_name": "string",
  - "full_name": "string",
  - "represented_by":
    {
    - "first_name": "string",
    - "last_name": "string",
    - "middle_name": "string",
    - "position": "string",
    - "based_on": "string"
    },
  - "country": "Russia",
  - "city": "string",
  - "full_address": "string",
  - "email": "user@example.com",
  - "phone": "string",
  - "details":
    {
    - "inn": "string",
    - "ogrn": "string"
    },
  - "bank_account":
    {
    - "currency": "RUB",
    - "card_number": "string",
    - "bank_name": "string",
    - "account_number": "string",
    - "details":
      {
      - "bik": "string",
      - "inn": "string",
      - "corr": "string",
      - "kpp": "string"
      }
    }
  },
- "entrepreneur_data":
  {
  - "first_name": "string",
  - "last_name": "string",
  - "middle_name": "string",
  - "birthdate": "string",
  - "phone": "string",
  - "email": "user@example.com",
  - "country": "Russia",
  - "city": "string",
  - "full_address": "string",
  - "details":
    {
    - "inn": "string",
    - "ogrn": "string"
    },
  - "bank_account":
    {
    - "currency": "RUB",
    - "card_number": "string",
    - "bank_name": "string",
    - "account_number": "string",
    - "details":
      {
      - "bik": "string",
      - "inn": "string",
      - "corr": "string",
      - "kpp": "string"
      }
    }
  }

}`

### Response samples

- 201
- 400
- 401
- 403

Content type
application/json
`
{

- "username": "string",
- "status": "created",
- "is_registered": true,
- "type": "individual",
- "public_key": "string",
- "referer": "string",
- "email": "user@example.com",
- "role": "string",
- "is_email_verified": true,
- "private_data":
  {
  - "first_name": "string",
  - "last_name": "string",
  - "middle_name": "string",
  - "birthdate": "string",
  - "phone": "string",
  - "email": "user@example.com",
  - "country": "Russia",
  - "city": "string",
  - "full_address": "string",
  - "details":
    {
    - "inn": "string",
    - "ogrn": "string"
    },
  - "bank_account":
    {
    - "currency": "RUB",
    - "card_number": "string",
    - "bank_name": "string",
    - "account_number": "string",
    - "details":
      {
      - "bik": "string",
      - "inn": "string",
      - "corr": "string",
      - "kpp": "string"
      }
    }
  }

}`

## Получить всех пользователей

Только администратор может получить всех пользователей

##### Authorizations:

bearerAuth

##### query Parameters

username | string Системное имя пользователя
role | string Роль пользователя
sortBy | string Сортировка по полю в формате field:desc/asc (например, name:asc)
limit | integer >= 1 Default: 10 Максимальное количество пользователей
page | integer >= 1 Default: 1 Номер страницы

### Responses

http://localhost:2998/v1/users

### Response samples

- 200
- 401
- 403

Content type
application/json
`
{

- "results":
  [
  - {
    - "username": "string",
    - "status": "created",
    - "is_registered": true,
    - "type": "individual",
    - "public_key": "string",
    - "referer": "string",
    - "email": "user@example.com",
    - "role": "string",
    - "is_email_verified": true,
    - "private_data":
      {
      - "first_name": "string",
      - "last_name": "string",
      - "middle_name": "string",
      - "birthdate": "string",
      - "phone": "string",
      - "email": "user@example.com",
      - "country": "Russia",
      - "city": "string",
      - "full_address": "string",
      - "details":
        {
        - "inn": "string",
        - "ogrn": "string"
        },
      - "bank_account":
        {
        - "currency": "RUB",
        - "card_number": "string",
        - "bank_name": "string",
        - "account_number": "string",
        - "details":
          {
          - "bik": "string",
          - "inn": "string",
          - "corr": "string",
          - "kpp": "string"
          }
        }
      }
    }
  ],
- "page": 1,
- "limit": 10,
- "totalPages": 1,
- "totalResults": 1

}`

## Получить пользователя

Авторизованные пользователи могут получать только свою собственную информацию. Только администраторы могут получать информацию о других пользователях.

##### Authorizations:

bearerAuth

##### path Parameters

username required | string Идентификатор пользователя

### Responses

http://localhost:2998/v1/users/{username}

### Response samples

- 200
- 401
- 403
- 404

Content type
application/json
`
{

- "username": "string",
- "status": "created",
- "is_registered": true,
- "type": "individual",
- "public_key": "string",
- "referer": "string",
- "email": "user@example.com",
- "role": "string",
- "is_email_verified": true,
- "private_data":
  {
  - "first_name": "string",
  - "last_name": "string",
  - "middle_name": "string",
  - "birthdate": "string",
  - "phone": "string",
  - "email": "user@example.com",
  - "country": "Russia",
  - "city": "string",
  - "full_address": "string",
  - "details":
    {
    - "inn": "string",
    - "ogrn": "string"
    },
  - "bank_account":
    {
    - "currency": "RUB",
    - "card_number": "string",
    - "bank_name": "string",
    - "account_number": "string",
    - "details":
      {
      - "bik": "string",
      - "inn": "string",
      - "corr": "string",
      - "kpp": "string"
      }
    }
  }

}`

## Обновить пользователя

Только администраторы могут обновлять информацию о других пользователях.

##### Authorizations:

bearerAuth

##### path Parameters

username required | string Системное имя пользователя

##### Request Body schema: application/json

email | string <email> должен быть уникальным
password | string <password> >= 8 characters Минимум одна цифра и одна буква

### Responses

http://localhost:2998/v1/users/{username}

### Request samples

- Payload

Content type
application/json
`
{

- "email": "user@example.com",
- "password": "pa$$word"

}`

### Response samples

- 200
- 400
- 401
- 403
- 404

Content type
application/json
`
{

- "username": "string",
- "status": "created",
- "is_registered": true,
- "type": "individual",
- "public_key": "string",
- "referer": "string",
- "email": "user@example.com",
- "role": "string",
- "is_email_verified": true,
- "private_data":
  {
  - "first_name": "string",
  - "last_name": "string",
  - "middle_name": "string",
  - "birthdate": "string",
  - "phone": "string",
  - "email": "user@example.com",
  - "country": "Russia",
  - "city": "string",
  - "full_address": "string",
  - "details":
    {
    - "inn": "string",
    - "ogrn": "string"
    },
  - "bank_account":
    {
    - "currency": "RUB",
    - "card_number": "string",
    - "bank_name": "string",
    - "account_number": "string",
    - "details":
      {
      - "bik": "string",
      - "inn": "string",
      - "corr": "string",
      - "kpp": "string"
      }
    }
  }

}`