Exemplo n.º 1
0
 public function getCustomerTokenCard()
 {
     if (!is_null($this->_customer)) {
         if ($this->getCustomerToken()) {
             $call = 'customers/' . $this->getCustomerToken();
             $proto = Zend_Http_Client::GET;
             $result = $this->talkToGateway(array(), $call, $proto);
             if (property_exists($result, 'error')) {
                 $message = $this->buildError($result);
                 Mage::throwException($message);
             } else {
                 if (property_exists($result, 'response') && property_exists($result->response, 'token')) {
                     return $result->response->card;
                 } else {
                     mage::log($result);
                     mage::throwException('Invalid response from payment gateway. Please check logs for details.');
                 }
             }
         }
     }
     return false;
 }
Exemplo n.º 2
0
 public function onSalesModelOrderCreditmemoRefund($observer)
 {
     if ($observer->getCreditmemo()->getOrder()->getInstallmentTypeId()) {
         if (NGC_Installment_Model_Master::refundInstallmentPayment($observer)) {
             return mage::throwException('Unable to refund installment payments');
         }
     }
 }
Exemplo n.º 3
0
 private function getConnection()
 {
     require_once $this->_getRootPath() . 'app' . DIRECTORY_SEPARATOR . 'Mage.php';
     Mage::app($this->_appCode, $this->_appType);
     try {
         $this->_db = Zend_Db::factory('Pdo_Mysql', array('host' => $this->_configXml->global->resources->default_setup->connection->host, 'username' => $this->_configXml->global->resources->default_setup->connection->username, 'password' => $this->_configXml->global->resources->default_setup->connection->password, 'dbname' => $this->_configXml->global->resources->default_setup->connection->dbname));
         $this->_db->getConnection();
     } catch (Zend_Db_Adapter_Exception $e) {
         mage::throwException($e);
         die($e->getMessage());
     } catch (Zend_Exception $e) {
         mage::throwException($e);
         die($e->getMessage());
     }
 }
Exemplo n.º 4
0
 private function _sendRequest($path, $params)
 {
     $httpRequest = new Zend_Http_Client(ProxiBlue_ReCaptcha_Helper_Data::RECAPTCHA_API_SERVER . '/' . ProxiBlue_ReCaptcha_Helper_Data::RECAPTCHA_API_PATH . '/' . $path);
     $httpRequest->setParameterPost(array_merge(array('remoteip' => $_SERVER['REMOTE_ADDR']), $params));
     $response = $httpRequest->request('POST');
     if ($response->getStatus() != 200) {
         mage::throwException('Bad response from cpatcha gateway. we got ' . $response->getStatus());
     }
     return $response->getBody();
 }
Exemplo n.º 5
-1
 /**
  * Process a refund
  * 
  * @param Varien_Object $payment
  * @param double $amount
  * @return \ProxiBlue_PinPayments_Model_Gateway
  */
 public function refund(Varien_Object $payment, $amount)
 {
     $this->setAmount($amount)->setPayment($payment);
     try {
         $result = $this->talkToGateway(array(), 'charges/' . $payment->getRefundTransactionId() . '/refunds');
         if (property_exists($result, 'error')) {
             $message = $this->buildError($result);
             Mage::throwException($message);
         } else {
             if (property_exists($result, 'response') && property_exists($result->response, 'success')) {
                 $payment->setStatus(self::STATUS_APPROVED)->setLastTransId($result->response->token)->setRefundTransactionId($result->response->token);
             } else {
                 mage::log($result);
                 mage::throwException('Invalid response from payment gateway. Please check logs for details.');
             }
         }
     } catch (Exception $e) {
         Mage::throwException($e->getMessage());
     }
     return $this;
 }