You are here

public function DisablePaymentMethodConfiguration::execute in Payment 8.2

Disables a payment method configuration.

Parameters

\Drupal\payment\Entity\PaymentMethodConfigurationInterface $payment_method_configuration:

Return value

\Symfony\Component\HttpFoundation\RedirectResponse

1 string reference to 'DisablePaymentMethodConfiguration::execute'
payment.routing.yml in ./payment.routing.yml
payment.routing.yml

File

src/Controller/DisablePaymentMethodConfiguration.php, line 21

Class

DisablePaymentMethodConfiguration
Handles the "disable payment method configuration" route.

Namespace

Drupal\payment\Controller

Code

public function execute(PaymentMethodConfigurationInterface $payment_method_configuration) {
  $payment_method_configuration
    ->disable();
  $payment_method_configuration
    ->save();
  return new RedirectResponse($payment_method_configuration
    ->toUrl('collection')
    ->setAbsolute()
    ->toString());
}