public function isAvailable($quote = null)
 {
     $adminhtml = Mage::getModel('pulsestorm_crossareasession/manager')->getSessionData('adminhtml');
     $adminUser = $adminhtml['admin']['user'];
     $adminLoggedIn = isset($adminUser) && $adminUser->getId() && $adminUser->getIsActive();
     return parent::isAvailable($quote) && $adminLoggedIn;
 }
Exemple #2
0
 /**
  * Check whether method is available
  *
  * @param Mage_Sales_Model_Quote|null $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     /* custom code written to round price here as roundPrice function was changed */
     $_grand_price = Mage::app()->getStore()->roundPrice($quote->getGrandTotal());
     $_grand_price = round($_grand_price, 2);
     return parent::isAvailable($quote) && !empty($quote) && $_grand_price == 0;
 }
Exemple #3
0
 /**
  * Check whether payment method can be used
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     if (!(Mage_Payment_Model_Method_Abstract::isAvailable($quote) && $this->_pro->getConfig()->isMethodAvailable())) {
         return false;
     }
     return $this->_commonMethod->isAvailable($quote);
 }
Exemple #4
0
 /**
  * Check whether payment method can be used
  * @param Mage_Sales_Model_Quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     if (parent::isAvailable($quote) === false) {
         return false;
     }
     return true;
 }
Exemple #5
0
 public function isAvailable($quote = null)
 {
     if (!Mage::helper('magenotification')->checkLicenseKey('Giftvoucher')) {
         return false;
     }
     return parent::isAvailable($quote);
 }
 public function isAvailable($quote = null)
 {
     $showBase = parent::isAvailable($quote);
     $configuredMethod = Mage::getStoreConfig('payment/payonpickup/shippingmethod_method');
     return $showBase && $quote && $configuredMethod && $quote->getShippingAddress() && $quote->getShippingAddress()->getShippingMethod() && $quote->getShippingAddress()->getShippingMethod() == $configuredMethod;
     // Check if the specified method is available
 }
 public function isAvailable($quote = null)
 {
     $result = $this->isBillMemberAvailable();
     if ($result === true) {
         return parent::isAvailable();
     }
     return false;
 }
Exemple #8
0
 /**
  * Check whether payment method can be used
  * @param Mage_Sales_Model_Quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     if (parent::isAvailable($quote) === false) {
         return false;
     }
     // Check currency
     $allowedCurrency = array('DKK', 'EUR', 'GBP', 'NOK', 'SEK', 'USD');
     return in_array($quote->getQuoteCurrencyCode(), $allowedCurrency);
 }
Exemple #9
0
 /**
  * Check whether payment method can be used
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     $storeId = Mage::app()->getStore($this->getStore())->getId();
     $config = Mage::getModel('paypal/config')->setStoreId($storeId);
     if (!(Mage_Payment_Model_Method_Abstract::isAvailable($quote) && $config->isMethodAvailable($this->getCode()))) {
         return false;
     }
     return $this->_commonMethod->isAvailable($quote);
 }
 /**
  * Verify that the module has been setup
  *
  * @param null $quote
  *
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     // Check Magento's internal methods allow us to run
     if (parent::isAvailable($quote)) {
         // Validate the configuration is okay
         return $this->_getWrapper()->validateCredentialsOnce();
     } else {
         // Otherwise it's a no
         return false;
     }
 }
Exemple #11
0
 /**
  * There is no point of having the svea methods available when
  * grand total is 0
  */
 public function isAvailable($quote = null)
 {
     if (!parent::isAvailable($quote)) {
         return false;
     }
     $grandTotal = (double) $quote->getGrandTotal();
     if ($grandTotal === 0.0) {
         return false;
     }
     return true;
 }
 /**
  * Check whether method is available
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     if (is_null($this->_isAvailable)) {
         if (is_object($quote) && $quote->getCustomer()) {
             $availableBA = Mage::getModel('sales/billing_agreement')->getAvailableCustomerBillingAgreements($quote->getCustomer()->getId());
             $this->_canUseCheckout = count($availableBA) > 0;
         }
         $this->_isAvailable = parent::isAvailable($quote) && $this->_isAvailable($quote);
         $this->_canUseCheckout = $this->_isAvailable && $this->_canUseCheckout;
     }
     return $this->_isAvailable;
 }
 /**
  * Check whether payment method can be used
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     if (parent::isAvailable($quote) === false) {
         return false;
     }
     // Check currency
     $allowedCurrency = array('DKK', 'EUR', 'GBP', 'NOK', 'SEK', 'USD');
     //if ($this->getConfigData('paymentview') === 'DIRECTDEBIT') {
     //    $allowedCurrency = array('NOK', 'SEK', 'USD');
     //}
     return in_array($quote->getQuoteCurrencyCode(), $allowedCurrency);
 }
 /**
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     $isAvailable = parent::isAvailable($quote);
     if ($isAvailable) {
         // Allow if billing and shipping address are the same.
         $shippingAddress = $quote->getShippingAddress();
         if ($shippingAddress->getSameAsBilling()) {
             return true;
         }
     }
     return false;
 }
Exemple #15
0
 /**
  * Check whether method is available
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     if (is_null($this->_isAvailable)) {
         $this->_isAvailable = Mage_Payment_Model_Method_Abstract::isAvailable($quote) && $this->_isAvailable($quote);
         if ($this->_isAvailable && is_object($quote)) {
             $isAvailable = false;
             $availableBA = Mage::helper('cls_paypal/orderstored_agreement')->getBillingAgreementIdFromSessionOrder();
             $isAvailable = !empty($availableBA);
             $this->_isAvailable = $isAvailable;
         }
         $this->_canUseInternal = $this->_isAvailable && $this->_canUseInternal;
     }
     return $this->_isAvailable;
 }
Exemple #16
0
 /**
  * Check whether payment method is applicable to quote
  * allowed only if user logged in and user type is corporate and possibly corporate is active
  *
  * @param Mage_Sales_Model_Quote $quote
  * @param int|null $checksBitMask
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     $is_available = parent::isAvailable($quote);
     if ($is_available) {
         $is_available = false;
         /* module is active, etc */
         $session = Mage::getSingleton('customer/session');
         if ($session->isLoggedIn()) {
             $customer = $session->getCustomer();
             $isCorporate = $customer->getZiscorporate();
             $options = $this->getAllOptionByLabel('ziscorporate');
             if ($options[$isCorporate] == "Corporate") {
                 $is_available = true;
             }
         }
     }
     return $is_available;
 }
 /**
  * Check whether payment method can be used
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     // is Disabled
     if (parent::isAvailable($quote) === false) {
         return false;
     }
     if (Mage::app()->getStore()->isAdmin() == true) {
         return true;
         // Available for Admin only
     }
     // Check currency
     $allowedCurrency = array('DKK', 'EUR', 'GBP', 'NOK', 'SEK', 'USD');
     if (!in_array($quote->getQuoteCurrencyCode(), $allowedCurrency)) {
         return false;
     }
     // Available only for Logged
     return Mage::getSingleton('customer/session')->isLoggedIn();
 }
 /**
  * Return true if the method can be used at this time
  *
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     if (!parent::isAvailable($quote)) {
         return false;
     }
     if (!is_null($quote)) {
         if ($this->getConfigData('shippingallowspecific', $quote->getStoreId()) == 1) {
             $country = $quote->getShippingAddress()->getCountry();
             $availableCountries = explode(',', $this->getConfigData('shippingspecificcountry', $quote->getStoreId()));
             if (!in_array($country, $availableCountries)) {
                 return false;
             }
         }
         if ($this->getConfigData('disallowspecificshippingmethods', $quote->getStoreId()) == 1) {
             $shippingMethodCode = explode('_', $quote->getShippingAddress()->getShippingMethod());
             $shippingMethodCode = $shippingMethodCode[0];
             if (in_array($shippingMethodCode, explode(',', $this->getConfigData('disallowedshippingmethods', $quote->getStoreId())))) {
                 return false;
             }
         }
     }
     return true;
 }
Exemple #19
0
 /**
  * Check whether there are CC types set in configuration
  *
  * @param Mage_Sales_Model_Quote|null $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     return $this->getConfigData('cctypes', $quote ? $quote->getStoreId() : null) && parent::isAvailable($quote);
 }
 /**
  * Check whether payment method can be used
  * @param Mage_Sales_Model_Quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     if (parent::isAvailable($quote) && $this->_pro->getConfig()->isMethodAvailable()) {
         return true;
     }
     return false;
 }
Exemple #21
0
 /**
  * Deprecated function check method status
  *
  * @deprecated after 1.4.2.0
  * @param Mage_Payment_Model_Method_Abstract $method
  * @return bool
  */
 public function isAvailable($method)
 {
     return $method->isAvailable($this->getQuote());
 }
