This project consists of three services: two REST APIs (data-api
and business-api
) and a Spring Boot project with a scheduled task (cron-app
). The project structure can be visualized using the following diagram:
The Data API provides CRUD operations for entities such as Payment, BankTransaction, and BankAccount.
BankAccount offers fully implemented CRUD operations at the service layer. It serves as a mock entity demonstrating money transfer operations after the creation of a new BankTransaction.
Payment represents an entity containing information necessary for creating BankTransactions. Upon creating a Payment, the first BankTransaction is automatically generated.
BankTransaction holds information about money transfers and is essential for identifying payments requiring new transactions. BankTransaction has two statuses: ACTIVE and CANCELED. Initially, upon successful creation, it assumes the ACTIVE status. When a BankTransaction is rolled back post a successful money transfer, its status changes to CANCELED. Insufficient funds prevent the creation or rollback of BankTransactions.
The Cron App periodically checks payments requiring new transactions and generates new transactions every minute.
Ensure you have docker-compose
installed and that the following ports are available: 5432, 8080, 8081, 5005-5007.
-
Clone the repository.
-
Create an
.env
file in the root directory:cp .env_sample .env
-
Run the project:
docker-compose up --build
To test the endpoints, you can import the Postman collection from this link.
Also, you can explore documentation for data-api by following link http://localhost:8080/swagger-ui/index.html#