You are here

protected function CreditCardPaymentMethodBase::validateExpirationDate in Ubercart 8.4

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 if expiration date is in the future, FALSE otherwise.

1 call to CreditCardPaymentMethodBase::validateExpirationDate()
CreditCardPaymentMethodBase::cartProcess in payment/uc_credit/src/CreditCardPaymentMethodBase.php
Called when checkout is submitted with this payment method selected.

File

payment/uc_credit/src/CreditCardPaymentMethodBase.php, line 799

Class

CreditCardPaymentMethodBase
Defines a base credit card payment method plugin implementation.

Namespace

Drupal\uc_credit

Code

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