You are here

protected function PurchaseOrderGateway::assertAuthorized in Commerce Purchase Order 8

Asserts that the payment successfully authorized.

Parameters

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

Throws

\Drupal\commerce_payment\Exception\HardDeclineException Thrown when the payment method did not authorize.

1 call to PurchaseOrderGateway::assertAuthorized()
PurchaseOrderGateway::createPayment in src/Plugin/Commerce/PaymentGateway/PurchaseOrderGateway.php
Creates a payment.

File

src/Plugin/Commerce/PaymentGateway/PurchaseOrderGateway.php, line 290

Class

PurchaseOrderGateway
Provides the On-site payment gateway.

Namespace

Drupal\commerce_purchase_order\Plugin\Commerce\PaymentGateway

Code

protected function assertAuthorized(PaymentInterface $payment) {
  if ($payment
    ->getState()->value != 'authorized') {
    throw new HardDeclineException('The purchase order failed to authorized.  Please contact a site administrator.');
  }
}