public static function PayPalExpress::apiContext in PayPal for Payment 2.0.x
Same name and namespace in other branches
- 8 src/Plugin/Payment/Method/PayPalExpress.php \Drupal\paypal_payment\Plugin\Payment\Method\PayPalExpress::apiContext()
Parameters
$configuration:
$type:
Return value
\PayPal\Rest\ApiContext
2 calls to PayPalExpress::apiContext()
- PayPalExpress::getApiContext in src/
Plugin/ Payment/ Method/ PayPalExpress.php - {}
- PayPalExpress::updateWebhook in src/
Plugin/ Payment/ MethodConfiguration/ PayPalExpress.php
File
- src/
Plugin/ Payment/ Method/ PayPalExpress.php, line 53
Class
- PayPalExpress
- PayPal Express payment method.
Namespace
Drupal\paypal_payment\Plugin\Payment\MethodCode
public static function apiContext($configuration, $type) : ApiContext {
$apiContext = new ApiContext(new OAuthTokenCredential($configuration['clientId'], $configuration['clientSecret']));
$storage = PhpStorageFactory::get('paypal_api_context');
if (!$storage
->exists('auth.cache')) {
$storage
->save('auth.cache', '');
}
$apiContext
->setConfig([
'mode' => $configuration['production'] ? 'live' : 'sandbox',
'log.LogEnabled' => $configuration['logging'][$type],
'log.FileName' => \Drupal::service('file_system')
->getTempDirectory() . '/DrupalPayPal.log',
'log.LogLevel' => $configuration['loglevel'],
'cache.enabled' => TRUE,
'cache.FileName' => DRUPAL_ROOT . '/' . $storage
->getFullPath('auth.cache'),
]);
return $apiContext;
}