You are here

public function CashOnDelivery::orderSubmit in Ubercart 8.4

Called when an order is being submitted with this payment method.

Parameters

\Drupal\uc_order\OrderInterface $order: The order that is being submitted.

Return value

string|null An error message that can be shown to the user if the payment failed, or NULL if everything was successful.

Overrides PaymentMethodPluginBase::orderSubmit

File

payment/uc_payment_pack/src/Plugin/Ubercart/PaymentMethod/CashOnDelivery.php, line 192

Class

CashOnDelivery
Defines the cash on delivery payment method.

Namespace

Drupal\uc_payment_pack\Plugin\Ubercart\PaymentMethod

Code

public function orderSubmit(OrderInterface $order) {
  $max = $this->configuration['max_order'];
  if ($max > 0 && $order
    ->getTotal() > $max) {
    return $this
      ->t('Your final order total exceeds the maximum for COD payment. Please go back and select a different method of payment.');
  }
}