Class BalanceService
java.lang.Object
com.paymybuddy.paymybuddy.service.BalanceService
The `BalanceService` class is responsible for handling balance operations for users.
It interacts with the `UserRepository` to retrieve and update the user's balance
based on the balance operation provided.
This service includes methods for updating a user's balance by either adding or
subtracting an amount based on the operation performed.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
updateBalance
(BalanceOperationDTO operation, boolean plus) The function `updateBalance` takes a `BalanceOperationDTO` object and a boolean flag to either add or subtract the amount from the user's balance, updating and saving the user's balance accordingly.
-
Constructor Details
-
BalanceService
public BalanceService()
-
-
Method Details
-
updateBalance
The function `updateBalance` takes a `BalanceOperationDTO` object and a boolean flag to either add or subtract the amount from the user's balance, updating and saving the user's balance accordingly.- Parameters:
operation
- The `operation` parameter is of type `BalanceOperationDTO`, which likely contains information about a balance operation such as the user email and the amount to be added or subtracted from the balance.plus
- The `plus` parameter is a boolean value that determines whether to add or subtract the `amount` from the user's balance. If `plus` is true, the `amount` will be added to the balance. If `plus` is false, the `amount` will be subtracted from
-