You are here

function _uc_credit_valid_card_expiration in Ubercart 7.3

Validates an expiration date on a card.

Parameters

int $month: The 1 or 2-digit numeric representation of the month, i.e. 1, 6, 12.

int $year: The 4-digit numeric representation of the year, i.e. 2008.

Return value

bool TRUE for non-expired cards, FALSE for expired.

1 call to _uc_credit_valid_card_expiration()
uc_payment_method_credit in payment/uc_credit/uc_credit.module
Callback function for the Credit Card payment method.

File

payment/uc_credit/uc_credit.module, line 912
Defines the credit card payment method and hooks in payment gateways.

Code

function _uc_credit_valid_card_expiration($month, $year) {
  if ($year < date('Y')) {
    return FALSE;
  }
  elseif ($year == date('Y')) {
    if ($month < date('n')) {
      return FALSE;
    }
  }
  return TRUE;
}