本文整理匯總了PHP中PayPal\Rest\ApiContext::addRequestHeader方法的典型用法代碼示例。如果您正苦於以下問題:PHP ApiContext::addRequestHeader方法的具體用法?PHP ApiContext::addRequestHeader怎麽用?PHP ApiContext::addRequestHeader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PayPal\Rest\ApiContext
的用法示例。
在下文中一共展示了ApiContext::addRequestHeader方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setApiContext
/**
* Set api context
*
* @param $website
* @return $this
*/
public function setApiContext($website = null)
{
$this->_apiContext = new ApiContext(new OAuthTokenCredential(Mage::getStoreConfig('iways_paypalplus/api/client_id', $website), Mage::getStoreConfig('iways_paypalplus/api/client_secret', $website)));
$this->_mode = Mage::getStoreConfig('iways_paypalplus/api/mode', $website);
$this->_apiContext->setConfig(array('http.ConnectionTimeOut' => 30, 'http.Retry' => 1, 'mode' => $this->_mode, 'log.LogEnabled' => Mage::getStoreConfig('dev/log/active', $website), 'log.FileName' => Mage::getBaseDir('log') . DS . 'PayPal.log', 'log.LogLevel' => 'INFO'));
$this->_apiContext->addRequestHeader('PayPal-Partner-Attribution-Id', 'Magento_Cart_PayPalPlus');
return $this;
}
示例2: apiContext
protected function apiContext()
{
$credential = new OAuthTokenCredential($this->get_config('PAYPAL_CLIENT_ID_' . strtoupper($this->get_config('PAYPAL_MODE'))), $this->get_config('PAYPAL_SECRET_' . strtoupper($this->get_config('PAYPAL_MODE'))));
$credential::$expiryBufferTime = defined('SESSION_LIFE_CUSTOMERS') ? SESSION_LIFE_CUSTOMERS : 1440;
$apiContext = new ApiContext($credential);
$auth_cache_file = SQL_CACHEDIR . 'pp_auth_' . $this->get_config('PAYPAL_MODE') . '.cache';
if (!is_file($auth_cache_file)) {
file_put_contents($auth_cache_file, '');
}
$apiContext->setConfig(array('mode' => $this->get_config('PAYPAL_MODE'), 'log.LogEnabled' => $this->get_config('PAYPAL_LOG_ENALBLED') == '1' ? true : false, 'log.FileName' => DIR_FS_LOG . 'mod_paypal_' . $this->get_config('PAYPAL_MODE') . '_' . date('Y-m-d') . '.log', 'log.LogLevel' => $this->loglevel, 'validation.level' => 'log', 'cache.enabled' => is_writeable(SQL_CACHEDIR) ? true : false, 'cache.FileName' => $auth_cache_file));
if (strpos($this->code, 'paypalplus') !== false) {
$apiContext->addRequestHeader('PayPal-Partner-Attribution-Id', 'ModifiedeCommerce_Cart_REST_Plus');
} else {
$apiContext->addRequestHeader('PayPal-Partner-Attribution-Id', 'ModifiedeCommerce_Cart_REST_EC');
}
return $apiContext;
}