コード例 #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
ファイル: Payflowpro.php プロジェクト: pavelnovitsky/magento2
 /**
  * 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
ファイル: Direct.php プロジェクト: pradeep-wagento/magento2
 /**
  * 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
ファイル: Payflowpro.php プロジェクト: nja78/magento2
 /**
  * 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());
 }