You are here

function commerce_authnet_acceptjs_submit_form_validate in Commerce Authorize.Net 7

Payment method callback: checkout form validation.

File

includes/commerce_authnet.acceptjs.inc, line 129
Includes the Accept.js payment method callbacks.

Code

function commerce_authnet_acceptjs_submit_form_validate($payment_method, $pane_form, $pane_values, $order, $form_parents = array()) {

  // If the customer specified a card on file, skip the normal validation.
  if (module_exists('commerce_cardonfile') && !empty($payment_method['settings']['cardonfile']) && !empty($pane_values['cardonfile']) && $pane_values['cardonfile'] !== 'new') {
    return;
  }
  $values = $pane_values['credit_card']['cc'];
  if (empty($pane_values['credit_card']['cc']['data_descriptor']) || empty($pane_values['credit_card']['cc']['data_value'])) {
    drupal_set_message('There was an error', 'error');
    return FALSE;
  }
  return TRUE;
}