abstract class PayPalBasic in PayPal for Payment 8
Same name in this branch
- 8 src/Plugin/Payment/MethodConfiguration/PayPalBasic.php \Drupal\paypal_payment\Plugin\Payment\MethodConfiguration\PayPalBasic
- 8 src/Plugin/Payment/Method/PayPalBasic.php \Drupal\paypal_payment\Plugin\Payment\Method\PayPalBasic
Same name and namespace in other branches
- 2.0.x src/Plugin/Payment/MethodConfiguration/PayPalBasic.php \Drupal\paypal_payment\Plugin\Payment\MethodConfiguration\PayPalBasic
Abstract class for PayPal payment method configurations.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements DerivativeInspectionInterface, PluginInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
- class \Drupal\payment\Plugin\Payment\MethodConfiguration\PaymentMethodConfigurationBase implements ConfigurableInterface, DependentPluginInterface, PaymentMethodConfigurationInterface
- class \Drupal\payment\Plugin\Payment\MethodConfiguration\Basic implements ContainerFactoryPluginInterface
- class \Drupal\paypal_payment\Plugin\Payment\MethodConfiguration\PayPalBasic
- class \Drupal\payment\Plugin\Payment\MethodConfiguration\Basic implements ContainerFactoryPluginInterface
- class \Drupal\payment\Plugin\Payment\MethodConfiguration\PaymentMethodConfigurationBase implements ConfigurableInterface, DependentPluginInterface, PaymentMethodConfigurationInterface
- class \Drupal\Core\Plugin\PluginBase uses DependencySerializationTrait, MessengerTrait, StringTranslationTrait
Expanded class hierarchy of PayPalBasic
File
- src/
Plugin/ Payment/ MethodConfiguration/ PayPalBasic.php, line 13
Namespace
Drupal\paypal_payment\Plugin\Payment\MethodConfigurationView source
abstract class PayPalBasic extends Basic {
/**
* Gets the setting for the production server.
*
* @return bool
*/
public function isProduction() : bool {
return !empty($this->configuration['production']);
}
/**
* Gets the setting for logging the PayPal API traffic.
*
* @param $type
*
* @return bool
*/
public function isLogging($type) : bool {
return !empty($this->configuration['logging'][$type]);
}
/**
* Gets the setting for the log level.
*
* @return string
*/
public function getLogLevel() : string {
return $this->configuration['loglevel'] ?? 'DEBUG';
}
/**
* {@inheritdoc}
*/
public function processBuildConfigurationForm(array &$element, FormStateInterface $form_state, array &$form) {
parent::processBuildConfigurationForm($element, $form_state, $form);
$element['paypal'] = [
'#type' => 'container',
];
$element['paypal']['production'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Production Server'),
'#default_value' => $this
->isProduction(),
];
$element['paypal']['logging'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Logging'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
];
$element['paypal']['logging']['loglevel'] = [
'#type' => 'select',
'#title' => $this
->t('Log Level'),
'#options' => [
'DEBUG' => $this
->t('Debugging'),
],
'#default_value' => $this
->getLogLevel(),
];
$element['paypal']['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_ADMIN] = [
'#type' => 'checkbox',
'#title' => $this
->t('Logging admin tasks'),
'#default_value' => $this
->isLogging(PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_ADMIN),
];
$element['paypal']['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_CREATE] = [
'#type' => 'checkbox',
'#title' => $this
->t('Logging when creating payment'),
'#default_value' => $this
->isLogging(PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_CREATE),
];
$element['paypal']['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_WEBHOOK] = [
'#type' => 'checkbox',
'#title' => $this
->t('Logging the webhooks'),
'#default_value' => $this
->isLogging(PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_WEBHOOK),
];
$element['paypal']['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_REDIRECT] = [
'#type' => 'checkbox',
'#title' => $this
->t('Logging the redirects back from PayPal'),
'#default_value' => $this
->isLogging(PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_REDIRECT),
];
return $element;
}
/**
* {{@inheritdoc}}
*/
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
parent::submitConfigurationForm($form, $form_state);
$parents = $form['plugin_form']['paypal']['#parents'];
array_pop($parents);
$values = $form_state
->getValues();
$values = NestedArray::getValue($values, $parents);
$this->configuration['production'] = !empty($values['paypal']['production']);
$this->configuration['loglevel'] = $values['paypal']['logging']['loglevel'];
$this->configuration['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_ADMIN] = !empty($values['paypal']['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_ADMIN]);
$this->configuration['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_CREATE] = !empty($values['paypal']['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_CREATE]);
$this->configuration['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_WEBHOOK] = !empty($values['paypal']['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_WEBHOOK]);
$this->configuration['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_REDIRECT] = !empty($values['paypal']['logging'][PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_REDIRECT]);
}
/**
* @return array
*/
public function getDerivativeConfiguration() : array {
return [
'production' => $this
->isProduction(),
'loglevel' => $this
->getLogLevel(),
'logging' => [
PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_ADMIN => $this
->isLogging(PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_ADMIN),
PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_CREATE => $this
->isLogging(PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_CREATE),
PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_WEBHOOK => $this
->isLogging(PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_WEBHOOK),
PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_REDIRECT => $this
->isLogging(PayPalBasicMethod::PAYPAL_CONTEXT_TYPE_REDIRECT),
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Basic:: |
protected | property | The payment status plugin type. | |
Basic:: |
protected | property | The plugin selector manager. | |
Basic:: |
public | function |
Form constructor. Overrides PaymentMethodConfigurationBase:: |
|
Basic:: |
public static | function |
Creates an instance of the plugin. Overrides PaymentMethodConfigurationBase:: |
|
Basic:: |
public | function |
Gets default configuration for this plugin. Overrides PaymentMethodConfigurationBase:: |
|
Basic:: |
public | function | Gets the brand label. | |
Basic:: |
public | function | Gets whether or not capture is supported. | |
Basic:: |
protected | function | Gets the payment status selector for the capture phase. | |
Basic:: |
public | function | Gets the status to set on payment capture. | |
Basic:: |
protected | function | Gets the payment status selector for the execute phase. | |
Basic:: |
public | function | Gets the status to set on payment execution. | |
Basic:: |
protected | function | Gets the payment status selector. | |
Basic:: |
public | function | Gets whether or not refunds are supported. | |
Basic:: |
protected | function | Gets the payment status selector for the refund phase. | |
Basic:: |
public | function | Gets the status to set on payment refund. | |
Basic:: |
public | function | Sets the brand label. | |
Basic:: |
public | function | Sets whether or not capture is supported. | |
Basic:: |
public | function | Sets the status to set on payment capture. | |
Basic:: |
public | function | Sets the status to set on payment execution. | |
Basic:: |
public | function | Sets whether or not refunds are supported. | |
Basic:: |
public | function | Sets the status to set on payment refund. | |
Basic:: |
public | function |
Form validation handler. Overrides PaymentMethodConfigurationBase:: |
|
Basic:: |
public | function |
Constructs a new instance. Overrides PaymentMethodConfigurationBase:: |
|
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. | |
PaymentMethodConfigurationBase:: |
protected | property | The module handler. | |
PaymentMethodConfigurationBase:: |
public | function |
Calculates dependencies for the configured plugin. Overrides DependentPluginInterface:: |
|
PaymentMethodConfigurationBase:: |
public | function |
Gets this plugin's configuration. Overrides ConfigurableInterface:: |
|
PaymentMethodConfigurationBase:: |
public | function | Gets the payer message text. | |
PaymentMethodConfigurationBase:: |
public | function | Gets the payer message text format. | |
PaymentMethodConfigurationBase:: |
public | function |
Sets the configuration for this plugin instance. Overrides ConfigurableInterface:: |
|
PaymentMethodConfigurationBase:: |
public | function | Sets payer message text. | |
PaymentMethodConfigurationBase:: |
public | function | Sets payer message text format. | |
PayPalBasic:: |
public | function | 2 | |
PayPalBasic:: |
public | function | Gets the setting for the log level. | |
PayPalBasic:: |
public | function | Gets the setting for logging the PayPal API traffic. | |
PayPalBasic:: |
public | function | Gets the setting for the production server. | |
PayPalBasic:: |
public | function |
Implements a form API #process callback. Overrides Basic:: |
2 |
PayPalBasic:: |
public | function |
{} Overrides Basic:: |
2 |
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. |