How add CVV's custom validation before order review in Ubercart I'm developing a Gateway Payment module for Ubercart. It is necessary to validate that the User does not digit three ceros -000- (bank policy) before the order review form. I've seen that Ubercart does the CCV's validation in the uc_credit.module

      if (variable_get('uc_credit_cvv_enabled', TRUE) &amp;&amp; !_valid_cvv($cc_data['cc_cvv'])) {
        if (!$silent) {
          drupal_set_message(t('You have entered an invalid CVV number.'), 'error');
        }
      $return = FALSE;
      }


How could I add my validation without hacking Ubercart modules.

Thanks in advance.
You can create a custom validation function in your module and name it whatever you like for example 'custom_validation_function'. and in the same module add this validation function to the form's validation list by using form_alter.

function &lt;module_name&gt;_form_alter(&amp;$form, &amp;$form_state, $form_id) {

  if ($form_id == '&lt;ubercart_form_id&gt;') {
    $form['#validate'][] = 'custom_validation_function';
  }
}