function uc_payment_checkout_review_form_validate in Ubercart 8.4
Validation callback for the checkout review form.
1 string reference to 'uc_payment_checkout_review_form_validate'
- uc_payment_form_uc_cart_checkout_review_form_alter in payment/
uc_payment/ uc_payment.module - Implements hook_form_FORM_ID_alter() for uc_cart_checkout_review_form().
File
- payment/
uc_payment/ uc_payment.module, line 92 - Defines the payment API that lets payment modules interact with Ubercart.
Code
function uc_payment_checkout_review_form_validate($form, FormStateInterface $form_state) {
$order = $form_state
->get('uc_order');
/** @var \Drupal\uc_payment\PaymentMethodPluginInterface $plugin */
$plugin = \Drupal::service('plugin.manager.uc_payment.method')
->createFromOrder($order);
// If the plugin failed for any reason, show the message to the user.
if ($message = $plugin
->orderSubmit($order)) {
$form_state
->setErrorByName('', $message);
}
}