You are here

public function CashOnDelivery::cartProcess in Ubercart 8.4

Called when checkout is submitted with this payment method selected.

Use this method to process any form elements output by the cartDetails() method.

Parameters

\Drupal\uc_order\OrderInterface $order: The order which is being processed.

array $form: The checkout form array.

\Drupal\Core\Form\FormStateInterface $form_state: The checkout form state array.

Return value

bool Return FALSE to abort the checkout process, or any other value to continue the checkout process.

Overrides PaymentMethodPluginBase::cartProcess

File

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

Class

CashOnDelivery
Defines the cash on delivery payment method.

Namespace

Drupal\uc_payment_pack\Plugin\Ubercart\PaymentMethod

Code

public function cartProcess(OrderInterface $order, array $form, FormStateInterface $form_state) {
  if ($this->configuration['delivery_date']) {
    $order->payment_details = $form_state
      ->getValue([
      'panes',
      'payment',
      'details',
    ]);
    if (isset($order->payment_details['delivery_date'])) {
      $order->payment_details['delivery_date'] = $order->payment_details['delivery_date']
        ->getTimestamp();
    }
  }
  return TRUE;
}