/**
  * {@inheritdoc}
  */
 public function process(OrderInterface $order, array $form, FormStateInterface $form_state)
 {
     if (!$form_state->getValue(['panes', 'payment', 'payment_method'])) {
         $form_state->setErrorByName('panes][payment][payment_method', $this->t('You cannot check out without selecting a payment method.'));
         return FALSE;
     }
     $order->setPaymentMethodId($form_state->getValue(['panes', 'payment', 'payment_method']));
     $result = $this->paymentMethodManager->createFromOrder($order)->cartProcess($order, $form, $form_state);
     return $result !== FALSE;
 }
Example #2
0
 /**
  * {@inheritdoc}
  */
 public function submitForm(OrderInterface $order, array &$form, FormStateInterface $form_state)
 {
     $changes['payment_method'] = $form_state->getValue('payment_method');
     $changes['payment_details'] = $form_state->getValue('payment_details') ?: array();
     $order->setPaymentMethodId($changes['payment_method']);
     $method = \Drupal::service('plugin.manager.uc_payment.method')->createFromOrder($order);
     $return = $method->orderEditProcess($order, $form, $form_state);
     if (is_array($return)) {
         $changes['payment_details'] = array_merge($changes['payment_details'], $return);
     }
     $order->payment_details = $changes['payment_details'];
 }