You are here

public function ExceptionPaymentMethod::getPaymentGateway in Commerce Recurring Framework 8

Gets the payment gateway.

Return value

\Drupal\commerce_payment\Entity\PaymentGatewayInterface|null The payment gateway entity, or null if unknown.

Overrides PaymentMethod::getPaymentGateway

File

tests/modules/commerce_recurring_test/src/Entity/ExceptionPaymentMethod.php, line 18

Class

ExceptionPaymentMethod
Replacement commerce_payment_method entity class that throws an exception.

Namespace

Drupal\commerce_recurring_test\Entity

Code

public function getPaymentGateway() {

  // Throw an exception if the test tells us to via the state. We need this
  // switch because startRecurring() causes this method to be called, at
  // which point we want things to behave normally.
  if (\Drupal::state()
    ->get('commerce_recurring_test.payment_method_throw')) {
    throw new \Exception("This payment is failing dramatically!");
  }
  return parent::getPaymentGateway();
}