Package api.mpba.rastvdmy.service
Interface BankAccountService
- All Known Implementing Classes:
BankAccountServiceImpl
public interface BankAccountService
This interface represents the service for managing bank accounts.
-
Method Summary
Modifier and TypeMethodDescriptionaddAccount(jakarta.servlet.http.HttpServletRequest request, String bankName) Adds a new bank account for the user in the specified bank.voidconnectAccounts(BankIdentity bankIdentity) Connects a bank account to a user's bank identity.getAccountById(jakarta.servlet.http.HttpServletRequest request, String bankName, UUID accountId, String type) Retrieves a specific bank account by its ID.getTotalBalance(jakarta.servlet.http.HttpServletRequest request) Calculates the total balance for all bank accounts associated with the user.getUserAccounts(jakarta.servlet.http.HttpServletRequest request, String bankName) Retrieves a list of bank accounts associated with the specified bank for the user.voidremoveAccount(jakarta.servlet.http.HttpServletRequest request, String bankName, UUID accountId) Removes a specific bank account for the user.voidremoveAllAccounts(jakarta.servlet.http.HttpServletRequest request, String bankName) Removes all bank accounts associated with the specified bank for the user.
-
Method Details
-
getUserAccounts
Retrieves a list of bank accounts associated with the specified bank for the user.- Parameters:
request- the HTTP request containing user informationbankName- the name of the bank to filter accounts- Returns:
- a list of
BankAccountobjects associated with the user and specified bank
-
getAccountById
BankAccount getAccountById(jakarta.servlet.http.HttpServletRequest request, String bankName, UUID accountId, String type) Retrieves a specific bank account by its ID.- Parameters:
request- the HTTP request containing user informationbankName- the name of the bank to which the account belongsaccountId- the UUID of the account to retrievetype- the type of the bank account- Returns:
- the
BankAccountassociated with the given ID
-
getTotalBalance
Calculates the total balance for all bank accounts associated with the user.- Parameters:
request- the HTTP request containing user information- Returns:
- a map where the keys are bank names and the values are the total balances for each bank
-
addAccount
BankAccount addAccount(jakarta.servlet.http.HttpServletRequest request, String bankName) throws Exception Adds a new bank account for the user in the specified bank.- Parameters:
request- the HTTP request containing user informationbankName- the name of the bank where the account will be created- Returns:
- the newly created
BankAccount - Throws:
Exception- if an error occurs during the account creation process
-
connectAccounts
Connects a bank account to a user's bank identity.- Parameters:
bankIdentity- the bank identity object containing information to connect accounts- Throws:
Exception- if an error occurs during the account connection process
-
removeAccount
void removeAccount(jakarta.servlet.http.HttpServletRequest request, String bankName, UUID accountId) Removes a specific bank account for the user.- Parameters:
request- the HTTP request containing user informationbankName- the name of the bank from which the account will be removedaccountId- the UUID of the account to be removed
-
removeAllAccounts
Removes all bank accounts associated with the specified bank for the user.- Parameters:
request- the HTTP request containing user informationbankName- the name of the bank whose accounts will be removed
-