/** * check if the expired Date is ok * @param $storedCreditCards */ function isValidExpiredDate($creditCards) { if (!class_exists('Creditcard')) { require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'creditcard.php'; } foreach ($creditCards as $creditCard) { $exp_date = $this->explodeExpDate($creditCard->realex_hpp_api_saved_pmt_expdate); $creditCard->validExpiredDate = Creditcard::validate_credit_card_date('', $exp_date['mm'], $exp_date['yy']); } return $creditCards; }
function _validate_creditcard_data($enqueueMessage = TRUE) { $html = ''; $this->_cc_valid = TRUE; if (!Creditcard::validate_credit_card_number($this->_cc_type, $this->_cc_number)) { $this->_errormessage[] = 'VMPAYMENT_AUTHORIZENET_CARD_NUMBER_INVALID'; $this->_cc_valid = FALSE; } if (!Creditcard::validate_credit_card_cvv($this->_cc_type, $this->_cc_cvv)) { $this->_errormessage[] = 'VMPAYMENT_AUTHORIZENET_CARD_CVV_INVALID'; $this->_cc_valid = FALSE; } if (!Creditcard::validate_credit_card_date($this->_cc_type, $this->_cc_expire_month, $this->_cc_expire_year)) { $this->_errormessage[] = 'VMPAYMENT_AUTHORIZENET_CARD_EXPIRATION_DATE_INVALID'; $this->_cc_valid = FALSE; } if (!$this->_cc_valid) { //$html.= "<ul>"; foreach ($this->_errormessage as $msg) { //$html .= "<li>" . vmText::_($msg) . "</li>"; $html .= vmText::_($msg) . "<br/>"; } //$html.= "</ul>"; } if (!$this->_cc_valid && $enqueueMessage) { $app = JFactory::getApplication(); $app->enqueueMessage($html); } return $this->_cc_valid; }
/** * @param bool $enqueueMessage * @return bool */ function validateRemoteCCForm($enqueueMessage = true) { if (!class_exists('Creditcard')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'creditcard.php'; } $html = ''; $cc_valid = true; $errormessages = array(); $saved_cc_selected = $this->customerData->getVar('saved_cc_selected'); $cc_type = $this->customerData->getVar('cc_type'); $cc_number = $this->customerData->getVar('cc_number'); $cc_name = $this->customerData->getVar('cc_name'); $cc_cvv = $this->customerData->getVar('cc_cvv'); $cc_expire_month = $this->customerData->getVar('cc_expire_month'); $cc_expire_year = $this->customerData->getVar('cc_expire_year'); if (!Creditcard::validate_credit_card_number($cc_type, $cc_number)) { $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_CARD_NUMBER_INVALID'; $cc_valid = false; } if ($this->_method->cvn_checking and !Creditcard::validate_credit_card_cvv($cc_type, $cc_cvv, true, $cc_number)) { $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_CARD_CVV_INVALID'; $cc_valid = false; } if (!Creditcard::validate_credit_card_date($cc_type, $cc_expire_month, $cc_expire_year)) { $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_CARD_EXPIRATION_DATE_INVALID'; $cc_valid = false; } if (empty($cc_name)) { $errormessages[] = 'VMPAYMENT_REALEX_HPP_API_CC_NAME_INVALID'; $cc_valid = false; } if (!$cc_valid) { foreach ($errormessages as $msg) { $html .= vmText::_($msg) . "<br/>"; } } if (!$cc_valid) { $app = JFactory::getApplication(); $app->enqueueMessage($html, 'error'); return false; } return true; }
function validate($enqueueMessage = true) { if (!class_exists('Creditcard')) { require VMPATH_ADMIN . DS . 'helpers' . DS . 'creditcard.php'; } $html = ''; $cc_valid = true; $errormessages = array(); $cc_type = $this->customerData->getVar('cc_type'); $cc_number = $this->customerData->getVar('cc_number'); $cc_cvv = $this->customerData->getVar('cc_cvv'); $cc_expire_month = $this->customerData->getVar('cc_expire_month'); $cc_expire_year = $this->customerData->getVar('cc_expire_year'); if (!Creditcard::validate_credit_card_number($cc_type, $cc_number)) { $errormessages[] = 'VMPAYMENT_PAYPAL_CC_CARD_NUMBER_INVALID'; $cc_valid = false; } if ($this->_method->cvv_required or $cc_type == 'Maestro') { $required = true; } else { $required = false; } if (!Creditcard::validate_credit_card_cvv($cc_type, $cc_cvv, $required)) { $errormessages[] = 'VMPAYMENT_PAYPAL_CC_CARD_CVV_INVALID'; $cc_valid = false; } if (!Creditcard::validate_credit_card_date($cc_type, $cc_expire_month, $cc_expire_year)) { $errormessages[] = 'VMPAYMENT_PAYPAL_CC_CARD_DATE_INVALID'; $cc_valid = false; } if (!$cc_valid) { foreach ($errormessages as $msg) { $html .= tsmText::_($msg) . "<br/>"; } } if (!$cc_valid && $enqueueMessage) { $app = JFactory::getApplication(); $app->enqueueMessage($html, 'error'); } $displayInfoMsg = ""; if (!$cc_valid) { $displayInfoMsg = false; return false; } else { return parent::validate($displayInfoMsg); } }
function _validate_velocity_creditcard_data($enqueueMessage = TRUE) { static $force = true; if (empty($this->_cc_number) and empty($this->_cc_cvv)) { return false; } $html = ''; $this->_cc_valid = !empty($this->_cc_number) and !empty($this->_cc_cvv) and !empty($this->_cc_expire_month) and !empty($this->_cc_expire_year); if (!empty($this->_cc_number) and !Creditcard::validate_credit_card_number($this->_cc_type, $this->_cc_number)) { $this->_errormessage[] = 'VMPAYMENT_VELOCITY_CARD_NUMBER_INVALID'; $this->_cc_valid = FALSE; } if (!Creditcard::validate_credit_card_cvv($this->_cc_type, $this->_cc_cvv)) { $this->_errormessage[] = 'VMPAYMENT_VELOCITY_CARD_CVV_INVALID'; $this->_cc_valid = FALSE; } if (!Creditcard::validate_credit_card_date($this->_cc_type, $this->_cc_expire_month, $this->_cc_expire_year)) { $this->_errormessage[] = 'VMPAYMENT_VELOCITY_CARD_EXPIRATION_DATE_INVALID'; $this->_cc_valid = FALSE; } if (!$this->_cc_valid) { //$html.= "<ul>"; foreach ($this->_errormessage as $msg) { //$html .= "<li>" . vmText::_($msg) . "</li>"; $html .= vmText::_($msg) . "<br/>"; } //$html.= "</ul>"; } if (!$this->_cc_valid && $enqueueMessage && $force) { $app = JFactory::getApplication(); $app->enqueueMessage($html); $force = false; } return $this->_cc_valid; }
function _validate_creditcard_data($enqueueMessage = true) { static $force = true; $emptyEssentialFields = empty(self::$_cc_number) || empty(self::$_cc_cvv) || empty(self::$_cc_name); if ($emptyEssentialFields) { return false; } $html = ''; $this->_cc_valid = true; if (!Creditcard::validate_credit_card_cvv(self::$_cc_type, self::$_cc_cvv)) { $this->_errormessage[] = 'VMPAYMENT_EVERYPAY_CARD_CVV_INVALID'; $this->_cc_valid = false; } if (!Creditcard::validate_credit_card_date(self::$_cc_type, self::$_cc_expire_month, self::$_cc_expire_year)) { $this->_errormessage[] = 'VMPAYMENT_EVERYPAY_CARD_EXPIRATION_DATE_INVALID'; $this->_cc_valid = false; } if (!$this->_cc_valid) { //$html.= "<ul>"; foreach ($this->_errormessage as $msg) { //$html .= "<li>" . vmText::_($msg) . "</li>"; $html .= vmText::_($msg) . "<br/>"; } //$html.= "</ul>"; } if (!$this->_cc_valid && $enqueueMessage && $force) { $app = JFactory::getApplication(); $app->enqueueMessage($html); $force = false; } return $this->_cc_valid; }