Used car loan for 1 minute
Instead of introducing
Like all interesting stories, this one started long enough and unexpectedly. One day our partner bank came to us and said: “Guys, we learned how to score in our system in one minute. How about combining our efforts and integrating projects? With us - a solution and a loan, with you - cars. ” To say that we were inspired - to say nothing! We had every chance of becoming the first one in the world who can give a loan online for a used car in one minute (ONE MINUTE, KARL)! Below, I will tell you what came out of it, but for a start I will tell you who we are.
We are “Wheels | Roof | Market ”is the largest IT-company based in Kazakhstan. Every day, our products help six million Kazakhstanis to buy and sell cars, apartments, cribs and thousands of other things. Kolesa.kz is the largest auto resource and application, not the first year it takes the 1st place in the mobile rating of Kazakhstan.
What is the project "Car loan"?
At the moment, the base of used cars is 103,400 cars, more than 60% of them are available on credit!
1. Choose the car you want to borrow
Figure 1. Search engine lending available
2. На странице объявления видим форму для подачи заявки на кредит
Рисунок 2. Экран страницы объявления
3. Выбираем период и первоначальный взнос и нажимаем получить одобрение
Рисунок 3. Кредитный калькулятор для объявления
4. Попадаем на форму, где нам нужно ввести свои контактные данные
Рисунок 4. Форма инициализации заявки на кредит
Сюда вводим ваш номер мобильного телефона Имя и ИИН (в России это был бы ИНН)
5. Далее вам необходимо ввести код СМС который придёт на указанный вами номер
Рисунок 5. Форма подтверждения номера телефона путём ввода смс
6. После этого начинается сам процесс скоринга, который длится не более 1 минуты
Рисунок 6. Экран процесса скоринга заявки
7. Есть несколько вариантов результата скоринга:
- Вам одобряют кредит
- Вам отказывают в получении кредита
- Вам предлагают альтернативные условия
- У вас запрашивают дополнительную информацию, после предоставления которой вы получаете один из предыдущих вариантов (а, б, в)
Рисунок 7. Пример экрана одобрения Автокредита
После того как человек получает одобрение своей заявки, ему в течение 10 минут перезванивает менеджер из банка и информирует человека о том, какие действия ему нужно произвести далее, для того чтобы оформить кредит. Удобно, не правда ли? Давайте посмотрим как это всё было реализовано.
Do you remember how it all started…
It was the first time and again! If earlier, as a credit form, we simply had a feedback form, then our new idea was something completely new and incomprehensible. Because We had no analogues, we had to have a very exciting activity - to plan, design, distribute and implement. To begin with, we broke up the whole process of our joint integration into 2 blocks, which were carried out in parallel, namely:
- Infrastructure integration
Initially, we agreed with a partner bank that he (the partner bank) will provide us with some kind of API, to which we will send some data and receive some answers. On that and decided. We began to wait for the API documentation from the bank, brought our engineers and their network engineers together! In terms of software integration, a fairly simple scheme emerged, we send the data to the bank, the bank scrolls through it in its system, and returns it to us, and all this within the guaranteed 60 seconds. In case of a timeout (where without it), we agreed to display an emergency questionnaire in which we collect data that the bank may additionally need.
At that time, while the developers chose the tools for implementation, designed their system and waited for the documentation on the partner system, in the infrastructure department the work was already in full swing! We had two partners with our partner bank: 2 adjacent tsiski in one DC, cable connecting tsiski, VPN tunnel, safety certificates and access to work with them of all colors and sizes ... The plan was next, We pass through an encrypted VPN channel between our servers, and build direct integration between our services. It can be schematically depicted as:
Let's talk about the code
Below we will talk about how and what is arranged by our service. So, having received a document describing the partner's service ready for integration, we learned that, unlike us, the bank works only with SOAP requests, and does not want to hear about any RESTful services. And since in our services we use SOAP a little less than never, we had many wonderful discoveries about how to learn how to prepare SOAP in our new product. Therefore, we needed to teach our service how to parse SOAP requests and convert our responses back to SOAP.
Choosing a framework
To begin with, it was necessary to choose at least an implementation language, there were a lot of ideas, starting with C and C # ending with golang and erlang. We decided to go on a simple path. The system will need to be maintained, and in order not to run into the bus factor with the lack of specialists in the market, we decided to focus on the most common technology in our company - PHP. Thank God that the window was no longer 2001, and the year 2017 and php frameworks are so numerous that they can satisfy the needs of even very sophisticated engineers. After going through a whole bunch, we chose one of the simplest and at the same time supported - Yii 2.
For this decision was:
- Easy to master, a whole bunch of literature;
- It is easy enough to build forms and validators;
- There is an Active Record and a car ready to work with all sorts of tools;
- He really is fast;
- At its base, the API is simply built, it is convenient to write console commands.
It was against:
- The framework is built on static methods - this is very inconvenient, including when writing tests
- It was not entirely clear what additional tools we would need in the near future after launch, and, as a result, there was a risk of not finding the necessary libraries ...
The framework has been chosen; now it is time to choose a repository for applications. There were several options, MySQL, mongoDB, postgreSQL ... On the one hand, the application is a document, for sure its structure can change, from time to time supplemented with new fields and getting rid of irrelevant ones. On the other hand, the use of non-relational databases will impose its limitations. After weighing all the pros and cons, we decided to sit on 2 chairs and start using MySQL, and after starting migrate to the mongoDB + ElasticSearch bundle. As a result, 2 MySQL replicas were raised as storage and bolted to the application using ActiveRecord. By the time we started the transition to mongoDB, the amount of data has grown tremendously and has taken such a growth rate that there is another need to separate requests for conditional storage.
We build infrastructure
The infrastructure decided to do the following: 10 backends with an application request handler, 2 balancers, 2 MySQL replicas, 3 elasticsearch shards, 3 mongoDB replicas and 2 monstache replicas of the service.
In general, the process of car loans can be divided into 2 parts:
- To get started, you need to find a suitable car, available on credit. Most likely you will be guided by its condition and credit conditions.
- After you select a car, you need to get a loan approval, for this you will need to fill out an application
We have more or less told about the implementation of the second part, we will talk about the implementation of the first part. The implementation of the first part consists of several parts:
- When searching for a car, a person should be able to focus, in addition to technical parameters, on the availability of a car for purchase on credit and on the minimum monthly payment. To do this, we need to know at the time of the announcement of the announcement whether the car is available on credit and what will be the minimum payment for it.
- After a person chooses a car, we need to provide him with a loan calculator, where he could choose the size of the down payment and the loan period, thereby picking up the most comfortable monthly payment.
For this purpose, a special microservice in the go language was developed. Its essence was as follows: When submitting an advertisement, an object is sent to microservice with all the data for the car, microservice, based on the rules that are written separately for it, returns the minimum monthly payment for indexation in the search, and also returns the minimum initial payment and admissible terms credits that form the basis for building a loan calculator.
We pre-cache the miscalculation options for the standard values of the initial payment and the monthly payment. This is done for each of the available credit periods. If a person changes the initial payment (within the limits of the allowable), then microservice will again calculate all the data. If the initial payment is specified less than the allowable, the calculator will display a validation error.
Due to the high load on our service, the loan calculator has 2 degrees of caching: the first occurs on the back end, where the customers initially go for the calculator, the second in microservice itself.
So what is the result?
We launched the project on September 11, 2017. Since then, on today's date (12/04/2018) 2,973,868 applications have been submitted. We are in a continuous process of improving our service and simplifying the user path. Making it faster easier and more stable! Uptime of the project for the entire period since launch was 99.99%.
As a result, we have the following results:
- Significantly shortened user path
- Expanded the volume of cars available for lending to 60% of the entire base
- To date, the number of applications has increased by more than 7 times!
Instead of conclusion
For 3 months we managed to build a truly amazing and unique project. Its main goal was to give our customers the opportunity to purchase used cars without leaving our platform. In just 1 minute, the user can get a decision on his request, call the seller, and arrange all the necessary documents on the same day.
Judging by the number of applications per year and 2 months, we can conclude that we manage to make the service really convenient and in demand.