Loaner is an online lending platform that provides short term soft loans to individuals. This helps solve problems of financial inclusion as a way to alleviate poverty and empower low income earners.
The application' UI template is on github pages here
- User (client) can sign up.
- Users can login.
- User can request for loan.
- User can view the loan repayment history
- Admin can mark a client as verified, after confirming his/her home and work address.
- Admin can view a specific loan application.
- Admin can approve or reject a client's loan application.
- Admin can post loan repayment transaction in favour of a client.
- Admin can view all loan applications.
- Admin can view all current loans (not fully repaid).
- Admin can view all repaid loans.
- User can reset password.
git clone https://github.com/anselemodims/loaner.git && cd loaner
npm install
Add a .env file to the root and declare the following environment variables:
-
SECRET_KEY: A jswebtoken secret to encrypt jsonwebtoken
-
ADMIN_PASSWORD: An Admin password to log the Admin in
npm start
This application is deployed on heroku with the following endpoints accessible
Method | Functionality | Endpoint |
---|---|---|
POST /auth/signup | Create a User account | api/v1/auth/signup |
POST /auth/login | Login a User | api/v1/auth/login |
PATCH /users/<user-email>/verify | Mark a user as verified | api/v1/users/:email/verify |
GET _/loans/<loan-id> | Get a specific loan application | api/v1/loans/:id |
GET /loans?status=approved&repaid=false | Get all current loans that are not fully repaid | api/v1/loans |
GET /loans?status=approved&repaid=true | Get all repaid loans | api/v1/loans |
GET /loans | Get all loans applications | api/v1/loans |
GET /loans/<laon-id>/repayments | View loan repayment history | api/v1/loans/:id/repayments |
POST /loans | Create a loan application | api/v1/loans |
PATCH /loans/<loan-id> | Approve or reject a loan application | api/v1/loans/:id |
POST /loans/<loan-id>/repayment | Create a loan repayment record. | api/v1/loans/:id/repayment |
GET /users | Get all Users | api/v1/users |
PUT /loans/<loan-id> | Update the repaid status of a client. | api/v1/loans/:id |
Response spec:
{
“status” : Integer ,
“data” : [ {
“token” : `45erkjherht45495783`,
“user” : {....} // the user object
} ]
}
Response spec:
{
“status” : Integer ,
“data” : [ {
“token” : `45erkjherht45495783`,
“user” : {....} // the user object
} ]
}
Response spec:
{
“status” : Integer ,
“data” : {
“email” : String ,
“firstName” : String ,
“lastName” : String ,
“password” : String ,
“address” : String ,
“status” : String ,
....
}
}
Response spec:
{
{
“status” : Integer ,
“data” : {
“id” : Integer ,
“user” : String ,
“createdOn” : DateTime ,
“status” : String ,
“repaid” : Boolean ,
“tenor” : Integer ,
“amount” : Float ,
“paymentInstallment” : Float ,
“balance” : Float ,
“interest” : Float ,
....
}
}
Response spec:
{
{
“status” : Integer ,
“data” : [
{
“id” : Integer ,
“user” : String ,
“createdOn” : DateTime ,
“status” : String ,
“repaid” : Boolean ,
“tenor” : Integer ,
“amount” : Float ,
“paymentInstallment” : Float ,
“balance” : Float ,
“interest” : Float ,
....
},
{
“id” : Integer ,
“user” : String ,
“createdOn” : DateTime ,
“status” : String ,
“repaid” : Boolean ,
“tenor” : Integer ,
“amount” : Float ,
“paymentInstallment” : Float ,
“balance” : Float ,
“interest” : Float ,
....
}
]
}
Response spec:
{
{
“status” : Integer ,
“data” : [
{
“id” : Integer ,
“user” : String ,
“createdOn” : DateTime ,
“status” : String ,
“repaid” : Boolean ,
“tenor” : Integer ,
“amount” : Float ,
“paymentInstallment” : Float ,
“balance” : Float ,
“interest” : Float ,
....
},
{
“id” : Integer ,
“user” : String ,
“createdOn” : DateTime ,
“status” : String ,
“repaid” : Boolean ,
“tenor” : Integer ,
“amount” : Float ,
“paymentInstallment” : Float ,
“balance” : Float ,
“interest” : Float ,
....
}
]
}
Response spec:
{
{
“status” : Integer ,
“data” : [
{
“id” : Integer ,
“user” : String ,
“createdOn” : DateTime ,
“status” : String ,
“repaid” : Boolean ,
“tenor” : Integer ,
“amount” : Float ,
“paymentInstallment” : Float ,
“balance” : Float ,
“interest” : Float ,
....
},
{
“id” : Integer ,
“user” : String ,
“createdOn” : DateTime ,
“status” : String ,
“repaid” : Boolean ,
“tenor” : Integer ,
“amount” : Float ,
“paymentInstallment” : Float ,
“balance” : Float ,
“interest” : Float ,
....
}
{
“id” : Integer ,
“user” : String ,
“createdOn” : DateTime ,
“status” : String ,
“repaid” : Boolean ,
“tenor” : Integer ,
“amount” : Float ,
“paymentInstallment” : Float ,
“balance” : Float ,
“interest” : Float ,
....
}
]
}
Response spec:
{
“status” : Integer ,
“data” : {
“loanId” : Integer ,
“createdOn” : Date ,
“monthlyInstallment” : Float , // what the user is expected to pay
“amount” : Float ,
....
}
}
Response spec:
{
“status” : Integer ,
“data” : {
“loanId” : Number ,
“firstName” : String ,
“lastName” : String ,
“email” : String ,
“tenor” : String ,
“amount” : Float ,
“paymentInstallment” : Float ,
“status” : String ,
“balance” : Float ,
“interest” : Float ,
....
}
}
Response spec:
{
“status” : Integer ,
“data” : {
“loanId” : Integer ,
“loanAmount” : Float ,
“tenor” : Integer ,
“status” : String , // approved or rejected
“monthlyInstallment” : Float ,
“interest” : Float ,
}
}
Response spec:
{
“status” : Integer ,
“data” : {
“loanId” : Integer ,
“createdOn” : DateTime ,
“amount” : Float , // loan amount
“monthlyInstallment” : Float , // what the user is expected to pay
“paidAmount” : Float ,
“balance” : Float ,
....
}
Note:
As at the time of writing this, the application is still in development and the following commands might not behave as expected. This docs will be updated as soon as the application can be installed.
If the project has been cloned and navigated into as specified above, you can run tests...
If you do not have POSTMAN installed, download here
-
In the terminal start the application with
npm start
-
On POSTMAN navigate to
localhost:3000/
and use the documentation above as guide to access the endpoints.
If you do not have mocha installed, you can install using npm with:
npm -i mocha -g
then you can run tests with:
npm test