/** * Send capture request to gateway for capture authorized transactions of card * * @param Mage_Payment_Model_Info $payment * @param decimal $amount * @param Varien_Object $card * @return bool|Mage_Sales_Model_Order_Payment_Transaction */ protected function _preauthorizeCaptureCardTransaction($payment, $amount, $card) { $authTransactionId = $card->getLastTransId(); $authTransaction = $payment->getTransaction($authTransactionId); $realAuthTransactionId = $authTransaction->getAdditionalInformation($this->_realTransactionIdKey); $payment->setChasePaymentechTransType(Gorilla_ChasePaymentech_Model_Profile::TRANS_TYPE_CAPTURE); $payment->setTransId($realAuthTransactionId); $payment->setAmount($amount); // Get the result $result = $this->_postRequest($payment); switch ($result->getResponseCode()) { case self::RESPONSE_CODE_NEW_ORDER_SUCCESS: if ($result->getApprovalCode() == self::RESPONSE_APPROVAL_STATUS) { $captureTransactionId = $result->getTransactionId() . '-capture'; // If split then save the parent transaction id as the splitRefIdx returned in MFC response if ($result->getSplitTransactionId()) { $captureTransactionId = $result->getSplitTransactionId(); } $card->setLastCaptureTransId($captureTransactionId); $card->setSplitAuthTransId($result->getSplitTransactionId()); $card->setTransRefIdx($result->getTransactionRefIdx()); return $this->_addTransaction($payment, $captureTransactionId, Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE, array('is_transaction_closed' => 0, 'parent_transaction_id' => $authTransactionId), array($this->_realTransactionIdKey => $result->getTransactionId()), Mage::helper('paygate')->getTransactionMessage($payment, $payment->getChasePaymentechTransType(), $result->getTransactionId(), $card, $amount)); } $exceptionMessage = $this->_wrapGatewayError($result->getResponseReasonText()); Mage::throwException($exceptionMessage); return false; break; case self::RESPONSE_CODE_DECLINED: //case self::RESPONSE_CODE_HELD: //case self::RESPONSE_CODE_ERROR: $exceptionMessage = $this->_wrapGatewayError($result->getResponseReasonText()); break; default: $exceptionMessage = Mage::helper('paygate')->__('Payment capturing error.'); break; } //$exceptionMessage = Mage::helper('paygate')->getTransactionMessage( // $payment, Mage_Paygate_Model_Authorizenet::REQUEST_TYPE_CAPTURE_ONLY, $realAuthTransactionId, $card, $amount, $exceptionMessage //); Mage::throwException($exceptionMessage); return false; }