This project is a Java-based loan service application.
Follow these steps to run the project:
-
Prerequisites
- Install Java 11
java -version openjdk version "11.0.20.1" 2023-08-24 OpenJDK Runtime Environment (build 11.0.20.1+1-post-Ubuntu-0ubuntu122.04) OpenJDK 64-Bit Server VM (build 11.0.20.1+1-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)
- Install Maven
mvn -version Apache Maven 3.6.3 Maven home: /usr/share/maven Java version: 11.0.20.1, vendor: Ubuntu, runtime: /usr/lib/jvm/java-11-openjdk-amd64 Default locale: en_IN, platform encoding: UTF-8 OS name: "linux", version: "6.2.0-34-generic", arch: "amd64", family: "unix"
-
Steps to run loan service application:
git clone https://github.com/tarunjainsagar/LoanService.git cd LoanService mvn clean package java -jar target/loan-0.0.1-SNAPSHOT.jar
-
Sample Api Calls:
- Fee Projections Api Request
curl -X POST -H "Content-Type: application/json" -d '{ "amount": 3000, "duration": 3, "startDate": "2023-11-01", "durationType": "WEEKLY", "installmentFrequency": "WEEKLY", "showDetails": true }' http://localhost:8080/loan/feeProjections
- Installment Projections Api Request
curl -X POST -H "Content-Type: application/json" -d '{ "amount": 3000, "duration": 3, "startDate": "2023-11-01", "durationType": "WEEKLY", "installmentFrequency": "WEEKLY", "showDetails": true }' http://localhost:8080/loan/feeProjections
- View Query/Request History Request
curl -X GET "http://localhost:8080/loan/getQueryHistory?fromDate=2023-10-18&toDate=2023-10-18"
-
Sample Responses:
- Fee Projections Api Response
{ "status": "200", "message": "Success", "data": { "actual_loan_amount": 3000, "no_of_installments": 3, "durationType": "WEEKLY", "installmentFrequency": "WEEKLY", "Projections": [ { "date": "2023-11-01", "amount": 30.0, "remark": "Interest: 30.0, Service Fees: 0.0" }, { "date": "2023-11-08", "amount": 45.0, "remark": "Interest: 30.0, Service Fees: 15.0" }, { "date": "2023-11-15", "amount": 30.0, "remark": "Interest: 30.0, Service Fees: 0.0" } ], "projections_type": "/feeProjections" } }
- Installment Projections Api Response
{ "status": "200", "message": "Success", "data": { "actual_loan_amount": 3000, "no_of_installments": 3, "durationType": "WEEKLY", "installmentFrequency": "WEEKLY", "Projections": [ { "date": "2023-11-01", "amount": 1030.0, "remark": "Interest: 30.0, Service Fees: 0.0, Principal Installment: 1000" }, { "date": "2023-11-08", "amount": 1045.0, "remark": "Interest: 30.0, Service Fees: 15.0, Principal Installment: 1000" }, { "date": "2023-11-15", "amount": 1030.0, "remark": "Interest: 30.0, Service Fees: 0.0, Principal Installment: 1000" } ], "projections_type": "/installmentProjections" } }
-
API Documentation
Available Endpoints:
HTTP Method: POST
Content-Type: application/json
Request Body
The request body should be in JSON format and include the following parameters:
amount (integer, required): The loan amount.
duration (integer, required): The loan duration in terms of the selected durationType.
startDate (string, required): The start date of the loan in 'yyyy-MM-dd' format.
durationType (string, required): The type of duration (e.g., "WEEKLY" or "MONTHLY").
installmentFrequency (string, required): The frequency of installments (e.g., "WEEKLY" or "MONTHLY").
showDetails (boolean, optional): Set to true if you want to include details in the response.