You are here

function uc_credit_terminal_form_validate in Ubercart 5

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

File

payment/uc_credit/uc_credit.module, line 1418
Defines the credit card payment method and hooks in payment gateways.

Code

function uc_credit_terminal_form_validate($form_id, $form_values) {
  switch ($form_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_values['amount']) || $form_values['amount'] <= 0) {
        form_set_error('amount', t('You must enter a positive number for the amount.'));
      }
  }
  if (uc_order_load($form_values['order_id']) === FALSE) {
    form_set_error('', t('Invalid order ID.  Unable to process payment.'));
  }
}