Package com.bank.payment.services
Interface AccountService
- All Known Implementing Classes:
AccountServiceImp
public interface AccountService
Interface for AccountService that defines methods for handling account operations.
It includes methods for saving, finding, deleting accounts, and updating account balances.
- Since:
- 1.0.0
- Version:
- 1.0.0, 06/26/2025
- Author:
- Fernando Cruz Cavina
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deletes an AccountModel by its ID.Finds an AccountModel by its ID.findByPixKey
(String pixKey) Finds an AccountModel by its Pix key.save
(AccountModel accountModel) Saves an AccountModel to the database.updateBalanceReceive
(AccountModel accountModel) Updates the balance of the account receiving a payment.updateBalanceSender
(AccountModel accountModel) Updates the balance of the account sending a payment.
-
Method Details
-
save
Saves an AccountModel to the database.- Parameters:
accountModel
- the AccountModel to be saved- Returns:
- the saved AccountModel
-
findById
Finds an AccountModel by its ID.- Parameters:
idAccount
- the ID of the account to search for- Returns:
- an Optional containing the AccountModel if found, or empty if not found
-
findByPixKey
Finds an AccountModel by its Pix key.- Parameters:
pixKey
- the Pix key to search for- Returns:
- an Optional containing the AccountModel if found, or empty if not found
-
delete
Deletes an AccountModel by its ID.- Parameters:
idAccount
- the ID of the account to be deleted
-
updateBalanceReceive
Updates the balance of the account receiving a payment.- Parameters:
accountModel
- the AccountModel with updated balance information- Returns:
- the updated AccountModel
-
updateBalanceSender
Updates the balance of the account sending a payment.- Parameters:
accountModel
- the AccountModel with updated balance information- Returns:
- the updated AccountModel
-