You are here

function commerce_amex_void_form_validate in Commerce American Express Payment Gateway (Amex) 7

Validate handler: ensure a valid amount is given.

File

includes/commerce_amex.admin.inc, line 126
Administrative forms for the Amex module.

Code

function commerce_amex_void_form_validate($form, &$form_state) {
  $transaction = $form_state['transaction'];

  // If the authorization has expired, display an error message and redirect.
  if (time() - $transaction->created > 86400 * 30) {
    drupal_set_message(t('This authorization has passed its 30 day limit cannot be voided.'), 'error');
    drupal_goto('admin/commerce/orders/' . $form_state['order']->order_id . '/payment');
  }
}