The main objective of this project is to create an API to manage the loan payments control system from a fintech.
The purpose of this challenge is to test your ability to implement a solution given an abstract problem. You may find a problem in the asked task that you need to explain the problem and propose a solution to fix it.
A fintech needs to keep track of the amount of money loaned and the missed/made payments. It also needs a place to retrieve the volume of outstanding debt at some point in time.
Loans are paid back in monthly installments.
pipenv install
python manage.py makemigrations --settings=config.settings.dev
python manage.py migrate --settings=config.settings.dev
python manage.py test --settings=config.settings.dev
python manage.py runserver --settings=config.settings.dev
- Documentatin:
/swagger/
- Admin:
/admin/
- Get JWT token:
/api/token/
- Refresh JWT token:
/api/token/refresh/
- All clients:
/clients/
- Client by id:
/client/{client_id}/
- All loans:
/loans/
- Balance by client id:
/loans/{loan_id}/balance/
- Payments by client id:
/loans/{loan_id}/payments/
Create a record of a client
- client_id:
- name:
- surname:
- email:
- telephone:
- cpf:
{
"client_id": 1,
'name': 'Nome',
'surname': 'Sobrenome',
'email': '[email protected]',
'telephone': '6533245152',
'cpf': '85478999988'
}
List client id
{
"client_id": 1,
}
{
"client_id": 1,
'name': 'Nome',
'surname': 'Sobrenome',
'email': '[email protected]',
'telephone': '6533245152',
'cpf': '85478999988'
}
Create a loan application. Loans are automatically accepted.
- amount: loan amount in dollars.
- term: number of months that will take until the loan gets paid-off.
- rate: interest rate as decimal.
- date: when the loan was requested (origination date as an ISO 8601 string).
{
"amount": 1000,
"term": 12,
"rate": 0.05,
"date": "2019-05-09 03:18Z"
}
- loan_id: unique id of the loan.
- installment: monthly loan payment.
{
"loan_id": "000-0000-0000-0000"
"installment": 85.60
}
Loan payment formula
r = rate / 12
installment = [r + r / ((1 + r) ^ term - 1)] x amount
For repaying a loan of $1000 at 5% interest for 12 months, the equation would be:
installment = [(0.05 / 12) + (0.05 / 12) / ((1 + (0.05 / 12)) ^ 12 - 1] x 1000
installment = 85.60
Create a record of a payment made or missed.
- payment_choice: type of payment: made or missed.
- date: payment date.
- amount: amount of the payment made or missed in dollars.
{
"payment_choice": "made",
"date": "2019-05-07 04:18Z",
"amount": 85.60
}
{
"payment_choice": "missed",
"date": "2019-05-07 04:18Z",
"amount": 85.60
}
Get the volume of outstanding debt (i.e., debt yet to be paid) at some point in time.
- date: loan balance until this date.
{
"date": "2017-09-05 02:18Z"
}
- balance: outstanding debt of loan.
{
"balance": 40
}