PHP Interface yii2tech\balance\ManagerInterface

Since: 1.0
Author: Paul Klimov ([email protected])
Afficher le fichier Open project: yii2tech/balance

Méthodes publiques

Méthode Description
calculateBalance ( array | mixed $account ) : integer | float Calculates current account balance summarizing all related transactions.
decrease ( array | mixed $account, integer | float $amount, array $data = [] ) : mixed Decreases account current balance ('credit' operation).
increase ( array | mixed $account, integer | float $amount, array $data = [] ) : mixed Increases account current balance ('debit' operation).
revert ( mixed $transactionId, array $data = [] ) : array | mixed Reverts specified transaction.
transfer ( array | mixed $from, array | mixed $to, integer | float $amount, array $data = [] ) : array Transfers amount from one account to the other one.

Method Details

calculateBalance() public méthode

Calculates current account balance summarizing all related transactions.
public calculateBalance ( array | mixed $account ) : integer | float
$account array | mixed account ID or filter condition.
Résultat integer | float current balance.

decrease() public méthode

Decreases account current balance ('credit' operation).
public decrease ( array | mixed $account, integer | float $amount, array $data = [] ) : mixed
$account array | mixed account ID or filter condition.
$amount integer | float amount.
$data array extra data, which should be associated with the transaction.
Résultat mixed transaction ID.

increase() public méthode

Increases account current balance ('debit' operation).
public increase ( array | mixed $account, integer | float $amount, array $data = [] ) : mixed
$account array | mixed account ID or filter condition.
$amount integer | float amount.
$data array extra data, which should be associated with the transaction
Résultat mixed transaction ID.

revert() public méthode

This method does not deletes original transaction, but creates new one, which compensate it. If transaction has been created via ManagerInterface::transfer method, 2 transactions will be created affecting both accounts used at ManagerInterface::transfer.
public revert ( mixed $transactionId, array $data = [] ) : array | mixed
$transactionId mixed ID of the transaction to be reverted.
$data array extra transaction data
Résultat array | mixed transaction ID or list of transaction IDs.

transfer() public méthode

Transfers amount from one account to the other one.
public transfer ( array | mixed $from, array | mixed $to, integer | float $amount, array $data = [] ) : array
$from array | mixed account ID or filter condition.
$to array | mixed account ID or filter condition.
$amount integer | float amount.
$data array extra data, which should be associated with the transaction.
Résultat array list of created transaction IDs.