You are here

function commerce_payment_validate_credit_card_security_code in Commerce Core 7

Validates a card security code based on the type of the credit card.

Parameters

$number: The number of the credit card to validate the security code against.

$code: The card security code to validate with the given number.

Return value

TRUE or FALSE indicating the security code's validity.

1 call to commerce_payment_validate_credit_card_security_code()
commerce_payment_credit_card_validate in modules/payment/includes/commerce_payment.credit_card.inc
Validates a set of credit card details entered via the credit card form.

File

modules/payment/includes/commerce_payment.credit_card.inc, line 387
Credit-card helper functions for Drupal commerce.

Code

function commerce_payment_validate_credit_card_security_code($number, $code) {
  $type = CommercePaymentCreditCard::detectType($number);
  if (!$type || !is_array($type)) {
    return FALSE;
  }
  return CommercePaymentCreditCard::validateSecurityCode($code, $type);
}