/** * Validates the card verification value * * @return bool PEAR_Error is CVV was set and is not valid, TRUE otherwise * @access protected */ function _validateCvv() { if (strlen($this->cvv) == 0) { return true; } if (!($type = $this->_mapType())) { return PEAR::raiseError('Invalid type map provided in driver'); } if (!Validate_Finance_CreditCard::cvv($this->cvv, $type)) { return PEAR::raiseError('CVV code is invalid or does not match the card type'); } return true; }
static function cvv($value, $type) { require_once 'Validate/Finance/CreditCard.php'; return Validate_Finance_CreditCard::cvv($value, $type); }
/** * Validates the card verification value * * @return bool * @throws Payment_Process2_Exception * @access protected */ function _validateCvv() { if (strlen($this->cvv) == 0) { return true; } if (!($type = $this->_mapType())) { throw new Payment_Process2_Exception('Invalid type map provided in driver'); } if (!Validate_Finance_CreditCard::cvv($this->cvv, $type)) { throw new Payment_Process2_Exception('CVV code is invalid or does not match the card type'); } return true; }