public function PaymentGatewayBase::__construct in Commerce Core 8.2
Constructs a new PaymentGatewayBase object.
Parameters
array $configuration: A configuration array containing information about the plugin instance.
string $plugin_id: The plugin_id for the plugin instance.
mixed $plugin_definition: The plugin implementation definition.
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: The entity type manager.
\Drupal\commerce_payment\PaymentTypeManager $payment_type_manager: The payment type manager.
\Drupal\commerce_payment\PaymentMethodTypeManager $payment_method_type_manager: The payment method type manager.
\Drupal\Component\Datetime\TimeInterface $time: The time.
\Drupal\commerce_price\MinorUnitsConverterInterface $minor_units_converter: The minor units converter.
Overrides PluginBase::__construct
3 calls to PaymentGatewayBase::__construct()
- Manual::__construct in modules/
payment/ src/ Plugin/ Commerce/ PaymentGateway/ Manual.php - Constructs a new Manual object.
- Onsite::__construct in modules/
payment_example/ src/ Plugin/ Commerce/ PaymentGateway/ Onsite.php - Constructs a new PaymentGatewayBase object.
- StoredOffsiteRedirect::__construct in modules/
payment_example/ src/ Plugin/ Commerce/ PaymentGateway/ StoredOffsiteRedirect.php - Constructs a new PaymentGatewayBase object.
3 methods override PaymentGatewayBase::__construct()
- Manual::__construct in modules/
payment/ src/ Plugin/ Commerce/ PaymentGateway/ Manual.php - Constructs a new Manual object.
- Onsite::__construct in modules/
payment_example/ src/ Plugin/ Commerce/ PaymentGateway/ Onsite.php - Constructs a new PaymentGatewayBase object.
- StoredOffsiteRedirect::__construct in modules/
payment_example/ src/ Plugin/ Commerce/ PaymentGateway/ StoredOffsiteRedirect.php - Constructs a new PaymentGatewayBase object.
File
- modules/
payment/ src/ Plugin/ Commerce/ PaymentGateway/ PaymentGatewayBase.php, line 105
Class
- PaymentGatewayBase
- Provides the base class for payment gateways.
Namespace
Drupal\commerce_payment\Plugin\Commerce\PaymentGatewayCode
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, PaymentTypeManager $payment_type_manager, PaymentMethodTypeManager $payment_method_type_manager, TimeInterface $time, MinorUnitsConverterInterface $minor_units_converter = NULL) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->entityTypeManager = $entity_type_manager;
$this->time = $time;
if (!$minor_units_converter instanceof MinorUnitsConverterInterface) {
@trigger_error('Calling PaymentGatewayBase::__construct() with the $minor_units_converter argument is supported in commerce:2.25 and will be required before commerce:3.0. See https://www.drupal.org/project/commerce/issues/3150917.', E_USER_DEPRECATED);
$minor_units_converter = \Drupal::service('commerce_price.minor_units_converter');
}
$this->minorUnitsConverter = $minor_units_converter;
if (array_key_exists('_entity', $configuration)) {
$this->parentEntity = $configuration['_entity'];
$this->entityId = $this->parentEntity
->id();
unset($configuration['_entity']);
}
// Instantiate the types right away to ensure that their IDs are valid.
$this->paymentType = $payment_type_manager
->createInstance($this->pluginDefinition['payment_type']);
foreach ($this->pluginDefinition['payment_method_types'] as $plugin_id) {
$this->paymentMethodTypes[$plugin_id] = $payment_method_type_manager
->createInstance($plugin_id);
}
$this->pluginDefinition['forms'] += $this
->getDefaultForms();
$this
->setConfiguration($configuration);
}