You are here

public function PaymentGatewayBase::setConfiguration in Commerce Core 8.2

Sets the configuration for this plugin instance.

Parameters

array $configuration: An associative array containing the plugin's configuration.

Overrides ConfigurableInterface::setConfiguration

1 call to PaymentGatewayBase::setConfiguration()
PaymentGatewayBase::__construct in modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayBase.php
Constructs a new PaymentGatewayBase object.

File

modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayBase.php, line 295

Class

PaymentGatewayBase
Provides the base class for payment gateways.

Namespace

Drupal\commerce_payment\Plugin\Commerce\PaymentGateway

Code

public function setConfiguration(array $configuration) {
  $this->configuration = NestedArray::mergeDeep($this
    ->defaultConfiguration(), $configuration);

  // Providing a default for payment_metod_types in defaultConfiguration()
  // doesn't work because NestedArray::mergeDeep causes duplicates.
  if (empty($this->configuration['payment_method_types'])) {
    $this->configuration['payment_method_types'][] = 'credit_card';
  }
}