abstract class PayPalBasicDeriver in PayPal for Payment 8
Same name and namespace in other branches
- 2.0.x src/Plugin/Payment/Method/PayPalBasicDeriver.php \Drupal\paypal_payment\Plugin\Payment\Method\PayPalBasicDeriver
Abstract class for PayPal payment method derivers.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\payment\Plugin\Payment\Method\BasicDeriver implements ContainerDeriverInterface
- class \Drupal\paypal_payment\Plugin\Payment\Method\PayPalBasicDeriver
- class \Drupal\payment\Plugin\Payment\Method\BasicDeriver implements ContainerDeriverInterface
Expanded class hierarchy of PayPalBasicDeriver
File
- src/
Plugin/ Payment/ Method/ PayPalBasicDeriver.php, line 10
Namespace
Drupal\paypal_payment\Plugin\Payment\MethodView source
abstract class PayPalBasicDeriver extends BasicDeriver {
/**
* TODO: Is there a built in way to determine this id from the deriver?
*
* @return string
*/
protected abstract function getId() : string;
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
/** @var \Drupal\payment\Entity\PaymentMethodConfigurationInterface[] $payment_methods */
$payment_methods = $this->paymentMethodConfigurationStorage
->loadMultiple();
foreach ($payment_methods as $payment_method) {
if ($payment_method
->getPluginId() === $this
->getId()) {
/** @var \Drupal\paypal_payment\Plugin\Payment\MethodConfiguration\PayPalBasic $configuration_plugin */
$configuration_plugin = $this->paymentMethodConfigurationManager
->createInstance($payment_method
->getPluginId(), $payment_method
->getPluginConfiguration());
$this->derivatives[$payment_method
->id()] = [
'id' => $base_plugin_definition['id'] . ':' . $payment_method
->id(),
'active' => $payment_method
->status(),
'label' => $configuration_plugin
->getBrandLabel() ?: $payment_method
->label(),
'message_text' => $configuration_plugin
->getMessageText(),
'message_text_format' => $configuration_plugin
->getMessageTextFormat(),
'execute_status_id' => $configuration_plugin
->getExecuteStatusId(),
'capture' => $configuration_plugin
->getCapture(),
'capture_status_id' => $configuration_plugin
->getCaptureStatusId(),
'refund' => $configuration_plugin
->getRefund(),
'refund_status_id' => $configuration_plugin
->getRefundStatusId(),
] + $configuration_plugin
->getDerivativeConfiguration() + $base_plugin_definition;
}
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
BasicDeriver:: |
protected | property | The payment method configuration manager. | |
BasicDeriver:: |
protected | property | The payment method configuration storage. | |
BasicDeriver:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
BasicDeriver:: |
public | function | Constructs a new instance. | |
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
PayPalBasicDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides BasicDeriver:: |
|
PayPalBasicDeriver:: |
abstract protected | function | TODO: Is there a built in way to determine this id from the deriver? | 2 |