当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Paypal_Model_Config::getPaypalUrl方法代码示例

本文整理汇总了PHP中Mage_Paypal_Model_Config::getPaypalUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Paypal_Model_Config::getPaypalUrl方法的具体用法?PHP Mage_Paypal_Model_Config::getPaypalUrl怎么用?PHP Mage_Paypal_Model_Config::getPaypalUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Paypal_Model_Config的用法示例。


在下文中一共展示了Mage_Paypal_Model_Config::getPaypalUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _postBack

 /**
  * Post back to PayPal to check whether this request is a valid one
  *
  * @param Zend_Http_Client_Adapter_Interface $httpAdapter
  */
 protected function _postBack(Zend_Http_Client_Adapter_Interface $httpAdapter)
 {
     $postbackQuery = http_build_query($this->_request) . '&cmd=_notify-validate';
     $postbackUrl = $this->_config->getPaypalUrl();
     $this->_debugData['postback_to'] = $postbackUrl;
     $httpAdapter->setConfig(array('verifypeer' => $this->_config->verifyPeer));
     $httpAdapter->write(Zend_Http_Client::POST, $postbackUrl, '1.1', array('Connection: close'), $postbackQuery);
     try {
         $postbackResult = $httpAdapter->read();
     } catch (Exception $e) {
         $this->_debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
         throw $e;
     }
     /*
      * Handle errors on PayPal side.
      */
     $responseCode = Zend_Http_Response::extractCode($postbackResult);
     if (empty($postbackResult) || in_array($responseCode, array('500', '502', '503'))) {
         if (empty($postbackResult)) {
             $reason = 'Empty response.';
         } else {
             $reason = 'Response code: ' . $responseCode . '.';
         }
         $this->_debugData['exception'] = 'PayPal IPN postback failure. ' . $reason;
         throw new Mage_Paypal_UnavailableException($reason);
     }
     $response = preg_split('/^\\r?$/m', $postbackResult, 2);
     $response = trim($response[1]);
     if ($response != 'VERIFIED') {
         $this->_debugData['postback'] = $postbackQuery;
         $this->_debugData['postback_result'] = $postbackResult;
         throw new Exception('PayPal IPN postback failure. See ' . self::DEFAULT_LOG_FILE . ' for details.');
     }
 }
开发者ID:quyip8818,项目名称:Mag,代码行数:39,代码来源:Ipn.php

示例2: _postBack

 /**
  * Post back to PayPal to check whether this request is a valid one
  *
  * @param Zend_Http_Client_Adapter_Interface $httpAdapter
  */
 protected function _postBack(Zend_Http_Client_Adapter_Interface $httpAdapter)
 {
     $sReq = '';
     foreach ($this->_request as $k => $v) {
         $sReq .= '&' . $k . '=' . urlencode(stripslashes($v));
     }
     $sReq .= "&cmd=_notify-validate";
     $sReq = substr($sReq, 1);
     $this->_debugData['postback'] = $sReq;
     $this->_debugData['postback_to'] = $this->_config->getPaypalUrl();
     $httpAdapter->write(Zend_Http_Client::POST, $this->_config->getPaypalUrl(), '1.1', array(), $sReq);
     try {
         $response = $httpAdapter->read();
     } catch (Exception $e) {
         $this->_debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
         throw $e;
     }
     $this->_debugData['postback_result'] = $response;
     $response = preg_split('/^\\r?$/m', $response, 2);
     $response = trim($response[1]);
     if ($response != 'VERIFIED') {
         throw new Exception('PayPal IPN postback failure. See ' . self::DEFAULT_LOG_FILE . ' for details.');
     }
     unset($this->_debugData['postback'], $this->_debugData['postback_result']);
 }
开发者ID:njaeger,项目名称:magento_github,代码行数:30,代码来源:Ipn.php

示例3: _postBack

 /**
  * Post back to PayPal to check whether this request is a valid one
  *
  * @param Zend_Http_Client_Adapter_Interface $httpAdapter
  */
 protected function _postBack(Zend_Http_Client_Adapter_Interface $httpAdapter)
 {
     $postbackQuery = http_build_query($this->_request) . '&cmd=_notify-validate';
     $postbackUrl = $this->_config->getPaypalUrl();
     $this->_debugData['postback_to'] = $postbackUrl;
     $httpAdapter->write(Zend_Http_Client::POST, $postbackUrl, '1.1', array(), $postbackQuery);
     try {
         $postbackResult = $httpAdapter->read();
     } catch (Exception $e) {
         $this->_debugData['http_error'] = array('error' => $e->getMessage(), 'code' => $e->getCode());
         throw $e;
     }
     $response = preg_split('/^\\r?$/m', $postbackResult, 2);
     $response = trim($response[1]);
     if ($response != 'VERIFIED') {
         $this->_debugData['postback'] = $postbackQuery;
         $this->_debugData['postback_result'] = $postbackResult;
         throw new Exception('PayPal IPN postback failure. See ' . self::DEFAULT_LOG_FILE . ' for details.');
     }
 }
开发者ID:natxetee,项目名称:magento2,代码行数:25,代码来源:Ipn.php

示例4: processIpnRequest

 /**
  * Get ipn data, send verification to PayPal, run corresponding handler
  */
 public function processIpnRequest()
 {
     if (!$this->_ipnFormData) {
         return;
     }
     // debug requested
     if ($this->_config->debugFlag) {
         Mage::getModel('paypal/api_debug')->setApiEndpoint($this->_config->getPaypalUrl())->setRequestBody(var_export($this->_ipnFormData, 1))->save();
     }
     $sReq = '';
     $sReqDebug = '';
     foreach ($this->_ipnFormData as $k => $v) {
         $sReq .= '&' . $k . '=' . urlencode(stripslashes($v));
         $sReqDebug .= '&' . $k . '=';
     }
     // append ipn command
     $sReq .= "&cmd=_notify-validate";
     $sReq = substr($sReq, 1);
     $http = new Varien_Http_Adapter_Curl();
     $http->write(Zend_Http_Client::POST, $this->_config->getPaypalUrl(), '1.1', array(), $sReq);
     $response = $http->read();
     // debug postback request & response
     if ($this->_config->debugFlag) {
         Mage::getModel('paypal/api_debug')->setApiEndpoint($this->_config->getPaypalUrl())->setRequestBody($sReq)->setResponseBody($response)->save();
     }
     if ($error = $http->getError()) {
         $this->_notifyAdmin(Mage::helper('paypal')->__('PayPal IPN postback HTTP error: %s', $error));
         return;
     }
     $response = preg_split('/^\\r?$/m', $response, 2);
     $response = trim($response[1]);
     if ($response == 'VERIFIED') {
         $this->processIpnVerified();
     } else {
         // TODO: possible PCI compliance issue - the $sReq may contain data that is supposed to be encrypted
         $this->_notifyAdmin(Mage::helper('paypal')->__('PayPal IPN postback Validation error: %s', $sReq));
     }
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:41,代码来源:Ipn.php


注:本文中的Mage_Paypal_Model_Config::getPaypalUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。