You are here

function uc_credit_terminal_form_validate in Ubercart 6.2

Same name and namespace in other branches
  1. 5 payment/uc_credit/uc_credit.module \uc_credit_terminal_form_validate()
  2. 7.3 payment/uc_credit/uc_credit.admin.inc \uc_credit_terminal_form_validate()

Validation handler for credit terminal form.

See also

uc_credit_terminal_form()

uc_credit_terminal_form_submit()

File

payment/uc_credit/uc_credit.admin.inc, line 235
Credit administration menu items.

Code

function uc_credit_terminal_form_validate($form, &$form_state) {
  switch ($form_state['values']['op']) {
    case t('Charge amount'):
    case t('Authorize amount only'):
    case t('Capture amount to this authorization'):
    case t('Charge amount to this reference'):
      if (!is_numeric($form_state['values']['amount']) || $form_state['values']['amount'] <= 0) {
        form_set_error('amount', t('You must enter a positive number for the amount.'));
      }
  }
  if (uc_order_load($form_state['values']['order_id']) === FALSE) {
    form_set_error('', t('Invalid order ID.  Unable to process payment.'));
  }
}