class PayPalExpress in PayPal for Payment 8
Same name in this branch
- 8 src/Plugin/Payment/MethodConfiguration/PayPalExpress.php \Drupal\paypal_payment\Plugin\Payment\MethodConfiguration\PayPalExpress
- 8 src/Plugin/Payment/Method/PayPalExpress.php \Drupal\paypal_payment\Plugin\Payment\Method\PayPalExpress
Same name and namespace in other branches
- 2.0.x 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\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\payment\Plugin\Payment\Method\PaymentMethodBase implements ConfigurableInterface, DependentPluginInterface, CacheableDependencyInterface, ContainerFactoryPluginInterface, PluginFormInterface, PaymentMethodCapturePaymentInterface, PaymentMethodInterface, PaymentMethodRefundPaymentInterface uses PaymentAwareTrait
- class \Drupal\payment\Plugin\Payment\Method\Basic implements ContainerFactoryPluginInterface, PaymentMethodCapturePaymentInterface, PaymentMethodRefundPaymentInterface, PaymentMethodUpdatePaymentStatusInterface
- class \Drupal\paypal_payment\Plugin\Payment\Method\PayPalBasic
- class \Drupal\paypal_payment\Plugin\Payment\Method\PayPalExpress
- class \Drupal\paypal_payment\Plugin\Payment\Method\PayPalBasic
- class \Drupal\payment\Plugin\Payment\Method\Basic implements ContainerFactoryPluginInterface, PaymentMethodCapturePaymentInterface, PaymentMethodRefundPaymentInterface, PaymentMethodUpdatePaymentStatusInterface
- class \Drupal\payment\Plugin\Payment\Method\PaymentMethodBase implements ConfigurableInterface, DependentPluginInterface, CacheableDependencyInterface, ContainerFactoryPluginInterface, PluginFormInterface, PaymentMethodCapturePaymentInterface, PaymentMethodInterface, PaymentMethodRefundPaymentInterface uses PaymentAwareTrait
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
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 |
---|---|---|---|---|
Basic:: |
protected | property | The payment status manager. | |
Basic:: |
public static | function |
Creates an instance of the plugin. Overrides PaymentMethodBase:: |
|
Basic:: |
public | function |
Performs the actual payment capture. Overrides PaymentMethodBase:: |
|
Basic:: |
public | function |
Performs a payment method-specific access check for payment capture. Overrides PaymentMethodBase:: |
|
Basic:: |
public | function |
Performs the actual payment refund. Overrides PaymentMethodBase:: |
|
Basic:: |
public | function |
Performs a payment method-specific access check for payment refunds. Overrides PaymentMethodBase:: |
|
Basic:: |
public | function | Gets whether or not capture is supported. | |
Basic:: |
public | function | Gets the status to set on payment capture. | |
Basic:: |
public | function | Gets the ID of the payment method this plugin is for. | |
Basic:: |
public | function | Gets the status to set on payment execution. | |
Basic:: |
public | function | Gets whether or not capture is supported. | |
Basic:: |
public | function | Gets the status to set on payment refund. | |
Basic:: |
public | function |
Returns the statuses that can be set on a payment. Overrides PaymentMethodUpdatePaymentStatusInterface:: |
|
Basic:: |
public | function |
Returns the supported currencies. Overrides PaymentMethodBase:: |
|
Basic:: |
public | function |
Checks if the payment status can be updated. Overrides PaymentMethodUpdatePaymentStatusInterface:: |
|
Basic:: |
public | function |
Constructs a new instance. Overrides PaymentMethodBase:: |
|
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
PaymentAwareTrait:: |
protected | property | The payment. | |
PaymentAwareTrait:: |
public | function | ||
PaymentAwareTrait:: |
public | function | ||
PaymentMethodBase:: |
protected | property | The event dispatcher. | |
PaymentMethodBase:: |
protected | property | The module handler. | |
PaymentMethodBase:: |
protected | property | The token API. | |
PaymentMethodBase:: |
public | function |
Form constructor. Overrides PluginFormInterface:: |
|
PaymentMethodBase:: |
public | function |
Calculates dependencies for the configured plugin. Overrides DependentPluginInterface:: |
|
PaymentMethodBase:: |
public | function |
Captures the payment. Overrides PaymentMethodCapturePaymentInterface:: |
|
PaymentMethodBase:: |
public | function |
Checks if the payment can be captured. Overrides PaymentMethodCapturePaymentInterface:: |
|
PaymentMethodBase:: |
public | function |
Gets default configuration for this plugin. Overrides ConfigurableInterface:: |
|
PaymentMethodBase:: |
protected | function | Performs a payment method-specific access check for payment execution. | |
PaymentMethodBase:: |
public | function |
Executes the payment. Overrides PaymentMethodInterface:: |
|
PaymentMethodBase:: |
public | function |
Checks if the payment can be executed. Overrides PaymentMethodInterface:: |
|
PaymentMethodBase:: |
protected | function | Checks a payment's currency against this plugin. | |
PaymentMethodBase:: |
public | function |
The cache contexts associated with this object. Overrides CacheableDependencyInterface:: |
|
PaymentMethodBase:: |
public | function |
The maximum age for which this object may be cached. Overrides CacheableDependencyInterface:: |
|
PaymentMethodBase:: |
public | function |
The cache tags associated with this object. Overrides CacheableDependencyInterface:: |
|
PaymentMethodBase:: |
public | function |
Gets this plugin's configuration. Overrides ConfigurableInterface:: |
|
PaymentMethodBase:: |
public | function | Gets the payer message text. | |
PaymentMethodBase:: |
public | function | Gets the payer message text format. | |
PaymentMethodBase:: |
public | function |
Gets the payment capture status. Overrides PaymentMethodCapturePaymentInterface:: |
|
PaymentMethodBase:: |
public | function |
Gets the payment refund status. Overrides PaymentMethodRefundPaymentInterface:: |
|
PaymentMethodBase:: |
public | function |
Refunds the payment. Overrides PaymentMethodRefundPaymentInterface:: |
|
PaymentMethodBase:: |
public | function |
Checks if the payment can be refunded. Overrides PaymentMethodRefundPaymentInterface:: |
|
PaymentMethodBase:: |
public | function |
Sets the configuration for this plugin instance. Overrides ConfigurableInterface:: |
|
PaymentMethodBase:: |
public | function |
Form submission handler. Overrides PluginFormInterface:: |
|
PaymentMethodBase:: |
public | function |
Form validation handler. Overrides PluginFormInterface:: |
|
PayPalBasic:: |
protected | property | ||
PayPalBasic:: |
protected | function |
Performs the actual payment execution. Overrides Basic:: |
|
PayPalBasic:: |
public | function |
Gets the payment execution status. Overrides PaymentMethodBase:: |
|
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 | ||
PluginBase:: |
protected | property | Configuration information passed into the plugin. | 1 |
PluginBase:: |
protected | property | The plugin implementation definition. | 1 |
PluginBase:: |
protected | property | The plugin_id. | |
PluginBase:: |
constant | A string which is used to separate base plugin IDs from the derivative ID. | ||
PluginBase:: |
public | function |
Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface:: |
|
PluginBase:: |
public | function |
Gets the definition of the plugin implementation. Overrides PluginInspectionInterface:: |
3 |
PluginBase:: |
public | function |
Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface:: |
|
PluginBase:: |
public | function | Determines if the plugin is configurable. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |