The Transaction microservice is part of a banking system designed to handle financial transactions, such as deposits, withdrawals, transfers, and historical data, associated with customer accounts. This microservice utilizes a reactive programming approach with Spring WebFlux, integrates with MongoDB for storage. API documentation is available via Swagger/OpenAPI, and a Postman collection is provided for testing, as well as, unit tests with JUnit, Mockito. Code coverage is tracked with JaCoCo and code validation with Checkstyle.
- Technologies and Approaches
- UML Diagrams
- Postman
- Swagger/OpenAPI Documentation
- Code Quality and Coverage
- Spring Boot with WebFlux: Enables reactive and non-blocking programming to support high-throughput operations.
- MongoDB: Serves as the database for storing transaction data in a flexible, document-oriented format.
- OpenAPI/Swagger: Provides API documentation and supports easy testing of endpoints.
- Reactive Programming: Ensures non-blocking I/O operations and scalability.
- Postman: Used for testing endpoints via a pre-configured collection.
- JaCoCo-Checkstyle: To verify code covergae and best practices in code style.
The following UML diagrams detail the architecture and data flow of the Transaction Microservice:
-
Sequence Diagram: Illustrates the flow of operations for making a deposit and withdrawal transactions and communicating with the Account microservice.
-
Component Diagram: Represents the overall architecture of the Transaction Microservice and its interaction with MongoDB and other services.
A Postman collection is provided to test the Transaction microservice's endpoints. Follow these steps:
- Import the Collection: Download or clone the repository, then import the Postman collection file located in the
/postman
directory. - Import Environment Variables: import the environment variables into Postman and set them to run with the test collection.
- Run Tests: Once configured, you can execute requests to test each endpoint. The collection provides requests for creating, retrieving, updating, and deleting customer records.
The Swagger/OpenAPI documentation provides a detailed description of each endpoint, including parameters, request bodies, and response formats.
- Ensure the service is running locally (default:
http://localhost:8087
). - Open a browser and navigate to: http://localhost:8087/v1/swagger-ui.html
To maintain code quality and ensure adequate test coverage, the project uses Checkstyle for code analysis and JaCoCo for test coverage reports. Follow the steps below to run these tools:
- Open a terminal and navigate to the project directory.
- Run the following command to perform a Checkstyle analysis:
mvn checkstyle:check
- Review the output in the terminal for any code style violations. The results will also be saved in the target/reports/checkstyle.html file.
- In the terminal, run the tests with coverage analysis:
mvn clean test
- Open the generated report located at
target/site/jacoco/index.html
in your browser to review coverage details.