You are here

function _uc_credit_valid_card_start in Ubercart 7.3

Validates a start 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 cards whose start date is blank (both month and year) or in the past, FALSE otherwise.

1 call to _uc_credit_valid_card_start()
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 880
Defines the credit card payment method and hooks in payment gateways.

Code

function _uc_credit_valid_card_start($month, $year) {
  if (empty($month) && empty($year)) {
    return TRUE;
  }
  if (empty($month) || empty($year)) {
    return FALSE;
  }
  if ($year > date('Y')) {
    return FALSE;
  }
  elseif ($year == date('Y')) {
    if ($month > date('n')) {
      return FALSE;
    }
  }
  return TRUE;
}