You are here

public function TwoCheckout::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_2checkout/src/Plugin/Ubercart/PaymentMethod/TwoCheckout.php, line 153

Class

TwoCheckout
Defines the 2Checkout payment method.

Namespace

Drupal\uc_2checkout\Plugin\Ubercart\PaymentMethod

Code

public function cartProcess(OrderInterface $order, array $form, FormStateInterface $form_state) {
  $session = \Drupal::service('session');
  if (NULL != $form_state
    ->getValue([
    'panes',
    'payment',
    'details',
    'pay_method',
  ])) {
    $session
      ->set('pay_method', $form_state
      ->getValue([
      'panes',
      'payment',
      'details',
      'pay_method',
    ]));
  }
  return TRUE;
}