kpSession = $kpSession; $this->config = $config; $this->storeManager = $storeManager; } /** * Initialize Klarna Payment session before get js layout * * @throws \Klarna\Core\Exception * @throws \Klarna\Core\Model\Api\Exception */ public function beforeGetJsLayout() { $store = $this->storeManager->getStore(); if ($this->config->isSetFlag( sprintf('payment/%s/active', Kp::METHOD_CODE), ScopeInterface::SCOPE_STORES, $store )) { $this->kpSession->init(); } } }