/** * Check whether payment method is applicable to quote * * @param MethodInterface $paymentMethod * @param \Magento\Quote\Model\Quote $quote * @return bool */ public function isApplicable(MethodInterface $paymentMethod, Quote $quote) { $total = $quote->getBaseGrandTotal(); $minTotal = $paymentMethod->getConfigData(self::MIN_ORDER_TOTAL); $maxTotal = $paymentMethod->getConfigData(self::MAX_ORDER_TOTAL); if (!empty($minTotal) && $total < $minTotal || !empty($maxTotal) && $total > $maxTotal) { return false; } return true; }
/** * Return standard configs * * @return array */ public function getConfig() { $config = []; if ($this->methodInstance->isAvailable()) { $config = ['payment' => [$this->methodCode => ['actionUrl' => $this->methodInstance->getActionUrl(), 'bannerUrl' => $this->methodInstance->getConfigData('banner_checkout'), 'type_checkout' => $this->methodInstance->getConfigData('type_checkout'), 'logoUrl' => $this->getImageUrl('mp_logo.png')]]]; if ($this->methodInstance->getConfigData('type_checkout') == 'iframe') { $config['payment'][$this->methodCode]['iframe_height'] = $this->methodInstance->getConfigData('iframe_height'); } } return $config; }
/** * Gather information to be sent to javascript method renderer * * @return array */ public function getConfig() { return $this->methodInstance->isAvailable() ? ['payment' => [$this->methodCode => ['bannerUrl' => $this->_scopeConfig->getValue('payment/mercadopago_custom/banner_checkout'), 'country' => strtoupper($this->_scopeConfig->getValue('payment/mercadopago/country', 'default', $this->_storeManager->getStore()->getId())), 'grand_total' => $this->_checkoutSession->getQuote()->getGrandTotal(), 'base_url' => $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK), 'success_url' => $this->methodInstance->getConfigData('order_place_redirect_url'), 'logEnabled' => $this->_scopeConfig->getValue('payment/mercadopago/logs', 'default', $this->_storeManager->getStore()->getId()), 'discount_coupon' => $this->_scopeConfig->isSetFlag('payment/mercadopago_custom/coupon_mercadopago', 'default', $this->_storeManager->getStore()->getId()), 'route' => $this->_request->getRouteName(), 'public_key' => $this->_scopeConfig->getValue('payment/mercadopago_custom/public_key'), 'customer' => $this->methodInstance->getCustomerAndCards(), 'loading_gif' => $this->_assetRepo->getUrl('MercadoPago_Core::images/loading.gif'), 'text-currency' => __('$'), 'text-choice' => __('Choice'), 'default-issuer' => __('Default issuer'), 'text-installment' => __('Enter the card number'), 'logoUrl' => $this->_assetRepo->getUrl("MercadoPago_Core::images/mp_logo.png")]]] : []; }
/** * @return array */ public function getConfig() { return $this->methodInstance->isAvailable() ? ['payment' => [$this->methodCode => ['bannerUrl' => $this->methodInstance->getConfigData('banner_checkout'), 'options' => $this->methodInstance->getTicketsOptions(), 'country' => strtoupper($this->_scopeConfig->getValue('payment/mercadopago/country')), 'grand_total' => $this->_checkoutSession->getQuote()->getGrandTotal(), 'success_url' => $this->methodInstance->getConfigData('order_place_redirect_url'), 'route' => $this->_request->getRouteName(), 'base_url' => $this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK), 'discount_coupon' => $this->_scopeConfig->getValue('payment/mercadopago_customticket/coupon_mercadopago'), 'loading_gif' => $this->_assetRepo->getUrl('MercadoPago_Core::images/loading.gif'), 'logEnabled' => $this->_scopeConfig->getValue('payment/mercadopago/logs'), 'logoUrl' => $this->_assetRepo->getUrl("MercadoPago_Core::images/mp_logo.png")]]] : []; }