You are here

function commerce_payment_order_transaction_add_form_validate in Commerce Core 7

Validation callback for commerce_payment_order_transaction_add_form().

File

modules/payment/includes/commerce_payment.forms.inc, line 196
Defines forms for creating and administering payment transactions.

Code

function commerce_payment_order_transaction_add_form_validate($form, &$form_state) {

  // If the button used to submit was not the "Add payment" button, give the
  // payment method a chance to validate the input.
  if (end($form_state['triggering_element']['#array_parents']) != 'add_payment') {
    $payment_method = $form_state['payment_method'];
    $order = $form_state['order'];

    // Find out if the payment details are valid before attempting to process.
    if ($callback = commerce_payment_method_callback($payment_method, 'submit_form_validate')) {
      $callback($payment_method, $form['payment_terminal']['payment_details'], $form_state['values']['payment_details'], $order, array(
        'payment_details',
      ));
    }
  }
}