An annuity loan is a type of loan an annuity holder borrows money against the cash value of the annuity contract.
The project implements a repayment plan calculator for an annuity loan which comprises of the amount that the borrower has to pay back every month along with the principal and interest repayments, based on the formula:
In order to compile the project, you'll require JDK 8 and Maven build tool to be installed and configured on your PC. The project can be compiled and the required artifacts can be generated by running the command:
mvn clean install
The spring-boot application can be executed using the maven spring-boot plugin by running the following command:
mvn spring-boot:run -Dserver.port=8080
This will setup a tomcat web-server on your localhost to listen on the specified port, in this case 8080.
POST /loans/annuity/plan
Example Request Body:
{
"loanAmount": "5000",
"nominalRate": "5.0",
"duration": 24,
"startDate": "2018-01-01T00:00:01Z"
}
Example Response:
{
"repayments": [
{
"borrowerPaymentAmount": 219.36,
"date": "2018-01-01T00:00:01",
"initialOutstandingPrincipal": 5000,
"interest": 20.83,
"principal": 198.53,
"remainingOutstandingPrincipal": 4801.47
},
{
"borrowerPaymentAmount": 219.36,
"date": "2018-02-01T00:00:01",
"initialOutstandingPrincipal": 4801.47,
"interest": 20.01,
"principal": 199.35,
"remainingOutstandingPrincipal": 4602.12
},
...
{
"borrowerPaymentAmount": 219.28,
"date": "2019-12-01T00:00:01",
"initialOutstandingPrincipal": 218.37,
"interest": 0.91,
"principal": 218.37,
"remainingOutstandingPrincipal": 0
}
]
}
For further reference, please consider the following sections: