예제 #1
0
 public function validate()
 {
     $info = $this->getInfoInstance();
     if ($info->getCcType() == "DIN" || $info->getCcType() == "ELO") {
         return $this;
     } else {
         parent::validate();
     }
     return $this;
 }
예제 #2
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;
 }
예제 #3
0
 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
0
 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
0
 /**
  * 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
0
 /**
  * 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();
 }
 /**
  * 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();
     }
 }
 /**
  * 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
0
 /**
  * @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;
 }
 /**
  * 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
0
 /**
  * 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;
 }