You are here

protected function PaymentExecutionPaymentMethodManager::processDecoratedDefinitions in Payment 8.2

Processes the definitions from the decorated discovery.

Any changes to the decorated definitions should be performed here.

Parameters

mixed[] $decorated_definitions: The decorated plugin definitions, keyed by plugin ID.

Return value

mixed[] The processed plugin definitions.

Overrides PluginDiscoveryDecorator::processDecoratedDefinitions

File

src/Plugin/Payment/Method/PaymentExecutionPaymentMethodManager.php, line 58

Class

PaymentExecutionPaymentMethodManager
Provides a payment method manager for executing a payment.

Namespace

Drupal\payment\Plugin\Payment\Method

Code

protected function processDecoratedDefinitions(array $decorated_definitions) {
  $processed_definitions = [];
  foreach ($decorated_definitions as $plugin_id => $decorated_definition) {

    /** @var \Drupal\payment\Plugin\Payment\Method\PaymentMethodInterface $payment_method */
    $payment_method = $this
      ->createInstance($plugin_id);
    if ($payment_method
      ->executePaymentAccess($this->account)
      ->isAllowed()) {
      $processed_definitions[$plugin_id] = $decorated_definition;
    }
  }
  return $processed_definitions;
}