Skip to content

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.

Notifications You must be signed in to change notification settings

AnselemOdims/Loaner

Repository files navigation

Loaner

npm version Build Status Coverage Status Maintainability License: MIT

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

Implemented Features

  • 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.

Technologies to be Used


Installation

Clone this repository and navigate into it.

git clone https://github.com/anselemodims/loaner.git && cd loaner

Install dependencies.

npm install

Add Neccessary Environment Variables

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

Start the application.

npm start


Documentation

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 Specifications

POST /auth/signup

Response spec:

{
  “status” : Integer ,
  “data” : [ {
    “token” : `45erkjherht45495783`,
    “user” : {....} // the user object
  } ]
}

POST /auth/login

Response spec:

{
  “status” : Integer ,
  “data” : [ {
    “token” : `45erkjherht45495783`,
    “user” : {....} // the user object
  } ]
}

GET /users/<user-email>/verify

Response spec:

{
  “status” : Integer ,
  “data” : {
    “email” : String ,
    “firstName” : String ,
    “lastName” : String ,
    “password” : String ,
    “address” : String ,
    “status” : String ,
    ....
  } 
}

GET /loans/<loan-id>_

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 ,
        ....
      } 
}

GET /loans?status=approved&repaid=false

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 ,
        ....
    }
  ] 
}

GET /loans?status=approved&repaid=true

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 ,
        ....
    }
  ] 
}

GET /loans

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 ,
        ....
    }
  ] 
}

GET /loans/<loan-id>/repayments

Response spec:

{
  “status” : Integer ,
  “data” : {
    “loanId” : Integer ,
    “createdOn” : Date ,
    “monthlyInstallment” : Float , // what the user is expected to pay
    “amount” : Float ,
    ....
  }
}

POST /loans/

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 ,
    ....
  }
}

PATCH /loans/<loan-id>

Response spec:

{
  “status” : Integer ,
  “data” : {
    “loanId” : Integer ,
    “loanAmount” : Float ,
    “tenor” : Integer ,
    “status” : String , // approved or rejected
    “monthlyInstallment” : Float ,
    “interest” : Float ,
  }
}

POST /loans/<loan-id>/repayment

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 ,
    ....
}

Testing the Application Locally

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...

Using POSTMAN

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.

Using MOCHA

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


Acknowledgements

Andela


Author

Anselem Odimegwu

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published