Example #1
0
 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;
 }
 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;
 }
Example #3
0
 /**
  * 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;
 }
Example #4
0
 /**
  * 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;
 }
Example #5
0
 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;
 }
Example #6
0
 /**
  * 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();
 }
Example #7
0
 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;
 }
 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;
 }
Example #9
0
 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;
 }
Example #10
0
 public function validate()
 {
     parent::validate();
     $info = $this->getInfoInstance();
     $deposito = $info->getDeposito();
     if (empty($deposito)) {
         Mage::throwException('Selecione um banco');
     }
     return $this;
 }
Example #11
0
 /**
  * 
  * 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;
 }
Example #12
0
 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;
 }
Example #13
0
 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;
 }
Example #14
0
 /**
  * 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;
 }
Example #15
0
 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;
 }
Example #16
0
 /**
  * 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 (!$this->_validateExpDate($info->getCcExpYear(), $info->getCcExpMonth())) {
         $errorCode = 'ccsave_expiration,ccsave_expiration_yr';
         $errorMsg = $this->_getHelper()->__('Incorrect credit card expiration date');
     }
     if (in_array($info->getCcType(), $availableTypes)) {
         if ($this->validateCcNum($ccNumber) || $this->OtherCcType($info->getCcType()) && $this->validateCcNumOther($ccNumber)) {
             $ccType = 'OT';
             $ccTypeRegExpList = array('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}$/', 'SS' => '/^((6759[0-9]{12})|(49[013][1356][0-9]{13})|(633[34][0-9]{12})|(633110[0-9]{10})|(564182[0-9]{10}))([0-9]{2,3})?$/');
             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()) {
         $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 ($errorMsg) {
         Mage::throwException($errorMsg);
         //throw Mage::exception('Mage_Payment', $errorMsg, $errorCode);
     }
     return $this;
 }
Example #17
0
 public function validate()
 {
     parent::validate();
     $currency_code = $this->getQuote()->getBaseCurrencyCode();
     if ($currency_code == '') {
         $currency_code = Mage::getSingleton('adminhtml/session_quote')->getQuote()->getBaseCurrencyCode();
     }
     if (!in_array($currency_code, $this->_allowCurrencyCode)) {
         Mage::throwException(Mage::helper('bb')->__('A moeda selecionada (' . $currency_code . ') não é compatível com o método de pagamento'));
     }
     return $this;
 }
Example #18
0
 public function validate()
 {
     parent::validate();
     // extraer datos de configuracion
     $prod = $this->getConfigData('prod');
     // entorno de produccion
     if ($prod == '1') {
         if (trim($this->getConfigData('sucursalkey')) == '' || trim($this->getConfigData('usuariokey')) == '') {
             Mage::throwException("Datos incompletos del servicio, contacte al administrador del sitio");
         }
     }
     return $this;
 }
Example #19
0
 public function validate()
 {
     parent::validate();
     $info = $this->getInfoInstance();
     $pan_no = $info->getPanno();
     if (empty($pan_no)) {
         $errorCode = 'invalid_data';
         $errorMsg = $this->_getHelper()->__('Please Provide PAN Number}');
     }
     if ($errorMsg) {
         Mage::throwException($errorMsg);
     }
     return $this;
 }
Example #20
0
 /**
  * validate the currency code is avaialable to use for iDEAL 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)) {
         AO::throwException(AO::helper('ideal')->__('Selected currency code (%s) is not compatible with iDEAL', $currency_code));
     }
     return $this;
 }
Example #21
0
 public function validate()
 {
     parent::validate();
     if (!$this->getQuote()->getPayment()->getSuHolder()) {
         Mage::throwException(Mage::helper('pnsofortueberweisung')->__('Please fill out the account holder'));
     }
     if (!$this->getQuote()->getPayment()->getSuBankCode()) {
         Mage::throwException(Mage::helper('pnsofortueberweisung')->__('Please fill out the account number'));
     }
     if (!$this->getQuote()->getPayment()->getSuBankCode()) {
         Mage::throwException(Mage::helper('pnsofortueberweisung')->__('Please fill out the bank code'));
     }
     return $this;
 }
Example #22
0
 public function validate()
 {
     parent::validate();
     $info = $this->getInfoInstance();
     $no = $info->getTransactionId();
     if (empty($no)) {
         $errorCode = 'invalid_data';
         $errorMsg = $this->_getHelper()->__($no);
     }
     if ($errorMsg) {
         Mage::throwException($errorMsg);
     }
     return $this;
 }
Example #23
0
 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 (!$this->canUseForCurrency($currencyCode)) {
         Mage::throwException(Mage::helper('cybersourcesa')->__('Selected currency code (' . $currencyCode . ') is not compatabile with this payment.'));
     }
     return $this;
 }
Example #24
0
 /**
  * Payment validation
  *
  * @param   none
  * @return  Mage_Hdfc_Model_Standard
  */
 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 ($currency_code != $this->getConfig()->getCurrency()) {
     //   Mage::throwException(Mage::helper('hdfc')->__('Selected currency //code ('.$currency_code.') is not compatabile with Hdfc'));
     // }
     return $this;
 }
