You are here

function pay_method_gateway::cc_ccv2_validate in Pay 7

Same name and namespace in other branches
  1. 6 includes/handlers/pay_method_gateway.inc \pay_method_gateway::cc_ccv2_validate()
1 call to pay_method_gateway::cc_ccv2_validate()
pay_method_gateway::pay_method_validate in includes/handlers/pay_method_gateway.inc
@todo Please document this function.

File

includes/handlers/pay_method_gateway.inc, line 345
The base class for credit card payment activities.

Class

pay_method_gateway
@file The base class for credit card payment activities.

Code

function cc_ccv2_validate() {
  if ($this->cc_ccv2) {
    if ($this->cc_type == 'amex') {
      if (strlen($this->cc_ccv2) != 4) {
        $this->error_message = t('The security code must be 4 numeric digits for American Express cards');
        return FALSE;
      }
    }
    elseif (strlen($this->cc_ccv2) != 3) {
      $this->error_message = t('The security code must be 3 numeric digits.');
      return FALSE;
    }
  }
  return TRUE;
}