Package com.bank.payment.services.impl
Class AccountServiceImp
java.lang.Object
com.bank.payment.services.impl.AccountServiceImp
- All Implemented Interfaces:
AccountService
-
Constructor Summary
Constructors -
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.
-
Constructor Details
-
AccountServiceImp
public AccountServiceImp()
-
-
Method Details
-
save
Description copied from interface:AccountService
Saves an AccountModel to the database.- Specified by:
save
in interfaceAccountService
- Parameters:
accountModel
- the AccountModel to be saved- Returns:
- the saved AccountModel
-
findById
Description copied from interface:AccountService
Finds an AccountModel by its ID.- Specified by:
findById
in interfaceAccountService
- Parameters:
idAccount
- the ID of the account to search for- Returns:
- an Optional containing the AccountModel if found, or empty if not found
-
findByPixKey
Description copied from interface:AccountService
Finds an AccountModel by its Pix key.- Specified by:
findByPixKey
in interfaceAccountService
- Parameters:
pixKey
- the Pix key to search for- Returns:
- an Optional containing the AccountModel if found, or empty if not found
-
delete
Description copied from interface:AccountService
Deletes an AccountModel by its ID.- Specified by:
delete
in interfaceAccountService
- Parameters:
idAccount
- the ID of the account to be deleted
-
updateBalanceSender
Description copied from interface:AccountService
Updates the balance of the account sending a payment.- Specified by:
updateBalanceSender
in interfaceAccountService
- Parameters:
accountModel
- the AccountModel with updated balance information- Returns:
- the updated AccountModel
-
updateBalanceReceive
Description copied from interface:AccountService
Updates the balance of the account receiving a payment.- Specified by:
updateBalanceReceive
in interfaceAccountService
- Parameters:
accountModel
- the AccountModel with updated balance information- Returns:
- the updated AccountModel
-