Example #25
0
 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 ($currency_code != $this->getAccepteCurrency()) {
         Mage::throwException(Mage::helper('eway')->__('Selected currency code (%s) is not compatible with eWAY.', $currency_code));
     }
     return $this;
 }
Example #26
0
 /**
  * Payment validation
  *
  * @param   none
  * @return  Mage_Chronopay_Model_Standard
  */
 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 ($currency_code != $this->getConfig()->getCurrency()) {
         AO::throwException(AO::helper('chronopay')->__('Selected currency code (' . $currency_code . ') is not compatible with ChronoPay'));
     }
     return $this;
 }
 public function validate()
 {
     parent::validate();
     $info = $this->getInfoInstance();
     $credit_card_type = $info->getCreditCardType();
     $credit_card_iin = $info->getCreditCardIin();
     if (empty($credit_card_type) || empty($credit_card_iin)) {
         $errorCode = 'invalid_data';
         $errorMsg = $this->_getHelper()->__('Ingrese tarjeta de crédito y primeros seis dígitos');
     }
     if ($errorMsg) {
         Mage::throwException($errorMsg);
     }
     return $this;
 }
Example #28
0
 public function validate()
 {
     parent::validate();
     $info = $this->getInfoInstance();
     /*
      if (!$info->getData('ccforpos_ref_no')) {
      $errorCode = 'invalid_data';
      $errorMsg = $this->_getHelper()->__("Reference No is a required field.\n");
      }
     */
     if ($errorMsg) {
         Mage::throwException($errorMsg);
     }
     return $this;
 }
 public function validate()
 {
     parent::validate();
     $info = $this->getInfoInstance();
     $no = $info->getCheckNo();
     $date = $info->getCheckDate();
     if (empty($no) || empty($date)) {
         $errorCode = 'invalid_data';
         $errorMsg = $this->_getHelper()->__('Check No and Date are required fields');
     }
     if ($errorMsg) {
         Mage::throwException($errorMsg);
     }
     return $this;
 }
Example #30
0
 public function validate()
 {
     parent::validate();
     $errorMsg = 'Success!!';
     $info = $this->getInfoInstance();
     $quote = $info->getQuote();
     $no = $info->getGiftCardNo();
     if (empty($quote)) {
         $quoteAfter = Mage::getSingleton('checkout/session')->getQuote()->getPayment();
         $no = $quoteAfter->getGiftCardNo();
         $this->assignGiftCardValueToOrder($no);
         $gcValue = $quoteAfter->getGiftCardValue();
         $value = Mage::getSingleton('checkout/session')->getQuote()->getGrandTotal();
     } else {
         if ($quote) {
             $this->assignGiftCardValueToQuote($no);
             $gcValue = $quote->getGiftCardValue();
             $value = $quote->getGrandTotal();
         }
     }
     if (empty($no) || empty($gcValue)) {
         $errorCode = 'invalid_data';
         $errorMsg = $this->_getHelper()->__('Gift Card Number is a required field');
     } else {
         if ($gcValue < $value) {
             $errorCode = 'invalid_data';
             $errorMsg = $this->_getHelper()->__('Gift Card funds: ' . $gcValue . ' have been applied, You will need an additional mode of payment to cover for the remaining cost.');
         } else {
             if ($gcValue > $value) {
                 $successMsg = $this->_getHelper()->__('Gift Card funds: ' . $gcValue . ' have been applied to the total, Your new gift card balance will be ' . ($gcValue - $value));
             }
         }
     }
     if ($errorMsg != 'Success!!') {
         Mage::log($errorMsg);
         Mage::getSingleton('core/session')->addSuccess($errorMsg);
         Header('Location: ' . $_SERVER['/checkout/onepage/']);
         exit;
     } else {
         if ($successMsg) {
             if ($value > 0) {
                 Mage::log($successMsg);
                 Mage::getSingleton('core/session')->addSuccess($successMsg);
             }
             return $this;
         }
     }
 }