PHP Интерфейс yii2tech\balance\ManagerInterface

С версии: 1.0
Автор: Paul Klimov ([email protected])
Показать файл Открыть проект

Открытые методы

Метод Описание
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.

Описание методов

calculateBalance() публичный Метод

Calculates current account balance summarizing all related transactions.
public calculateBalance ( array | mixed $account ) : integer | float
$account array | mixed account ID or filter condition.
Результат integer | float current balance.

decrease() публичный Метод

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.
Результат mixed transaction ID.

increase() публичный Метод

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
Результат mixed transaction ID.

revert() публичный Метод

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
Результат array | mixed transaction ID or list of transaction IDs.

transfer() публичный Метод

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.
Результат array list of created transaction IDs.