当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Payment_Model_Method_Abstract::validate方法代码示例

本文整理汇总了PHP中Mage_Payment_Model_Method_Abstract::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Payment_Model_Method_Abstract::validate方法的具体用法?PHP Mage_Payment_Model_Method_Abstract::validate怎么用?PHP Mage_Payment_Model_Method_Abstract::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Payment_Model_Method_Abstract的用法示例。


在下文中一共展示了Mage_Payment_Model_Method_Abstract::validate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validate

 public function validate()
 {
     $errorMsg = '';
     parent::validate();
     $info = $this->getInfoInstance();
     if (!$info->getBankDate()) {
         $errorCode = 'invalid_data';
         $errorMsg = $this->_getHelper()->__("Date is a required field.\n");
     }
     if (!$info->getUserName()) {
         $errorCode = 'invalid_data';
         $errorMsg .= $this->_getHelper()->__('Name is a required field.');
     }
     if (!$info->getBankName()) {
         $errorCode = 'invalid_data';
         $errorMsg .= $this->_getHelper()->__('Bank Name is a required field.');
     }
     if (!$info->getDepositNumber()) {
         $errorCode = 'invalid_data';
         $errorMsg .= $this->_getHelper()->__('Deposit Number is a required field.');
     }
     if ($errorMsg) {
         Mage::throwException($errorMsg);
     }
     return $this;
 }
开发者ID:sajalsoni,项目名称:Btransfer,代码行数:26,代码来源:Paymentmethod.php

