It is an app that allows authenticated users to go through a loan application. Users can request loans, view their loans and pay instalments. User will be allocated loan once it is approved by admin.
Loan has 3 type of status:
- PENDING - when the loan is created
- APPROVED - when the loan is approved by admin
- PAID - once all instalments are PAID
Loan instalment has 2 type of status:
- PENDING - when payment of instalment is PENDING
- PAID - when instalment is paid
Assumption:
- Interest is 0%.
- Instalment frequency is Weekly.
- There is only one type of loan.
RBAC
- Register user: A new user will be registered with role either ADMIN or USER.
- Authenticate: An api to authenticate user
- User can access APIs only after they are authenticated and if they have required authority to access API.
Loan Service APIs
- GET /api/v1/loan/fetchAll - to get all loans of a authenticated user.
- POST /api/v1/loan/create - create a new loan. Request by user.
- PUT /api/v1/loan/approve - api for admin to approve loan.
- POST /api/v1/loan/instalment - pay loan instalment.
Prerequisite
- java 17
- mysql
Setup:
- Add values for following fields in application.properties
- spring.datasource.url
- spring.datasource.username
- spring.datasource.password
- application.security.jwt.secret-key=
- mvn compile
- mvn spring-boot:run