You are here

public function Manual::voidPayment in Commerce Core 8.2

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 SupportsVoidsInterface::voidPayment

File

modules/payment/src/Plugin/Commerce/PaymentGateway/Manual.php, line 210

Class

Manual
Provides the Manual payment gateway.

Namespace

Drupal\commerce_payment\Plugin\Commerce\PaymentGateway

Code

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