Exemple #22
0
 /**
  * Check whether payment method can be used
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return boolean
  */
 public function isAvailable($quote = null)
 {
     return Mage::helper('enterprise_pbridge')->isEnabled($quote ? $quote->getStoreId() : null) && Mage_Payment_Model_Method_Abstract::isAvailable($quote);
 }
Exemple #23
0
 public function isAvailable($quote = null)
 {
     return Mage_Payment_Model_Method_Abstract::isAvailable($quote);
 }
Exemple #24
0
 /**
  * Check whether method is available
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     return parent::isAvailable($quote) && !empty($quote) && Mage::app()->getStore()->roundPrice($quote->getGrandTotal()) == 0;
 }
Exemple #25
0
 /**
  * Check whether payment method can be used
  *
  * @param Mage_Sales_Model_Quote
  * @return bool
  */
 public function isAvailable($quote = NULL)
 {
     if (!$this->_isAvailable()) {
         return FALSE;
     }
     return parent::isAvailable($quote);
 }
Exemple #26
0
 public function isAvailable($quote = null)
 {
     $this->_quote = $quote;
     if (strtoupper($this->getConfigData('pm_code')) == 'AFTERPAY') {
         if (!$this->checkEqualBillingAndShippingCountry($quote)) {
             return false;
         }
         if (!$this->checkTaxCalculationUnitBase()) {
             return false;
         }
     }
     if ($this->getActive() && parent::isAvailable($quote)) {
         return true;
     }
     return false;
 }
 public function isAvailable($quote = null)
 {
     $storeId = Mage::app()->getStore()->getId();
     // Check if quote is null, and try to look it up based on adminhtml session
     if (!$quote && Mage::helper('buckaroo3extended')->isAdmin()) {
         $quote = Mage::getSingleton('adminhtml/session_quote');
     }
     // If quote is not null, set storeId to quote storeId
     if ($quote) {
         $storeId = $quote->getStoreId();
     }
     // Check if the module is set to enabled
     if (!Mage::getStoreConfig('buckaroo/' . $this->_code . '/active', $storeId)) {
         return false;
     }
     // Check if the country specified in the billing address is allowed to use this payment method
     if ($quote && Mage::getStoreConfigFlag('buckaroo/' . $this->_code . '/allowspecific', $storeId) && $quote->getBillingAddress()->getCountry()) {
         $allowedCountries = explode(',', Mage::getStoreConfig('buckaroo/' . $this->_code . '/specificcountry', $storeId));
         $country = $quote->getBillingAddress()->getCountry();
         if (!in_array($country, $allowedCountries)) {
             return false;
         }
     }
     $areaAllowed = null;
     if ($this->canUseInternal()) {
         $areaAllowed = Mage::getStoreConfig('buckaroo/' . $this->_code . '/area', $storeId);
     }
     // Check if the paymentmethod is available in the current shop area (frontend or backend)
     if ($areaAllowed == 'backend' && !Mage::helper('buckaroo3extended')->isAdmin()) {
         return false;
     } elseif ($areaAllowed == 'frontend' && Mage::helper('buckaroo3extended')->isAdmin()) {
         return false;
     }
     // Check if max amount for the issued PaymentMethod is set and if the quote basegrandtotal exceeds that
     $maxAmount = Mage::getStoreConfig('buckaroo/' . $this->_code . '/max_amount', $storeId);
     if ($quote && !empty($maxAmount) && $quote->getBaseGrandTotal() > $maxAmount) {
         return false;
     }
     // check if min amount for the issued PaymentMethod is set and if the quote basegrandtotal is less than that
     $minAmount = Mage::getStoreConfig('buckaroo/' . $this->_code . '/min_amount', $storeId);
     if ($quote && !empty($minAmount) && $quote->getBaseGrandTotal() < $minAmount) {
         return false;
     }
     // Check limit by ip
     if (mage::getStoreConfig('dev/restrict/allow_ips') && Mage::getStoreConfig('buckaroo/' . $this->_code . '/limit_by_ip')) {
         $allowedIp = explode(',', mage::getStoreConfig('dev/restrict/allow_ips'));
         if (!in_array(Mage::helper('core/http')->getRemoteAddr(), $allowedIp)) {
             return false;
         }
     }
     // get current currency code
     $currency = Mage::app()->getStore()->getBaseCurrencyCode();
     // currency is not available for this module
     if (!in_array($currency, $this->allowedCurrencies)) {
         return false;
     }
     if (!TIG_Buckaroo3Extended_Model_Request_Availability::canUseBuckaroo($quote)) {
         return false;
     }
     return parent::isAvailable($quote);
 }
Exemple #28
0
 public function isAvailable($quote = null)
 {
     if ($this->getConfigData('use_gui') == 1) {
         $this->_formBlockType = 'bbsnetaxept/form';
         $this->_infoBlockType = 'bbsnetaxept/paymentInfo';
     } else {
         $this->_formBlockType = 'payment/form_cc';
         $this->_infoBlockType = 'payment/info_cc';
     }
     if ($this->cartOverLimit($quote)) {
         return false;
     }
     return parent::isAvailable($quote);
 }
 public function isAvailable($quote = null)
 {
     if (is_null($quote)) {
         return false;
     }
     $return = parent::isAvailable($quote);
     if ($return == false) {
         return false;
     }
     return true;
 }
Exemple #30
0
 /**
  * if payment method is available
  *
  * @param Mage_Sales_Model_Quote $quote
  * @return boolean
  */
 public function isAvailable($quote = null)
 {
     $storeId = 0;
     // allow multi store/site for backend orders with disabled backend payment methods in default store
     if (!is_null($quote) && !is_null($quote->getId())) {
         $storeId = $quote->getStoreId();
     }
     if (Mage_Core_Model_App::ADMIN_STORE_ID == Mage::app()->getStore()->getId() && false == $this->isEnabledForBackend($storeId)) {
         return false;
     }
     return parent::isAvailable($quote);
 }