methodFactory = $methodFactory; $this->quoteRepository = $quoteRepository; $this->log = $log; } /** * {@inheritdoc} */ public function getKlarnaMethodCodes(CartInterface $quote = null) { if (!$quote) { return []; } try { return $this->quoteRepository->getActiveByQuote($quote)->getPaymentMethods(); } catch (NoSuchEntityException $e) { return []; } } /** * {@inheritdoc} */ public function getPaymentMethod($method) { if (!isset($this->paymentMethods[$method])) { $this->paymentMethods[$method] = $this->methodFactory->create(\Klarna\Kp\Model\Payment\Kp::class) ->setCode($method); } return $this->paymentMethods[$method]; } /** * {@inheritdoc} */ public function getKlarnaMethodInfo(CartInterface $quote) { try { return $this->quoteRepository->getActiveByQuote($quote)->getPaymentMethodInfo(); } catch (NoSuchEntityException $e) { return null; } } }