You are here

public function Echeck::voidPayment in Commerce Authorize.Net 8

Voids the given payment.

Parameters

\Drupal\commerce_payment\Entity\PaymentInterface $payment: The payment to void.

Throws

\Drupal\commerce_payment\Exception\PaymentGatewayException Thrown when the transaction fails for any reason.

Overrides OnsiteBase::voidPayment

File

src/Plugin/Commerce/PaymentGateway/Echeck.php, line 158

Class

Echeck
Provides the Authorize.net echeck payment gateway.

Namespace

Drupal\commerce_authnet\Plugin\Commerce\PaymentGateway

Code

public function voidPayment(PaymentInterface $payment) {
  $this
    ->assertPaymentState($payment, [
    'pending',
  ]);
  $payment
    ->setState('voided');
  $payment
    ->save();
}