class PayPalExpress in PayPal for Payment 2.0.x
Same name in this branch
- 2.0.x src/Plugin/Payment/MethodConfiguration/PayPalExpress.php \Drupal\paypal_payment\Plugin\Payment\MethodConfiguration\PayPalExpress
- 2.0.x src/Plugin/Payment/Method/PayPalExpress.php \Drupal\paypal_payment\Plugin\Payment\Method\PayPalExpress
Same name and namespace in other branches
- 8 src/Plugin/Payment/Method/PayPalExpress.php \Drupal\paypal_payment\Plugin\Payment\Method\PayPalExpress
PayPal Express payment method.
Plugin annotation
@PaymentMethod(
deriver = "\Drupal\paypal_payment\Plugin\Payment\Method\PayPalExpressDeriver",
id = "paypal_payment_express",
operations_provider = "\Drupal\paypal_payment\Plugin\Payment\Method\PayPalExpressOperationsProvider",
)
Hierarchy
- class \Drupal\paypal_payment\Plugin\Payment\Method\PayPalBasic extends \Drupal\payment\Plugin\Payment\Method\Basic
- class \Drupal\paypal_payment\Plugin\Payment\Method\PayPalExpress
Expanded class hierarchy of PayPalExpress
1 file declares its use of PayPalExpress
- PayPalExpress.php in src/
Plugin/ Payment/ MethodConfiguration/ PayPalExpress.php
File
- src/
Plugin/ Payment/ Method/ PayPalExpress.php, line 20
Namespace
Drupal\paypal_payment\Plugin\Payment\MethodView source
class PayPalExpress extends PayPalBasic {
/**
* {@inheritdoc}
*/
public function getWebhookUrl() : string {
$configuration = $this
->getPluginDefinition();
list(, $id) = explode(':', $configuration['id']);
return self::webhookUrl($id);
}
/**
* {@inheritdoc}
*/
public function getWebhookId() : string {
$configuration = $this
->getPluginDefinition();
return $configuration['webhookId'];
}
/**
* {{@inheritdoc}}
*/
public function getApiContext($type) : ApiContext {
return self::apiContext($this
->getPluginDefinition(), $type);
}
/**
* @param $configuration
* @param $type
*
* @return \PayPal\Rest\ApiContext
*/
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;
}
/**
* @param $id
*
* @return string
*/
public static function webhookUrl($id) : string {
$webhook = new Url('paypal_payment.webhook', [
'payment_method_id' => $id,
], [
'absolute' => TRUE,
]);
return $webhook
->toString(TRUE)
->getGeneratedUrl();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PayPalBasic:: |
protected | property | ||
PayPalBasic:: |
protected | function | ||
PayPalBasic:: |
public | function | ||
PayPalBasic:: |
public | function | ||
PayPalBasic:: |
constant | |||
PayPalBasic:: |
constant | |||
PayPalBasic:: |
constant | |||
PayPalBasic:: |
constant | |||
PayPalBasic:: |
constant | |||
PayPalBasic:: |
private | function | ||
PayPalExpress:: |
public static | function | ||
PayPalExpress:: |
public | function |
{} Overrides PayPalBasic:: |
|
PayPalExpress:: |
public | function |
Overrides PayPalBasic:: |
|
PayPalExpress:: |
public | function |
Overrides PayPalBasic:: |
|
PayPalExpress:: |
public static | function |