/** * Determine method availability based on quote amount and config data * * @param \Magento\Quote\Api\Data\CartInterface|null $quote * * @return bool */ public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) { $avail = parent::isAvailable($quote); if ($avail === false) { return false; } if ($quote === null) { return false; } /** @var \Magento\Quote\Model\Quote $quote */ if ($quote->hasVirtualItems()) { return false; } if ($this->getConfigData('billing_shipping_address_identical') && !$this->compareAddresses($quote)) { return false; } $currencies = explode(',', $this->getConfigData('currency')); if (!in_array($quote->getQuoteCurrencyCode(), $currencies)) { return false; } if (strlen($this->getConfigData('shippingcountry'))) { $countries = explode(',', $this->getConfigData('shippingcountry')); if (!in_array($quote->getShippingAddress()->getCountry(), $countries)) { return false; } } $billingAddress = $quote->getBillingAddress(); if (strlen($billingAddress->getCompany())) { return true; } if (!strlen($billingAddress->getVatId())) { return false; } return true; }
/** * Assign data to info model instance * * @param array|\Magento\Framework\DataObject $data * @return $this * @throws \Magento\Framework\Exception\LocalizedException * @api */ public function assignData(\Magento\Framework\DataObject $data) { parent::assignData($data); if (!$data instanceof \Magento\Framework\DataObject) { $data = new \Magento\Framework\DataObject($data); } /** @var \Magento\Quote\Model\Quote\Payment $infoInstance */ $infoInstance = $this->getInfoInstance(); $infoInstance->setAdditionalInformation('financialInstitution', $data->getData('financialInstitution')); return $this; }
/** * Determine method availability based on quote amount and config data * * @param \Magento\Quote\Api\Data\CartInterface|null $quote * * @return bool */ public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) { $avail = parent::isAvailable($quote); if ($avail === false) { return false; } if ($quote === null) { return false; } $allowedGroup = $this->getConfigData('allowed_group'); if (!strlen($allowedGroup)) { return false; } return $this->getConfigData('allowed_group') == $quote->getCustomer()->getGroupId(); }
/** * Determine method availability based on quote amount and config data * * @param \Magento\Quote\Api\Data\CartInterface|null $quote * * @return bool */ public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) { $avail = parent::isAvailable($quote); if ($avail === false) { return false; } if ($quote === null) { return false; } if ($this->getConfigData('provider') == 'ratepay') { return $this->_isAvailableRatePay($quote); } elseif ($this->getConfigData('provider') == 'payolution') { return $this->_isAvailablePayolution($quote); } return true; }
public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\Api\ExtensionAttributesFactory $extensionFactory, \Magento\Framework\Api\AttributeValueFactory $customAttributeFactory, \Magento\Payment\Helper\Data $paymentData, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Payment\Model\Method\Logger $logger, \Wirecard\CheckoutPage\Helper\Data $helper, \Magento\Sales\Model\Order\Payment\Transaction\BuilderInterface $transactionBuilder, \Magento\Sales\Model\Order\Email\Sender\OrderSender $orderSender, \Magento\Sales\Api\TransactionRepositoryInterface $transactionRepository, \Magento\Payment\Model\Config $paymentConfig, \Magento\Payment\Model\Method\Factory $paymentMethodFactory, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = []) { parent::__construct($context, $registry, $extensionFactory, $customAttributeFactory, $paymentData, $scopeConfig, $logger, $helper, $transactionBuilder, $orderSender, $transactionRepository, $resource, $resourceCollection, $data); $this->_paymentConfig = $paymentConfig; $this->_paymentMethodFactory = $paymentMethodFactory; }