This is a Spring Boot application designed to manage beneficiaries, accounts, and transactions. It provides REST APIs to retrieve beneficiary information, account details, transactions, balances, and more. The system reads data from CSV files and exposes it through a RESTful API.
- Java 17: The primary programming language used for development.
- Spring Boot: Framework for building the RESTful APIs and managing dependencies.
- Lombok: Library for reducing boilerplate code (e.g., getters, setters, constructors).
- OpenCSV: Library for reading and parsing CSV files.
- JUnit 5: Framework for writing and running unit tests.
- Mockito: Library for mocking dependencies in unit tests.
- Maven: Build automation tool used for dependency management and project building.
- Java 17: Ensure you have Java 17 installed.
- Maven: Ensure you have Maven installed.
- Clone the repository:
git clone https://github.com/your-username/account-management.git
- Navigate to the project directory:
cd account-management - Build the project using Maven:
mvn clean install
This project includes Swagger UI for easy API exploration.
- Start the application:
mvn spring-boot:run
- Open your browser and navigate to:
http://localhost:8080/swagger-ui/index.html
The following REST APIs are available:
- Endpoint:
GET /api/beneficiaries/{beneficiaryId} - Description: Retrieve details of a beneficiary by ID.
- Example Response:
{ "beneficiaryId": "1", "firstName": "John", "lastName": "Doe" }
- Endpoint:
GET /api/beneficiaries/{beneficiaryId}/accounts - Description: Retrieve all accounts associated with a beneficiary.
- Example Response:
[ { "accountId": "1", "beneficiaryId": "1" }, { "accountId": "2", "beneficiaryId": "1" } ]
- Endpoint:
GET /api/beneficiaries/{beneficiaryId}/transactions - Description: Retrieve all transactions for a beneficiary.
- Example Response:
[ { "transactionId": "2323", "accountId": "1316", "amount": 441.4, "type": "WITHDRAWAL", "date": "07/12/23" }, { "transactionId": "2390", "accountId": "1316", "amount": 109, "type": "DEPOSIT", "date": "06/05/23" } ]
- Endpoint:
GET /api/beneficiaries/{beneficiaryId}/balance - Description: Retrieve the balances for each account of a beneficiary and the total balance of all the accoutns.
- Example Response:
{ "accountBalance": [ { "accountId": "786", "balance": -1069.4 }, { "accountId": "351", "balance": -785 } ], "totalBalance": -1854.4 }
- Endpoint:
GET /api/beneficiaries/{beneficiaryId}/transactions/maxWithdrawalLastMonth - Description: Retrieve the maximum withdrawal amount for a beneficiary in the last month.
- Example Response:
{ "maxWithdraw": 137.4, "date": "01/29/25" }
- Navigate to the project directory:
cd account-management - Run the application using Maven:
mvn spring-boot:run
- The application will start on port
8080. You can access the APIs at:http://localhost:8080/{endpoint} - To verify that the application is running, open your browser or use a tool like
curlor Postman and navigate to:http://localhost:8080/api/beneficiaries/1
The project includes unit tests for all major components, including services and controllers. To run the unit tests, use the following command:
mvn test