function commerce_cardonfile_card_form_validate in Commerce Card on File 7.2
Validation callback for commerce_cardonfile_card_form().
File
- includes/
commerce_cardonfile.pages.inc, line 156 - User page callbacks and forms for Commerce Card on File.
Code
function commerce_cardonfile_card_form_validate($form, &$form_state) {
module_load_include('inc', 'commerce_payment', 'includes/commerce_payment.credit_card');
if ($form_state['op'] == 'create') {
commerce_payment_credit_card_validate($form_state['values']['credit_card'], array(
'form_parents' => array(
'credit_card',
),
));
}
else {
// Ensure the expiration date is not being updated to a past date.
$exp_valid = commerce_payment_validate_credit_card_exp_date($form_state['values']['credit_card']['exp_month'], $form_state['values']['credit_card']['exp_year']);
if ($exp_valid !== TRUE) {
form_set_error('credit_card][exp_' . $exp_valid, t('You have specified an expired credit card.'));
}
}
}