public function process(PaymentTransaction $transaction)
    {
        if (!isset($transaction->gateway)) {
            throw new CException('Cannot start transaction without a payment gateway.');
        }
        if (!isset($transaction->shippingContactId)) {
            throw new CException('Cannot start transaction without a shipping contact.');
        }
        if (!count($transaction->items)) {
            throw new CException('Cannot start transaction without any items.');
        }

        $gateway = $this->createGateway($transaction->gateway);
        try {
            $gateway->prepareTransaction($transaction);
            $this->changeTransactionStatus(PaymentTransaction::STATUS_STARTED, $transaction);
            $gateway->processTransaction($transaction);
            $this->changeTransactionStatus(PaymentTransaction::STATUS_PROCESSED, $transaction);
            $gateway->resolveTransaction($transaction);
        } catch (CException $e) {
            $this->changeTransactionStatus(PaymentTransaction::STATUS_FAILED, $transaction);
            throw $e;
        }
    }
public function process(PaymentTransaction $transaction)
    {
        if (!isset($transaction->gateway)) {
            throw new CException('Cannot start transaction without a payment gateway.');
        }
        if (!isset($transaction->shippingContactId)) {
            throw new CException('Cannot start transaction without a shipping contact.');
        }
        if (!count($transaction->items)) {
            throw new CException('Cannot start transaction without any items.');
        }

        $gateway = $this->createGateway($transaction->gateway);
        try {
            $gateway->prepareTransaction($transaction);
            $this->changeTransactionStatus(PaymentTransaction::STATUS_STARTED, $transaction);
            $gateway->processTransaction($transaction);
            $this->changeTransactionStatus(PaymentTransaction::STATUS_PROCESSED, $transaction);
            $gateway->resolveTransaction($transaction);
        } catch (CException $e) {
            $this->changeTransactionStatus(PaymentTransaction::STATUS_FAILED, $transaction);
            throw $e;
        }
    }
public function process ( PaymentTransaction $ transaction ) { if ( ! isset ( $ transaction -> gateway ) ) { throw new CException ( 'Cannot start transaction without a payment gateway.' ) ; } if ( ! isset ( $ transaction -> shippingContactId ) ) { throw new CException ( 'Cannot start transaction without a shipping contact.' ) ; } if ( ! count ( $ transaction -> items ) ) { throw new CException ( 'Cannot start transaction without any items.' ) ; } $ gateway = $ this -> createGateway ( $ transaction -> gateway ) ; try { $ gateway -> prepareTransaction ( $ transaction ) ; $ this -> changeTransactionStatus ( PaymentTransaction :: STATUS_STARTED , $ transaction ) ; $ gateway -> processTransaction ( $ transaction ) ; $ this -> changeTransactionStatus ( PaymentTransaction :: STATUS_PROCESSED , $ transaction ) ; $ gateway -> resolveTransaction ( $ transaction ) ; } catch ( CException $ e ) { $ this -> changeTransactionStatus ( PaymentTransaction :: STATUS_FAILED , $ transaction ) ; throw $ e ; } }
Processes the given transaction.
@param PaymentTransaction $transaction
@throws CException
Processes the given transaction .