yii2tech\balance\Manager::revert PHP Méthode

revert() public méthode

public revert ( $transactionId, $data = [] )
    public function revert($transactionId, $data = [])
    {
        $transaction = $this->findTransaction($transactionId);
        if (empty($transaction)) {
            throw new InvalidParamException("Unable to find transaction '{$transactionId}'");
        }
        $amount = $transaction[$this->amountAttribute];
        if ($this->extraAccountLinkAttribute !== null && isset($transaction[$this->extraAccountLinkAttribute])) {
            $fromId = $transaction[$this->accountLinkAttribute];
            $toId = $transaction[$this->extraAccountLinkAttribute];
            return $this->transfer($fromId, $toId, $amount, $data);
        } else {
            $accountId = $transaction[$this->accountLinkAttribute];
            return $this->decrease($accountId, $amount, $data);
        }
    }