public function capture(Varien_Object $payment, $amount) { parent::capture($payment, $amount); $this->setAmount($amount)->setPayment($payment); if ($payment->getLastTransId()) { //if after authorize $result = $this->callDoDebitPayment() !== false; } else { //authorize+capture (debit) $result = $this->callDoDirectPayment() !== false; } if ($result) { $payment->setStatus(self::STATUS_APPROVED)->setLastTransId($this->getTransactionId())->setPayboxRequestNumber($this->getRequestNumber()); } else { $e = $this->getError(); if (isset($e['message'])) { $message = Mage::helper('paybox')->__('There has been an error processing your payment. ') . $e['message']; } else { $message = Mage::helper('paybox')->__('There has been an error processing your payment. Please try later or contact us for help.'); } Mage::throwException($message); } return $this; }
public function capture(Varien_Object $payment, $amount) { ini_set('soap.wsdl_cache_enabled', '0'); $braspag_url = $this->getConfigData('service'); $merchant_id = $this->getConfigData('merchant_id'); $order_id = $payment->getOrder()->getIncrementId(); $soapclient = new Zend_Soap_Client($braspag_url); $parametros = array(); $parametros['merchantId'] = (string) $merchant_id; $parametros['orderId'] = (string) $order_id; $capture = $soapclient->Capture($parametros); $resultado = $capture->CaptureResult; $transacao = Mage::getModel('braspag/braspag'); $transacao->setOrderId($order_id); $transacao->setAmount($resultado->amount); $transacao->setTransactionId($resultado->transactionId); $transacao->setMessage($resultado->message); $transacao->setReturnCode($resultado->returnCode); $transacao->setStatus($resultado->status); $transacao->save(); return parent::capture($payment, $amount); }