PHP 인터페이스 yii2tech\balance\ManagerInterface

부터: 1.0
저자: Paul Klimov ([email protected])
파일 보기 프로젝트 열기: yii2tech/balance

공개 메소드들

메소드 설명
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.