/** * @inheritdoc */ public function getConfig() { /** * @var $payment Payupl */ $config = []; $payment = $this->paymentHelper->getMethodInstance(Payupl::CODE); if ($payment->isAvailable()) { $redirectUrl = $payment->getCheckoutRedirectUrl(); $quote = $this->checkoutSession->getQuote(); $config = ['payment' => ['orbaPayupl' => ['redirectUrl' => $redirectUrl, 'paytypes' => $this->paytypeHelper->getAllForQuote($quote)]]]; } return $config; }
/** * Check whether payment method can be used * * @param \Magento\Quote\Api\Data\CartInterface|null $quote * @return bool */ public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) { if (is_null($quote)) { return parent::isAvailable(); } else { return parent::isAvailable($quote) && $this->isShippingMethodAllowed($quote->getShippingAddress()->getShippingMethod()) && $this->paytypeHelper->getAllForQuote($quote) !== []; } }