本文整理汇总了PHP中Mage_Payment_Model_Method_Cc::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Method_Cc::validate方法的具体用法?PHP Mage_Payment_Model_Method_Cc::validate怎么用?PHP Mage_Payment_Model_Method_Cc::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Payment_Model_Method_Cc
的用法示例。
在下文中一共展示了Mage_Payment_Model_Method_Cc::validate方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
public function validate()
{
$info = $this->getInfoInstance();
if ($info->getCcType() == "DIN" || $info->getCcType() == "ELO") {
return $this;
} else {
parent::validate();
}
return $this;
}
示例2: validate
public function validate()
{
parent::validate();
$paymentInfo = $this->getInfoInstance();
if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
$currency_code = $paymentInfo->getOrder()->getBaseCurrencyCode();
} else {
$currency_code = $paymentInfo->getQuote()->getBaseCurrencyCode();
}
return $this;
}
示例3: validate
public function validate()
{
/*
* calling parent validate function
*/
parent::validate();
$info = $this->getInfoInstance();
$errorMsg = false;
$availableTypes = explode(',', $this->getConfigData('cctypes'));
$ccNumber = $info->getCcNumber();
// remove credit card number delimiters such as "-" and space
$ccNumber = preg_replace('/[\\-\\s]+/', '', $ccNumber);
$info->setCcNumber($ccNumber);
$ccType = '';
if (in_array($info->getCcType(), $availableTypes)) {
if ($this->validateCcNum($ccNumber) || $this->OtherCcType($info->getCcType()) && $this->validateCcNumOther($ccNumber)) {
$ccType = 'OT';
$ccTypeRegExpList = array('SO' => '/(^(6334)[5-9](\\d{11}$|\\d{13,14}$))|(^(6767)(\\d{12}$|\\d{14,15}$))/', 'SM' => '/(^(5[0678])\\d{11,18}$)|(^(6[^05])\\d{11,18}$)|(^(601)[^1]\\d{9,16}$)|(^(6011)\\d{9,11}$)' . '|(^(6011)\\d{13,16}$)|(^(65)\\d{11,13}$)|(^(65)\\d{15,18}$)' . '|(^(49030)[2-9](\\d{10}$|\\d{12,13}$))|(^(49033)[5-9](\\d{10}$|\\d{12,13}$))' . '|(^(49110)[1-2](\\d{10}$|\\d{12,13}$))|(^(49117)[4-9](\\d{10}$|\\d{12,13}$))' . '|(^(49118)[0-2](\\d{10}$|\\d{12,13}$))|(^(4936)(\\d{12}$|\\d{14,15}$))/', 'VI' => '/^4[0-9]{12}([0-9]{3})?$/', 'MC' => '/^5[1-5][0-9]{14}$/', 'AE' => '/^3[47][0-9]{13}$/', 'DN' => '/^3(?:0[0-5]|[68][0-9])[0-9]{11}$/', 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{11})$/');
foreach ($ccTypeRegExpList as $ccTypeMatch => $ccTypeRegExp) {
if (preg_match($ccTypeRegExp, $ccNumber)) {
$ccType = $ccTypeMatch;
break;
}
}
if (!$this->OtherCcType($info->getCcType()) && $ccType != $info->getCcType()) {
$errorMsg = Mage::helper('payment')->__('Credit card number mismatch with credit card type.');
}
} else {
$errorMsg = Mage::helper('payment')->__('Invalid Credit Card Number');
}
} else {
$errorMsg = Mage::helper('payment')->__('Credit card type is not allowed for this payment method.');
}
//validate credit card verification number
if ($errorMsg === false && $this->hasVerification()) {
$verifcationRegEx = $this->getVerificationRegEx();
$regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : '';
if (!$info->getCcCid() || !$regExp || !preg_match($regExp, $info->getCcCid())) {
$errorMsg = Mage::helper('payment')->__('Please enter a valid credit card verification number.');
}
}
if ($ccType != 'SS' && !$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
$errorMsg = Mage::helper('payment')->__('Incorrect credit card expiration date.');
}
if ($errorMsg) {
Mage::throwException($errorMsg);
}
//This must be after all validation conditions
if ($this->getIsCentinelValidationEnabled()) {
$this->getCentinelValidator()->validate($this->getCentinelValidationData());
}
return $this;
}
示例4: validate
public function validate()
{
parent::validate();
$productId00 = Mage::app()->getRequest()->getPost();
$_SESSION['ci'] = $productId00['payment']['cc_ci'];
if (empty($productId00['payment']['cc_ci'])) {
$errorCode = 'invalid_data';
$errorMsg = $this->_getHelper()->__('Por favor llene todo los campos.');
}
if ($errorMsg) {
Mage::throwException($errorMsg);
}
return $this;
}
示例5: validate
/**
* validate the currency code is avaialable to use for Flo2Cash Basic or not
*
* @return bool
*/
public function validate()
{
parent::validate();
$paymentInfo = $this->getInfoInstance();
if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
$currency_code = $paymentInfo->getOrder()->getBaseCurrencyCode();
} else {
$currency_code = $paymentInfo->getQuote()->getBaseCurrencyCode();
}
if (!in_array($currency_code, $this->_allowCurrencyCode)) {
Mage::throwException(Mage::helper('flo2cash')->__('Selected currency code (%s) is not compatible with Flo2Cash', $currency_code));
}
return $this;
}
示例6: validate
/**
* Validate payment method information object
*
* @param Mage_Payment_Model_Info $info
* @return Mage_Payment_Model_Abstract
*/
public function validate()
{
$info = $this->getInfoInstance();
$order_amount = 0;
if ($info instanceof Mage_Sales_Model_Quote_Payment) {
$order_amount = (double) $info->getQuote()->getBaseGrandTotal();
} elseif ($info instanceof Mage_Sales_Model_Order_Payment) {
$order_amount = (double) $info->getOrder()->getQuoteBaseGrandTotal();
}
$order_min = $this->getConfigData('min_order_total');
$order_max = $this->getConfigData('max_order_total');
if (!empty($order_max) && (double) $order_max < $order_amount) {
Mage::throwException("Order amount greater than permissible Maximum order amount.");
}
if (!empty($order_min) && (double) $order_min > $order_amount) {
Mage::throwException("Order amount less than required Minimum order amount.");
}
/*
* calling parent validate function
*/
parent::validate();
}
示例7: validate
/**
* Validate the provided payment information - happens after customer clicks
* next from payment section of checkout.
*
* @return Gorilla_ChasePaymentech_Model_Gateway
*/
public function validate()
{
$paymentInfo = $this->getInfoInstance();
// if the payment_card 'id' is designated as a new card
if ($paymentInfo->getAdditionalInformation('chasepaymentech_card') != Gorilla_ChasePaymentech_Model_Profile::CARD_TYPE_NEW) {
if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
$billingCountry = $paymentInfo->getOrder()->getBillingAddress()->getCountryId();
} else {
$billingCountry = $paymentInfo->getQuote()->getBillingAddress()->getCountryId();
}
if (!$this->canUseForCountry($billingCountry)) {
Mage::throwException($this->_getHelper()->__('Selected payment type is not allowed for billing country.'));
}
$profile = new Gorilla_ChasePaymentech_Model_Profile();
if (!$profile->getCustomerPaymentProfile($paymentInfo->getAdditionalInformation('chasepaymentech_card'))) {
Mage::throwException($this->_getHelper()->__('Error with saved credit card information.'));
}
return $this;
} else {
return parent::validate();
}
}
示例8: validate
/**
* Validate card data.
* @return self
*/
public function validate()
{
// card type can and should always be validated as data is not encrypted
$this->_validateCardType();
if ($this->_isUsingClientSideEncryption) {
return $this->_validateWithEncryptedCardData();
} else {
return parent::validate();
}
}
示例9: validate
/**
* @return Fontis_EwayAu_Model_Token
* @throws Mage_Core_Exception
*/
public function validate()
{
parent::validate();
$paymentInfo = $this->getInfoInstance();
if ($paymentInfo instanceof Mage_Sales_Model_Order_Payment) {
$currencyCode = $paymentInfo->getOrder()->getBaseCurrencyCode();
} else {
$currencyCode = $paymentInfo->getQuote()->getBaseCurrencyCode();
}
if ($currencyCode != $this->getAcceptedCurrency()) {
Mage::throwException($this->getTokenHelper()->__('Selected currency code (%s) is not compatible with eWAY', $currencyCode));
}
return $this;
}
示例10: validate
/**
* Validate the provided payment information - happens after customer clicks
* next from payment section of checkout.
*
* @return Gorilla_Paymentech_Model_Gateway
*/
public function validate()
{
$paymentInfo = $this->getInfoInstance();
//Mage::Log(print_r($paymentInfo -> debug(), true));
if ($paymentInfo->getAdditionalInformation('paymentech_card') != "NEWCARD") {
// stored card
$profile = new Gorilla_Paymentech_Model_Profile();
if ($profile->getProfileByRefNum($paymentInfo->getAdditionalInformation('paymentech_card'))) {
return $this;
}
Mage::throwException("Error with stored Profile");
return $this;
}
return parent::validate();
}
示例11: validate
/**
* Validate the transaction inputs.
*/
public function validate()
{
$this->_log(sprintf('validate(%s)', $this->getInfoInstance()->getCardId()));
if ($this->getInfoInstance()->hasTokenbaseId() === false) {
return parent::validate();
}
return $this;
}