The Transaction Service is a microservice responsible for managing financial transactions, including creating, updating, retrieving, and deleting transactions. It supports transaction types such as deposit and withdrawal, and provides functionalities like fetching transactions by user ID and with pagination.
- Create a transaction
- Get a transaction by ID
- Get all transactions
- Update a transaction
- Delete a transaction
- Get transactions by user ID
- Get transactions with pagination
- Get balance by user ID
- Docker
- Docker Compose
- makefile
- Clone the repository:
git clone https://github.com/nullexp/finman-transaction-service
cd transaction-service
To run the service, use Docker Compose:
docker-compose up --build
This command will build the Docker images and start the containers defined in the docker-compose.yml
file.
The Transaction Service uses gRPC for communication. Below is the service definition for the gRPC API:
// TransactionService service definition
service TransactionService {
rpc CreateTransaction(CreateTransactionRequest) returns (CreateTransactionResponse);
rpc GetTransactionById(GetTransactionByIdRequest) returns (GetTransactionByIdResponse);
rpc GetTransactionsByUserId(GetTransactionsByUserIdRequest) returns (GetTransactionsByUserIdResponse);
rpc GetOwnTransactionById(GetOwnTransactionByIdRequest) returns (GetOwnTransactionByIdResponse);
rpc GetAllTransactions(GetAllTransactionsRequest) returns (GetAllTransactionsResponse);
rpc UpdateTransaction(UpdateTransactionRequest) returns (UpdateTransactionResponse);
rpc DeleteTransaction(DeleteTransactionRequest) returns (DeleteTransactionResponse);
rpc GetTransactionsWithPagination(GetTransactionsWithPaginationRequest) returns (GetTransactionsWithPaginationResponse);
}
-
CreateTransaction: This method takes a
CreateTransactionRequest
and returns aCreateTransactionResponse
. It is used to create a new transaction. -
GetTransactionById: This method takes a
GetTransactionByIdRequest
and returns aGetTransactionByIdResponse
. It is used to retrieve a transaction by its ID. -
GetTransactionsByUserId: This method takes a
GetTransactionsByUserIdRequest
and returns aGetTransactionsByUserIdResponse
. It is used to retrieve all transactions associated with a specific user ID. -
GetOwnTransactionById: This method takes a
GetOwnTransactionByIdRequest
and returns aGetOwnTransactionByIdResponse
. It is used to retrieve a transaction by its ID, ensuring the transaction belongs to the requesting user. -
GetAllTransactions: This method takes a
GetAllTransactionsRequest
and returns aGetAllTransactionsResponse
. It is used to retrieve all transactions. -
UpdateTransaction: This method takes an
UpdateTransactionRequest
and returns anUpdateTransactionResponse
. It is used to update an existing transaction. -
DeleteTransaction: This method takes a
DeleteTransactionRequest
and returns aDeleteTransactionResponse
. It is used to delete a transaction by its ID. -
GetTransactionsWithPagination: This method takes a
GetTransactionsWithPaginationRequest
and returns aGetTransactionsWithPaginationResponse
. It is used to retrieve transactions with pagination support.