A Spring Boot application that allows customers and admins to manage loans, track payments, and apply discounts/penalties based on payment timing.
- Admin Features: Create loans for any customer, view all loans, and process payments.
- Customer Features: View their loans, pay installments, and track outstanding balances.
- Loan Payments: Apply early payment discounts and late payment penalties.
- Security: JWT-based authentication with role-based access control.
- Java 23
- Spring Boot 3
- Spring Security (JWT)
- Spring Data JPA (H2 Database - In-Memory)
- Gradle
- JUnit & Mockito (for testing)
Before running the application, make sure you have:
- Java 23 installed → Download Java
- Gradle installed → Install Gradle
- Postman (Optional) for API testing → Download Postman
git clone https://github.com/capraztarik/loan.git
cd loan-management./gradlew clean build./gradlew bootRunSince we are using an H2 in-memory database, you can access the database console in your browser:
Open: http://localhost:8080/h2-console
Use the following credentials:
JDBC URL: jdbc:h2:mem:testdb
Username: sa
Password: passwordAuthentication
Method Endpoint Description
POST /auth/register Register a new user (Admin/Customer)
POST /auth/login Authenticate and get JWT token
Loan Management
Method Endpoint Description
POST /loans/create Create a new loan (Admin/Customer)
GET /loans/customer/{customerId} Get loans for a customer
POST /installments/pay Pay installments
GET /installments/loan/{loanId} Get installments of a loanRun All Tests
./gradlew test
With report: ./gradlew clean test jacocoTestReport
You can find coverage report: build/reports/jacoco/test/html/index.html