示例2: validate

 public function validate()
 {
     parent::validate();
     $info = $this->getInfoInstance();
     /** @var $session Mage_Checkout_Model_Session */
     $session = Mage::getSingleton('checkout/session');
     /** @var Mage_Sales_Model_Quote $quote */
     $quote = $session->getQuote();
     if (is_null($quote)) {
         $quote = $this->getInfoInstance()->getQuote();
     }
     $dob = $quote->getCustomerDob();
     if (empty($dob)) {
         $errorCode = 'invalid_data';
         $errorMsg = $this->_getHelper()->__('Date of Birth is a required field.');
     }
     $gender = $quote->getCustomerGender();
     if (empty($errorMsg) && empty($gender)) {
         $errorCode = 'invalid_data';
         $errorMsg = $this->_getHelper()->__('Gender is a required field.');
     }
     if (empty($errorMsg) && !$this->_isQualified($quote)) {
         $errorMsg = $this->_getHelper()->__('You are not qualified for payment with this method.');
     }
     if (!empty($errorMsg)) {
         Mage::throwException($errorMsg);
     }
     return $this;
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:29,代码来源:Payglobe.php

示例3: validate

 /**
  * Valida dados
  *
  * @param   Mage_Payment_Model_Info $info
  * @return  Mage_Payment_Model_Abstract
  */
 public function validate()
 {
     /*
      * chama validacao do metodo abstrato
      */
     parent::validate();
     if ($this->getConfigData('buypage', $this->getStoreId()) != "loja") {
         return $this;
     }
     $info = $this->getInfoInstance();
     $errorMsg = false;
     $availableTypes = Mage::getModel('Maxima_Cielo/dc_types')->getCodes();
     $ccNumber = Mage::helper('core')->decrypt($info->getCcNumber());
     // remove delimitadores do cartao, como "-" e espaco
     $ccNumber = preg_replace('/[\\-\\s]+/', '', $ccNumber);
     $info->setCcNumber(Mage::helper('core')->encrypt($ccNumber));
     $ccType = '';
     // valida o numero do cartao de credito
     if (in_array($info->getCcType(), $availableTypes)) {
         if ($this->validateCcNum($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}$))/', 'visa' => '/^4[0-9]{12}([0-9]{3})?$/', 'mastercard' => '/^5[1-5][0-9]{14}$/', 'amex' => '/^3[47][0-9]{13}$/', 'discover' => '/^6011[0-9]{12}$/', 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{11})$/', 'diners' => '/^3[0,6,8]\\d{12}$/');
             foreach ($ccTypeRegExpList as $ccTypeMatch => $ccTypeRegExp) {
                 if (preg_match($ccTypeRegExp, $ccNumber)) {
                     $ccType = $ccTypeMatch;
                     break;
                 }
             }
             if ($info->getCcType() != 'elo' && $ccType != $info->getCcType()) {
                 $errorMsg = Mage::helper('Maxima_Cielo')->__('Credit card number mismatch with credit card type.');
             }
         } else {
             $errorMsg = Mage::helper('Maxima_Cielo')->__('Invalid Credit Card Number');
         }
     } else {
         $errorMsg = Mage::helper('Maxima_Cielo')->__('Credit card type is not allowed for this payment method.');
     }
     // valida o numero de verificacao
     if ($errorMsg === false) {
         $verificationRegEx = $this->getVerificationRegEx();
         $regExp = isset($verificationRegEx[$info->getCcType()]) ? $verificationRegEx[$info->getCcType()] : '';
         if ($regExp != '' && (!$info->getCcCid() || !preg_match($regExp, Mage::helper('core')->decrypt($info->getCcCid())))) {
             $errorMsg = Mage::helper('Maxima_Cielo')->__('Please enter a valid credit card verification number.');
         }
     }
     if (!$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
         $errorMsg = Mage::helper('Maxima_Cielo')->__('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;
 }
开发者ID:danielwalterrodrigues,项目名称:asus,代码行数:64,代码来源:Dc.php

示例4: validate

 /**
  * Validate payment method information object
  *
  * @param   Mage_Payment_Model_Info $info
  * @return  Mage_Payment_Model_Abstract
  */
 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('SS' => '/^((6759[0-9]{12})|(6334|6767[0-9]{12})|(6334|6767[0-9]{14,15})|(5018|5020|5038|6304|6759|6761|6763[0-9]{12,19})|(49[013][1356][0-9]{12})|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$/', 'VI' => '/^4[0-9]{12}([0-9]{3})?$/', 'MC' => '/^5[1-5][0-9]{14}$/', 'AE' => '/^3[47][0-9]{13}$/', 'DI' => '/^6011[0-9]{12}$/', 'JCB' => '/^(3[0-9]{15}|(2131|1800)[0-9]{11})$/', '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}$))/', 'SO' => '/(^(6334)[5-9](\\d{11}$|\\d{13,14}$))|(^(6767)(\\d{12}$|\\d{14,15}$))/');
             foreach ($ccTypeRegExpList as $ccTypeMatch => $ccTypeRegExp) {
                 if (preg_match($ccTypeRegExp, $ccNumber)) {
                     $ccType = $ccTypeMatch;
                     break;
                 }
             }
             if (!$this->OtherCcType($info->getCcType()) && $ccType != $info->getCcType()) {
                 $errorCode = 'ccsave_cc_type,ccsave_cc_number';
                 $errorMsg = $this->_getHelper()->__('Credit card number mismatch with credit card type.');
             }
         } else {
             $errorCode = 'ccsave_cc_number';
             $errorMsg = $this->_getHelper()->__('Invalid Credit Card Number');
         }
     } else {
         $errorCode = 'ccsave_cc_type';
         $errorMsg = $this->_getHelper()->__('Credit card type is not allowed for this payment method.');
     }
     //validate credit card verification number
     if ($errorMsg === false && $this->hasVerification() && $ccType != 'SS') {
         $verifcationRegEx = $this->getVerificationRegEx();
         $regExp = isset($verifcationRegEx[$info->getCcType()]) ? $verifcationRegEx[$info->getCcType()] : '';
         if (!$info->getCcCid() || !$regExp || !preg_match($regExp, $info->getCcCid())) {
             $errorMsg = $this->_getHelper()->__('Please enter a valid credit card verification number.');
         }
     }
     if ($ccType != 'SS' && !$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
         $errorCode = 'ccsave_expiration,ccsave_expiration_yr';
         $errorMsg = $this->_getHelper()->__('Incorrect credit card expiration date.');
     }
     if ($errorMsg) {
         Mage::throwException($errorMsg);
         //throw Mage::exception('Mage_Payment', $errorMsg, $errorCode);
     }
     //This must be after all validation conditions
     if ($this->getIsCentinelValidationEnabled()) {
         $this->getCentinelValidator()->validate($this->getCentinelValidationData());
     }
     return $this;
 }
开发者ID:jweiss,项目名称:Magento-Example,代码行数:64,代码来源:Cc.php

