localeResolver = $localeResolver; $this->checkoutSession = $checkoutSession; $this->config = $config; $this->configProvider = $configProvider; $this->payment = $payment; } /** * @inheritdoc */ protected function _toHtml() { if ($this->isActive()) { return parent::_toHtml(); } return ''; } /** * @inheritdoc */ public function getAlias() { return $this->getData(self::ALIAS_ELEMENT_INDEX); } /** * @return string */ public function getContainerId() { return $this->getData(self::BUTTON_ELEMENT_INDEX); } /** * @return string */ public function getLocale() { return $this->localeResolver->getLocale(); } /** * @return string */ public function getCurrency() { return $this->checkoutSession->getQuote()->getCurrency()->getBaseCurrencyCode(); } /** * @return float */ public function getAmount() { return $this->checkoutSession->getQuote()->getBaseGrandTotal(); } /** * @return bool */ public function isActive() { return $this->payment->isAvailable($this->checkoutSession->getQuote()) && $this->config->isDisplayShoppingCart(); } /** * @return string */ public function getMerchantName() { return $this->config->getMerchantName(); } /** * @return string|null */ public function getClientToken() { return $this->configProvider->getClientToken(); } /** * @return string */ public function getActionSuccess() { return $this->getUrl(ConfigProvider::CODE . '/paypal/review', ['_secure' => true]); } }