Skip to content

EllyanF/loans-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loans-api

API to check which types of loans a person has access to based on their information.

Rules

  • Grant the personal loan if the client's salary is equal to or less than R$3000.
  • Grant the personal loan if the client's salary is between R$3000 and R$5000, if the client is under 30 years old and lives in São Paulo (SP).
  • Grant the consignment loan if the client' salary is equal to or higher than R$5000
  • Grant the loan with guarantee if the client's salary is equal to or less than R$3000.
  • Grant the loan with guarantee if the client's salary is between R$3000 and R$5000, if the client is under 30 years old and resides in São Paulo (SP).

Request Example

{
  "age": 26,
  "cpf": "275.484.389-23",
  "name": "Vuxaywua Zukiagou",
  "income": 7000.00,
  "location": "SP"
}

Example response

HTTP/1.1 200 Ok
{
  "customer": "Vuxaywua Zukiagou",
  "loans": [
    {
      "type": "PERSONAL",
      "interest_rate": 4
    },
    {
      "type": "GUARANTEED",
      "interest_rate": 3
    },
    {
      "type": "CONSIGNMENT",
      "interest_rate": 2
    }
  ]
}

Endpoints

Customer Loans

  • POST {host}/customer-loans
  • Request body parameters: age: number, cpf: string, name: string, income: number, location: string.
  • Responses
    • 200 OK: Returns json with the available loans for that person, example:
    • 400 Bad Request if body parameters fails validation

How to Run

  1. Install dependencies using:
    npm install
  2. Use the following command to build the dist folder:
    npm run build
  3. Start the server using the following command:
    npm run start:dev
The application will be available by default at http:https://localhost:3000/customer-loans

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published