示例5: validate

 public function validate()
 {
     parent::validate();
     $currency_code = $this->getQuote()->getBaseCurrencyCode();
     if (!in_array($currency_code, $this->_allowCurrencyCode)) {
         Mage::throwException(Mage::helper('pagamentodigital')->__('Selected currency code (' . $currency_code . ') is not compatabile with Pagamento Digital'));
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:9,代码来源:Standard.php

示例6: validate

 /**
  * Validate.
  *
  * This is just a little hack in order to generate REF from Order ID after Order is created.
  */
 public function validate()
 {
     $order = $this->getInfoInstance()->getOrder();
     if ($order) {
         // Force to generate REF from Order ID.
         $this->assignData(null);
     }
     return parent::validate();
 }
开发者ID:rob3000,项目名称:fontis_australia,代码行数:14,代码来源:Bpay.php

示例7: validate

 public function validate()
 {
     parent::validate();
     $currency_code = $this->getQuote()->getBaseCurrencyCode() ? $this->getQuote()->getBaseCurrencyCode() : 'USD';
     if (!in_array($currency_code, $this->_allowCurrencyCode)) {
         Mage::throwException(Mage::helper('firstdatae4')->__('Selected currency code (' . $currency_code . ') is not compatabile with FirstdataE4'));
     }
     return $this;
 }
开发者ID:Gilbertoavitia1,项目名称:AHBS,代码行数:9,代码来源:Standard.php

示例8: validate

 public function validate()
 {
     parent::validate();
     $currency_code = $this->getQuote()->getBaseCurrencyCode();
     if (!in_array($currency_code, $this->_allowCurrencyCode)) {
         Mage::throwException(Mage::helper()->__('Currency code (%s) is not compatible with Bancomer', $currency_code));
     }
     return $this;
 }
开发者ID:jpaezsa,项目名称:magento-bancomer,代码行数:9,代码来源:PaymentMethod.php

示例9: validate

 public function validate()
 {
     parent::validate();
     $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
     if (!in_array($currency_code, $this->_allowCurrencyCode)) {
         Mage::throwException(Mage::helper('transparente')->__('Selected currency code (' . $currency_code . ') is not compatabile with Transparente'));
     }
     return $this;
 }
开发者ID:rafaelstz,项目名称:moip-transparente,代码行数:9,代码来源:Standard.php

示例10: validate

 public function validate()
 {
     parent::validate();
     $info = $this->getInfoInstance();
     $deposito = $info->getDeposito();
     if (empty($deposito)) {
         Mage::throwException('Selecione um banco');
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:10,代码来源:Deposito.php

示例11: validate

 /**
  * 
  * Validate the currency code is available to use for LiqPay or not
  * 
  */
 public function validate()
 {
     parent::validate();
     $currency_code = $this->getQuote()->getBaseCurrencyCode();
     // Would like to use current currency?
     // $currency_code = Mage::app()->getStore()->getCurrentCurrencyCode();
     if (!in_array($currency_code, $this->_allowCurrencyCode)) {
         Mage::throwException(Mage::helper('pbliqpay')->__('Selected currency (') . $currency_code . Mage::helper('pbliqpay')->__(') is incompatible with LiqPay.'));
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:16,代码来源:Liqpay.php

示例12: validate

 public function validate()
 {
     parent::validate();
     if (!Mage::app()->getFrontController()->getAction() instanceof Mage_Adminhtml_Sales_Order_EditController) {
         $currency_code = $this->getQuote()->getBaseCurrencyCode();
         if (!in_array($currency_code, $this->_allowCurrencyCode)) {
             Mage::throwException(Mage::helper('quickpaypayment')->__('Valutakoden (%s) er ikke kompatible med Quickpay', $currency_code));
         }
     }
     return $this;
 }
开发者ID:axovel,项目名称:easycarcare,代码行数:11,代码来源:Payment.php

示例13: 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;
 }
开发者ID:rajarshc,项目名称:Rooja,代码行数:11,代码来源:Standard.php

示例14: validate

 /**
  * Validate payment method information object
  *
  * @param   Mage_Payment_Model_Info $info
  * @return  Mage_Payment_Model_Abstract
  */
 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';
             $discoverNetworkRegexp = '/^(30[0-5]\\d{13}|3095\\d{12}|35(2[8-9]\\d{12}|[3-8]\\d{13})|36\\d{12}' . '|3[8-9]\\d{14}|6011(0\\d{11}|[2-4]\\d{11}|74\\d{10}|7[7-9]\\d{10}|8[6-9]\\d{10}|9\\d{11})' . '|62(2(12[6-9]\\d{10}|1[3-9]\\d{11}|[2-8]\\d{12}|9[0-1]\\d{11}|92[0-5]\\d{10})|[4-6]\\d{13}' . '|8[2-8]\\d{12})|6(4[4-9]\\d{13}|5\\d{14}))$/';
             $ccTypeRegExpList = array('SO' => '/(^(6334)[5-9](\\d{11}$|\\d{13,14}$))|(^(6767)(\\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}$/', 'DI' => $discoverNetworkRegexp, 'DICL' => $discoverNetworkRegexp, 'JCB' => $discoverNetworkRegexp, '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}$))/');
             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;
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:60,代码来源:Cc.php

示例15: validate

 public function validate()
 {
     parent::validate();
     $info = $this->getInfoInstance();
     $additional_data = unserialize($info->getAdditionalData());
     $code_banco = $additional_data['code_banco'];
     if ($this->isEmptyString($code_banco)) {
         throw new Mage_Payment_Exception('Escolha o Banco');
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:emporiodopara,代码行数:11,代码来源:Standard.php


注:本文中的Mage_Payment_Model_Method_Abstract::validate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。