Class TransactionServiceImpl
java.lang.Object
org.training.transactions.service.implementation.TransactionServiceImpl
- All Implemented Interfaces:
TransactionService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddTransaction(TransactionDto transactionDto) Adds a transaction based on the provided TransactionDto.getTransaction(String accountId) Retrieves a list of transaction requests for a given account ID.getTransactionByTransactionReference(String transactionReference) Retrieves a list of TransactionRequests based on a transaction reference.internalTransaction(List<TransactionDto> transactionDtos, String transactionReference) Completes the internal transaction by updating the status of each transaction and saving them to the transaction repository.
-
Constructor Details
-
TransactionServiceImpl
public TransactionServiceImpl()
-
-
Method Details
-
addTransaction
Adds a transaction based on the provided TransactionDto.- Specified by:
addTransactionin interfaceTransactionService- Parameters:
transactionDto- the TransactionDto object containing the transaction details- Returns:
- a Response object indicating the success of the transaction
- Throws:
ResourceNotFound- if the requested account is not found on the serverAccountStatusException- if the account is inactive or closedInsufficientBalance- if there is insufficient balance in the account
-
internalTransaction
public Response internalTransaction(List<TransactionDto> transactionDtos, String transactionReference) Completes the internal transaction by updating the status of each transaction and saving them to the transaction repository.- Specified by:
internalTransactionin interfaceTransactionService- Parameters:
transactionDtos- the list of transaction DTOs to be processedtransactionReference- The transaction reference.- Returns:
- a response indicating the completion of the transaction
-
getTransaction
Retrieves a list of transaction requests for a given account ID.- Specified by:
getTransactionin interfaceTransactionService- Parameters:
accountId- the ID of the account- Returns:
- a list of transaction requests
-
getTransactionByTransactionReference
Retrieves a list of TransactionRequests based on a transaction reference.- Specified by:
getTransactionByTransactionReferencein interfaceTransactionService- Parameters:
transactionReference- The reference ID of the transaction- Returns:
- List of TransactionRequests matching the transaction reference
-