This application calculates repayment plan for an annuity loan. Therefore the amount that the borrower has to pay back every month, consist of principal and interest repayments, does not change (the last installment might be an exception).
- Make sure you have java 8(or higher version) installed on your systems
- Ensure Maven package manager wrapper(mvnw) is included in the project root directory
- Clean and Install
./mvnw clean install
- Ensure to go through "How to install?"
- Run test with Maven
./mvnw clean test
`java -jar target/generate-0.0.1-SNAPSHOT.jar`
URL: http://localhost:8080/generate-plan Content-Type: application/json
Request Payload:
{
"loanAmount": "5000",
"nominalRate": "5.0",
"duration": 24,
"startDate": "2018-01-01T00:00:01Z"
}
Response Expected:
[
{
"borrowerPaymentAmount": "219.36",
"date": "2018-01-01T00:00:01",
"initialOutstandingPrincipal": "5000",
"interest": "20.83",
"principal": "198.52",
"remainingOutstandingPrincipal": "4801.48"
},
{
"borrowerPaymentAmount": "219.36",
"date": "2018-02-01T00:00:01",
"initialOutstandingPrincipal": "4801.48",
"interest": "20.01",
"principal": "199.35",
"remainingOutstandingPrincipal": "4602.13"
},
...
{
"borrowerPaymentAmount": "219.36",
"date": "2019-12-01T00:00:01",
"initialOutstandingPrincipal": "218.47",
"interest": "0.91",
"principal": "218.45",
"remainingOutstandingPrincipal": "0.02"
}
]
Test Driven Development(TDD)
- Eclipse IDE
- Spring Tool Suit 4 (4.3.0 version) plugin
- Spring Boot
- JUnit for testing
- jackson library for object mapping (used only in test)