PayPal\Rest\ApiContext::setConfig PHP 메소드

setConfig() 공개 메소드

Sets Config
public setConfig ( array $config )
$config array SDK configuration parameters
    public function setConfig(array $config)
    {
        PayPalConfigManager::getInstance()->addConfigs($config);
    }

Usage Example

예제 #1
0
 /**
  * @inheritdoc
  */
 private function setConfig()
 {
     // ### Api context
     // Use an ApiContext object to authenticate
     // API calls. The clientId and clientSecret for the
     // OAuthTokenCredential class can be retrieved from
     // developer.paypal.com
     $this->_apiContext = new ApiContext(new OAuthTokenCredential($this->clientId, $this->clientSecret));
     // #### SDK configuration
     // Comment this line out and uncomment the PP_CONFIG_PATH
     // 'define' block if you want to use static file
     // based configuration
     $this->_apiContext->setConfig(ArrayHelper::merge(['mode' => self::MODE_SANDBOX, 'http.ConnectionTimeOut' => 30, 'http.Retry' => 1, 'log.LogEnabled' => YII_DEBUG ? 1 : 0, 'log.FileName' => Yii::getAlias('@runtime/logs/paypal.log'), 'log.LogLevel' => self::LOG_LEVEL_FINE, 'validation.level' => 'log', 'cache.enabled' => 'true'], $this->config));
     // Set file name of the log if present
     if (isset($this->config['log.FileName']) && isset($this->config['log.LogEnabled']) && (bool) $this->config['log.LogEnabled'] == true) {
         $logFileName = \Yii::getAlias($this->config['log.FileName']);
         if ($logFileName) {
             if (!file_exists($logFileName)) {
                 if (!touch($logFileName)) {
                     throw new ErrorException('Can\'t create paypal.log file at: ' . $logFileName);
                 }
             }
         }
         $this->config['log.FileName'] = $logFileName;
     }
     return $this->_apiContext;
 }
All Usage Examples Of PayPal\Rest\ApiContext::setConfig