public function authorize($payment, $amount)
        {
            $error = false;

            // check for payment
            if($amount > 0) {

                $payment->setAmount($amount);

                // Map magento keys to moneris way
                $transaction = $this->_build($payment, self::TRANSACTION_PREAUTH);
                $response = $this->_send($transaction);

                $payment->setCcApproval($response->getReceiptId())
                    ->setLastTransId($response->getReceiptId())
                    ->setCcTransId($response->getTxnNumber())
                    ->setCcAvsStatus($response->getAuthCode())
                    ->setCcCidStatus($response->getResponseCode());


                if($response->getResponseCode() > 0 && $response->getResponseCode() <= self::ERROR_CODE_LIMIT) {
                    $payment->setStatus(self::STATUS_APPROVED);
                } else if($response->getResponseCode() > self::ERROR_CODE_LIMIT && $response->getResponseCode() < self::ERROR_CODE_UPPER_LIMIT) {
                    $error = $this->_errors[$response->getResponseCode()];
                } else {
                    $error = 'Incomplete transaction.';
                }
            } else {
                $error = 'Invalid amount for authorization.';
            }

            // we've got something bad here.
            if ($error !== false) {
                $this->_log($error);
            }
            return $this;
        }