Advertisement
Guest User

swagger.json

a guest
Jul 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 20.63 KB | None | 0 0
  1. {
  2.   "swagger": "2.0",
  3.   "info": {
  4.     "description": "API взаимодействия между ЛК «Заемщика» и Партнером",
  5.     "version": "1.0.0",
  6.     "title": "API взаимодействия между ЛК «Заемщика» и Партнером"
  7.   },
  8.   "host": "partner-url.com",
  9.   "basePath": "/v1",
  10.   "tags": [
  11.     {
  12.       "name": "register_new_loan",
  13.       "description": "Регистрация займа"
  14.     },
  15.     {
  16.       "name": "cancel_request",
  17.       "description": "Отменить заявку"
  18.     },
  19.     {
  20.       "name": "get_loan_deals_status",
  21.       "description": "Получение статусов по заявкам"
  22.     },
  23.     {
  24.       "name": "settings_detail",
  25.       "description": "Получение настроек по займам"
  26.     }
  27.   ],
  28.   "schemes": [
  29.     "https"
  30.   ],
  31.   "paths": {
  32.     "/register_new_loan": {
  33.       "post": {
  34.         "tags": [
  35.           "register_new_loan"
  36.         ],
  37.         "summary": "Регистрация заявки на займ",
  38.         "description": "Регистрация заявки на займ в системе партнера",
  39.         "consumes": [
  40.           "application/json"
  41.         ],
  42.         "produces": [
  43.           "application/json"
  44.         ],
  45.         "parameters": [
  46.           {
  47.             "in": "body",
  48.             "name": "body",
  49.             "required": true,
  50.             "schema": {
  51.               "$ref": "#/definitions/LoanRequest"
  52.             }
  53.           }
  54.         ],
  55.         "responses": {
  56.           "200": {
  57.             "description": "Заявка на займ успешно зарегистрирована",
  58.             "schema": {
  59.               "$ref": "#/definitions/LoanCreateResponse200"
  60.             }
  61.           },
  62.           "400": {
  63.             "description": "Ошибка на стороне клиента. Например, отсутствует один или более обязательных параметров запроса, формат или комбинация параметров некорректны",
  64.             "schema": {
  65.               "$ref": "#/definitions/ErroResponse"
  66.             }
  67.           },
  68.           "500": {
  69.             "description": "Ошибка на стороне партнера",
  70.             "schema": {
  71.               "$ref": "#/definitions/ErroResponse"
  72.             }
  73.           }
  74.         }
  75.       }
  76.     },
  77.     "/cancel_request": {
  78.       "post": {
  79.         "tags": [
  80.           "cancel_request"
  81.         ],
  82.         "summary": "Отмена заявки",
  83.         "description": "Отмена заявки по инициативе заемщика.\n\nУ клиента в ЛК «Заемщика» есть возможность отменять заявку до выдачи займа (статус `completed`).\n",
  84.         "parameters": [
  85.           {
  86.             "in": "body",
  87.             "name": "body",
  88.             "required": true,
  89.             "schema": {
  90.               "type": "object",
  91.               "required": [
  92.                 "loan_id"
  93.               ],
  94.               "properties": {
  95.                 "loan_id": {
  96.                   "type": "string",
  97.                   "example": "11-23123",
  98.                   "description": "Идентификатор заявки в системе партнера"
  99.                 }
  100.               }
  101.             }
  102.           }
  103.         ],
  104.         "responses": {
  105.           "200": {
  106.             "description": "Заявка на займ успешно удалена",
  107.             "schema": {
  108.               "type": "object",
  109.               "required": [
  110.                 "success"
  111.               ],
  112.               "properties": {
  113.                 "success": {
  114.                   "type": "boolean",
  115.                   "example": "true"
  116.                 }
  117.               }
  118.             }
  119.           },
  120.           "400": {
  121.             "description": "Ошибка на стороне клиента. Например, отсутствует один или более обязательных параметров запроса, формат или комбинация параметров некорректны",
  122.             "schema": {
  123.               "$ref": "#/definitions/ErroResponse"
  124.             }
  125.           },
  126.           "500": {
  127.             "description": "Ошибка на стороне партнера",
  128.             "schema": {
  129.               "$ref": "#/definitions/ErroResponse"
  130.             }
  131.           }
  132.         }
  133.       }
  134.     },
  135.     "/get_loan_deals_status": {
  136.       "post": {
  137.         "tags": [
  138.           "get_loan_deals_status"
  139.         ],
  140.         "summary": "Получение статусов по заявкам",
  141.         "description": "Система в виде ЛК «Заемщика» с определенной периодичностью запрашивает у системы «Партнера» статусы заявок за определенный период для синхронизации статусов заявок в ЛК «Заемщика»",
  142.         "consumes": [
  143.           "application/json"
  144.         ],
  145.         "produces": [
  146.           "application/json"
  147.         ],
  148.         "parameters": [
  149.           {
  150.             "in": "body",
  151.             "name": "body",
  152.             "required": true,
  153.             "schema": {
  154.               "$ref": "#/definitions/Period"
  155.             }
  156.           }
  157.         ],
  158.         "responses": {
  159.           "200": {
  160.             "description": "Список заявок у которых изменился статус за указанный период",
  161.             "schema": {
  162.               "$ref": "#/definitions/LoanDetails"
  163.             }
  164.           },
  165.           "400": {
  166.             "description": "Ошибка на стороне клиента. Например, отсутствует один или более обязательных параметров запроса, формат или комбинация параметров некорректны",
  167.             "schema": {
  168.               "$ref": "#/definitions/ErroResponse"
  169.             }
  170.           },
  171.           "500": {
  172.             "description": "Ошибка на стороне партнера",
  173.             "schema": {
  174.               "$ref": "#/definitions/ErroResponse"
  175.             }
  176.           }
  177.         }
  178.       }
  179.     },
  180.     "/settings_detail": {
  181.       "get": {
  182.         "tags": [
  183.           "settings_detail"
  184.         ],
  185.         "summary": "Получение настроек по займам",
  186.         "description": "Система в виде ЛК «Заемщика» с определенной периодичностью запрашивает у системы «Партнера» настройки по займам для их синхронизации в ЛК «Заемщика»",
  187.         "consumes": [
  188.           "application/json"
  189.         ],
  190.         "produces": [
  191.           "application/json"
  192.         ],
  193.         "responses": {
  194.           "200": {
  195.             "description": "Настройки по займам",
  196.             "schema": {
  197.               "$ref": "#/definitions/SettingsDetail"
  198.             }
  199.           },
  200.           "400": {
  201.             "description": "Ошибка на стороне клиента. Например, отсутствует один или более обязательных параметров запроса, формат или комбинация параметров некорректны",
  202.             "schema": {
  203.               "$ref": "#/definitions/ErroResponse"
  204.             }
  205.           },
  206.           "500": {
  207.             "description": "Ошибка на стороне партнера",
  208.             "schema": {
  209.               "$ref": "#/definitions/ErroResponse"
  210.             }
  211.           }
  212.         }
  213.       }
  214.     }
  215.   },
  216.   "definitions": {
  217.     "LoanRequest": {
  218.       "type": "object",
  219.       "required": [
  220.         "credentials"
  221.       ],
  222.       "properties": {
  223.         "credentials": {
  224.           "$ref": "#/definitions/Credentials"
  225.         },
  226.         "email": {
  227.           "type": "string",
  228.           "format": "email",
  229.           "description": "Email заемщика"
  230.         },
  231.         "inn": {
  232.           "type": "string",
  233.           "pattern": "^[\\d+]{10,12}$",
  234.           "example": "2833909919",
  235.           "description": "ИНН заемщика"
  236.         },
  237.         "phone": {
  238.           "type": "string",
  239.           "example": "+79222222222",
  240.           "description": "Контактный телефон"
  241.         },
  242.         "passport": {
  243.           "$ref": "#/definitions/Passport"
  244.         },
  245.         "requisites": {
  246.           "$ref": "#/definitions/Requisites"
  247.         },
  248.         "inner_id": {
  249.           "type": "string",
  250.           "example": "123456",
  251.           "description": "Внутренний id заёщика в системе Банка"
  252.         },
  253.         "loan": {
  254.           "$ref": "#/definitions/Loan"
  255.         },
  256.         "docs": {
  257.           "$ref": "#/definitions/Docs"
  258.         }
  259.       }
  260.     },
  261.     "Credentials": {
  262.       "type": "object",
  263.       "description": "ФИО заемщика",
  264.       "required": [
  265.         "first_name",
  266.         "second_name"
  267.       ],
  268.       "properties": {
  269.         "first_name": {
  270.           "type": "string",
  271.           "example": "Иванов",
  272.           "description": "Имя клиента"
  273.         },
  274.         "second_name": {
  275.           "type": "string",
  276.           "example": "Иван",
  277.           "description": "Фамилия клиента"
  278.         },
  279.         "last_name": {
  280.           "type": "string",
  281.           "example": "Иванович",
  282.           "description": "Отчество клиента"
  283.         }
  284.       }
  285.     },
  286.     "Passport": {
  287.       "type": "object",
  288.       "description": "Паспортные данные заемщика",
  289.       "required": [
  290.         "serial",
  291.         "number",
  292.         "issue_place",
  293.         "birthday_date",
  294.         "birthday_place"
  295.       ],
  296.       "properties": {
  297.         "serial": {
  298.           "type": "string",
  299.           "example": "1111",
  300.           "description": "Серия паспорта"
  301.         },
  302.         "number": {
  303.           "type": "string",
  304.           "example": "123456",
  305.           "description": "Номер паспорта"
  306.         },
  307.         "issue_place": {
  308.           "type": "string",
  309.           "example": "ОТДЕЛОМ УФМС РОССИИ Бла-Бла",
  310.           "description": "Место выдачи документа"
  311.         },
  312.         "issue_date": {
  313.           "type": "string",
  314.           "format": "date",
  315.           "example": "2012-10-09",
  316.           "description": "Дата выдачи документа"
  317.         },
  318.         "issue_place_code": {
  319.           "type": "string",
  320.           "example": "111",
  321.           "description": "Код подразделения"
  322.         },
  323.         "birthday_date": {
  324.           "type": "string",
  325.           "format": "date",
  326.           "example": "2012-10-09",
  327.           "description": "Дата рождения"
  328.         },
  329.         "birthday_place": {
  330.           "type": "string",
  331.           "example": "РОССИЯ, ГОР. Бла-Бла",
  332.           "description": "Место рождения"
  333.         },
  334.         "registration_address": {
  335.           "type": "string",
  336.           "example": "603105, РОССИЯ, Бла-Бла",
  337.           "description": "Адрес регистрации"
  338.         }
  339.       }
  340.     },
  341.     "Requisites": {
  342.       "type": "object",
  343.       "description": "Банковские реквизиты заемщика",
  344.       "required": [
  345.         "bik",
  346.         "account"
  347.       ],
  348.       "properties": {
  349.         "bik": {
  350.           "type": "string",
  351.           "example": "044525999",
  352.           "description": "БИК счета"
  353.         },
  354.         "account": {
  355.           "type": "string",
  356.           "example": "99999999999999999999",
  357.           "description": "Номер счета"
  358.         }
  359.       }
  360.     },
  361.     "Loan": {
  362.       "type": "object",
  363.       "description": "Займ",
  364.       "required": [
  365.         "type",
  366.         "sum"
  367.       ],
  368.       "properties": {
  369.         "type": {
  370.           "$ref": "#/definitions/LoanType"
  371.         },
  372.         "link": {
  373.           "type": "string",
  374.           "example": "http://zakupki.gov.ru/epz/contract/contractCard/common-info.html?reestrNumber=1246200396217000006",
  375.           "description": "Ссылка на госконтракт или закупку(если тип КИК, то ссылка на гк или закупку, где клиент стал победителем)"
  376.         },
  377.         "sum": {
  378.           "$ref": "#/definitions/Amount"
  379.         },
  380.         "period": {
  381.           "$ref": "#/definitions/Period"
  382.         }
  383.       }
  384.     },
  385.     "Period": {
  386.       "type": "object",
  387.       "description": "Период",
  388.       "required": [
  389.         "dateFrom",
  390.         "dateTill"
  391.       ],
  392.       "properties": {
  393.         "dateFrom": {
  394.           "type": "string",
  395.           "format": "date-time",
  396.           "example": "2012-10-09T00:00:00",
  397.           "description": "Дата с"
  398.         },
  399.         "dateTill": {
  400.           "type": "string",
  401.           "format": "date-time",
  402.           "example": "2012-11-09T00:00:00",
  403.           "description": "Дата по"
  404.         }
  405.       }
  406.     },
  407.     "Docs": {
  408.       "type": "object",
  409.       "description": "Документы",
  410.       "properties": {
  411.         "account_statement": {
  412.           "$ref": "#/definitions/AccountStatement"
  413.         },
  414.         "passport": {
  415.           "type": "array",
  416.           "items": {
  417.             "$ref": "#/definitions/FileObject"
  418.           }
  419.         }
  420.       }
  421.     },
  422.     "AccountStatement": {
  423.       "type": "object",
  424.       "description": "Выписка по всем счетам за последние 12 месяцев",
  425.       "properties": {
  426.         "operation": {
  427.           "type": "array",
  428.           "items": {
  429.             "$ref": "#/definitions/Operation"
  430.           }
  431.         }
  432.       }
  433.     },
  434.     "Operation": {
  435.       "type": "object",
  436.       "description": "Операции по выписке",
  437.       "properties": {
  438.         "date": {
  439.           "type": "string",
  440.           "format": "date",
  441.           "example": "2012-11-09",
  442.           "description": "Дата"
  443.         },
  444.         "account": {
  445.           "type": "string",
  446.           "example": "99999999999999999999",
  447.           "description": "Счёт"
  448.         },
  449.         "contractor_name": {
  450.           "type": "string",
  451.           "example": "ОАО «Рога и Копыта»",
  452.           "description": "Название контрагента"
  453.         },
  454.         "contractor_inn": {
  455.           "type": "string",
  456.           "example": "2833909919",
  457.           "description": "ИНН контрагента"
  458.         },
  459.         "write_off": {
  460.           "type": "string",
  461.           "example": "100.99",
  462.           "description": "Списание"
  463.         },
  464.         "admission": {
  465.           "type": "string",
  466.           "example": "100.99",
  467.           "description": "Зачисление"
  468.         },
  469.         "payment_puprose": {
  470.           "type": "string",
  471.           "example": "За оказание услуг № XXX",
  472.           "description": "Назначение платежа"
  473.         }
  474.       }
  475.     },
  476.     "FileObject": {
  477.       "type": "object",
  478.       "description": "Файл",
  479.       "properties": {
  480.         "name": {
  481.           "type": "string",
  482.           "example": "Скан_1",
  483.           "description": "Название файла"
  484.         },
  485.         "format": {
  486.           "type": "string",
  487.           "example": "jpg",
  488.           "description": "Формат файла"
  489.         },
  490.         "source": {
  491.           "type": "string",
  492.           "format": "byte",
  493.           "example": "U3dhZ2dlciByb2Nrcw==",
  494.           "description": "Содержимое файла"
  495.         }
  496.       }
  497.     },
  498.     "LoanCreateResponse200": {
  499.       "type": "object",
  500.       "description": "Заявка на займ успешно зарегистрирована",
  501.       "required": [
  502.         "loan_id",
  503.         "status"
  504.       ],
  505.       "properties": {
  506.         "loan_id": {
  507.           "$ref": "#/definitions/LoanId"
  508.         },
  509.         "status": {
  510.           "$ref": "#/definitions/Status"
  511.         }
  512.       }
  513.     },
  514.     "ErroResponse": {
  515.       "type": "object",
  516.       "description": "Отрицательный ответ",
  517.       "required": [
  518.         "code",
  519.         "message"
  520.       ],
  521.       "properties": {
  522.         "code": {
  523.           "type": "string",
  524.           "example": "Q-123",
  525.           "description": "Код ошибки"
  526.         },
  527.         "message": {
  528.           "type": "string",
  529.           "example": "Не корректное значение в поле xxx",
  530.           "description": "Описание ошибки"
  531.         }
  532.       }
  533.     },
  534.     "Status": {
  535.       "type": "string",
  536.       "description": "Статус заявки\n\n* in_analysis - На рассмотрении\n* rejected - Отказано\n* client_cancel - Отменена клиентом\n* accepted - Одобрена\n* in_progress - Подготовка займа\n* completed - Займ выдан\n",
  537.       "enum": [
  538.         "in_analysis",
  539.         "rejected",
  540.         "client_cancel",
  541.         "accepted",
  542.         "in_progress",
  543.         "completed"
  544.       ]
  545.     },
  546.     "LoanId": {
  547.       "type": "string",
  548.       "example": "11-23123",
  549.       "description": "Идентификатор заявки в системе партнера"
  550.     },
  551.     "LoanDetails": {
  552.       "type": "array",
  553.       "description": "Детали по заявкам",
  554.       "items": {
  555.         "type": "object",
  556.         "required": [
  557.           "code",
  558.           "message"
  559.         ],
  560.         "properties": {
  561.           "status": {
  562.             "$ref": "#/definitions/Status"
  563.           },
  564.           "loan_id": {
  565.             "$ref": "#/definitions/LoanId"
  566.           },
  567.           "created_at": {
  568.             "type": "string",
  569.             "format": "date-time",
  570.             "example": "2012-10-09T00:00:00",
  571.             "description": "Дата создания/регистрации заявки в системе партнера"
  572.           },
  573.           "change_at": {
  574.             "type": "string",
  575.             "format": "date-time",
  576.             "example": "2012-10-09T00:00:00",
  577.             "description": "Дата последнего изменения заявки в системе партнера"
  578.           }
  579.         }
  580.       }
  581.     },
  582.     "LoanType": {
  583.       "type": "string",
  584.       "description": "Тип займа.\n    \nВнимание: сейчас в системе реализованы займы только под участие, остальные типы сделаны с запасом на будущее\n\n* participate - Займ на участие\n* kik - Кредит на исполнение\n* express - Экспресс займы\n",
  585.       "enum": [
  586.         "participate",
  587.         "kik",
  588.         "express"
  589.       ]
  590.     },
  591.     "SettingsDetail": {
  592.       "type": "object",
  593.       "description": "Настройки займов",
  594.       "properties": {
  595.         "participate": {
  596.           "$ref": "#/definitions/Setting"
  597.         },
  598.         "kik": {
  599.           "$ref": "#/definitions/Setting"
  600.         },
  601.         "express": {
  602.           "$ref": "#/definitions/Setting"
  603.         }
  604.       }
  605.     },
  606.     "Setting": {
  607.       "type": "object",
  608.       "description": "Настройки\n\n* sum_min - Минимальная сумма\n* sum_max - Максимальная сумма\n",
  609.       "properties": {
  610.         "sum_min": {
  611.           "$ref": "#/definitions/Amount"
  612.         },
  613.         "sum_max": {
  614.           "$ref": "#/definitions/Amount"
  615.         },
  616.         "min_months": {
  617.           "type": "integer",
  618.           "example": 2,
  619.           "description": "Минимальное количество месяцев"
  620.         },
  621.         "max_months": {
  622.           "type": "integer",
  623.           "example": 100,
  624.           "description": "Максимальное количество месяцев"
  625.         },
  626.         "comission": {
  627.           "type": "string",
  628.           "example": "3.2",
  629.           "description": "Комиссия"
  630.         },
  631.         "min_commission": {
  632.           "type": "string",
  633.           "example": "1.2",
  634.           "description": "Минимальная комиссия"
  635.         }
  636.       }
  637.     },
  638.     "Amount": {
  639.       "type": "integer",
  640.       "example": 10010,
  641.       "description": "Сумма с копейками (для передачи целочисленного значения сумма умножается на 100). Например сумма 100.10. То значение будет 10010, 100.10 * 100 = 10010"
  642.     }
  643.   }
  644. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement