예제 #1
0
 public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
 {
     if ($quote && ($quote->getBaseGrandTotal() < $this->_minAmount || $this->_maxAmount && $quote->getBaseGrandTotal() > $this->_maxAmount)) {
         return false;
     }
     return parent::isAvailable($quote);
 }
예제 #2
0
 /**
  * Determines method's availability based on config data and quote amount
  *
  * @param \Magento\Quote\Api\Data\CartInterface|null $quote
  * @return bool
  */
 public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
 {
     return parent::isAvailable($quote) && $this->getConfigHelper()->isMethodAvailable() && $this->getModuleHelper()->isStoreSecure();
 }
예제 #3
0
파일: Direct.php 프로젝트: aiesh/magento2
 /**
  * Check whether payment method can be used
  *
  * @param \Magento\Sales\Model\Quote|null $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     if (parent::isAvailable($quote) && $this->_pro->getConfig()->isMethodAvailable()) {
         return true;
     }
     return false;
 }
예제 #4
0
 /**
  * Check whether payment method can be used
  *
  * @param \Magento\Sales\Model\Quote|null $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     $storeId = $this->_storeManager->getStore($this->getStore())->getId();
     /** @var \Magento\Paypal\Model\Config $config */
     $config = $this->_configFactory->create()->setStoreId($storeId);
     if (parent::isAvailable($quote) && $config->isMethodAvailable($this->getCode())) {
         return true;
     }
     return false;
 }
예제 #5
0
 /**
  * Check whether payment method can be used
  *
  * @param \Magento\Quote\Api\Data\CartInterface|\Magento\Quote\Model\Quote|null $quote
  * @return bool
  */
 public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
 {
     return parent::isAvailable($quote) && $this->_pro->getConfig()->isMethodAvailable();
 }
예제 #6
0
 /**
  * Check whether payment method is applicable to quote
  * Purposed to allow use in controllers some logic that was implemented in blocks only before
  *
  * @param \Magento\Quote\Api\Data\CartInterface|null $quote
  * @return bool
  */
 public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
 {
     if (parent::isAvailable($quote)) {
         if ($quote != null) {
             $availableCcTypes = $this->config->getApplicableCardTypes($quote->getBillingAddress()->getCountryId());
             if (!$availableCcTypes) {
                 return false;
             }
         }
     } else {
         return false;
     }
     return true;
 }
예제 #7
0
 /**
  * is payment method available?
  *
  * @param \Magento\Quote\Api\Data\CartInterface|null $quote
  *
  * @return bool
  */
 public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null)
 {
     $parent = parent::isAvailable($quote);
     if (!$this->_accessToken) {
         $this->_accessToken = $this->_scopeConfig->getValue(\MercadoPago\Core\Helper\Data::XML_PATH_ACCESS_TOKEN);
     }
     if (!$this->_publicKey) {
         $this->_publicKey = $this->_scopeConfig->getValue(\MercadoPago\Core\Helper\Data::XML_PATH_PUBLIC_KEY);
     }
     $custom = !empty($this->_publicKey) && !empty($this->_accessToken);
     if (!$parent || !$custom) {
         return false;
     }
     $debugMode = $this->_scopeConfig->getValue('payment/mercadopago/debug_mode');
     $secure = $this->_request->isSecure();
     if (!$secure && !$debugMode) {
         return false;
     }
     return $this->_helperData->isValidAccessToken($this->_accessToken);
 }
예제 #8
0
 /**
  * Check whether payment method can be used
  *
  * @param Quote|null $quote
  * @return bool
  */
 public function isAvailable($quote = null)
 {
     return parent::isAvailable($quote) && $this->getConfig()->isMethodAvailable($this->getCode());
 }