src/base/Gateway.php
protected function createRequest(Transaction $transaction, BasePaymentForm $form = null)
    {
        // For authorize and capture we're referring to a transaction that already took place so no card or item shenanigans.
        if (in_array($transaction->type, [TransactionRecord::TYPE_REFUND, TransactionRecord::TYPE_CAPTURE], false)) {
            $request = $this->createPaymentRequest($transaction);
        } else {
            $order = $transaction->getOrder();

            $card = null;

            if ($form) {
                $card = $this->createCard($form, $order);
            }

            $itemBag = $this->getItemBagForOrder($order);

            $request = $this->createPaymentRequest($transaction, $card, $itemBag);
            $this->populateRequest($request, $form);
        }

        return $request;
    }
protected function createRequest(Transaction $transaction, BasePaymentForm $form = null)
    {
        // For authorize and capture we're referring to a transaction that already took place so no card or item shenanigans.
        if (in_array($transaction->type, [TransactionRecord::TYPE_REFUND, TransactionRecord::TYPE_CAPTURE], false)) {
            $request = $this->createPaymentRequest($transaction);
        } else {
            $order = $transaction->getOrder();

            $card = null;

            if ($form) {
                $card = $this->createCard($form, $order);
            }

            $itemBag = $this->getItemBagForOrder($order);

            $request = $this->createPaymentRequest($transaction, $card, $itemBag);
            $this->populateRequest($request, $form);
        }

        return $request;
    }
protected function createRequest ( Transaction $ transaction , BasePaymentForm $ form = null ) { // For authorize and capture we're referring to a transaction that already took place so no card or item shenanigans. if ( in_array ( $ transaction -> type , [ TransactionRecord :: TYPE_REFUND , TransactionRecord :: TYPE_CAPTURE ] , false ) ) { $ request = $ this -> createPaymentRequest ( $ transaction ) ; } else { $ order = $ transaction -> getOrder ( ) ; $ card = null ; if ( $ form ) { $ card = $ this -> createCard ( $ form , $ order ) ; } $ itemBag = $ this -> getItemBagForOrder ( $ order ) ; $ request = $ this -> createPaymentRequest ( $ transaction , $ card , $ itemBag ) ; $ this -> populateRequest ( $ request , $ form ) ; } return $ request ; }
Prepare a request for execution by transaction and a populated payment form.

@param Transaction     $transaction
@param BasePaymentForm $form        Optional for capture/refund requests.

@return mixed
@throws \yii\base\Exception
Prepare a request for execution by transaction and a populated payment form .