![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/vendor/paypal/module-braintree-core/Block/ApplePay/Shortcut/ |
<?php namespace PayPal\Braintree\Block\ApplePay\Shortcut; use PayPal\Braintree\Block\ApplePay\AbstractButton; use PayPal\Braintree\Model\ApplePay\Auth; use Magento\Checkout\Model\Session; use Magento\Catalog\Block\ShortcutInterface; use Magento\Checkout\Model\DefaultConfigProvider; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\View\Element\Template\Context; use Magento\Payment\Model\MethodInterface; use Magento\Framework\Exception\NoSuchEntityException; class Button extends AbstractButton implements ShortcutInterface { const ALIAS_ELEMENT_INDEX = 'alias'; const BUTTON_ELEMENT_INDEX = 'button_id'; /** * @var DefaultConfigProvider $defaultConfigProvider */ private $defaultConfigProvider; /** * Button constructor * * @param Context $context * @param Session $checkoutSession * @param MethodInterface $payment * @param Auth $auth * @param DefaultConfigProvider $defaultConfigProvider * @param array $data * @throws InputException * @throws NoSuchEntityException */ public function __construct( Context $context, Session $checkoutSession, MethodInterface $payment, Auth $auth, DefaultConfigProvider $defaultConfigProvider, array $data = [] ) { parent::__construct($context, $checkoutSession, $payment, $auth, $data); $this->defaultConfigProvider = $defaultConfigProvider; } /** * @inheritdoc */ public function getAlias(): string { return $this->getData(self::ALIAS_ELEMENT_INDEX); } /** * @return string */ public function getContainerId(): string { return $this->getData(self::BUTTON_ELEMENT_INDEX); } /** * Current Quote ID for guests * * @return string * @throws LocalizedException * @throws NoSuchEntityException */ public function getQuoteId(): string { try { $config = $this->defaultConfigProvider->getConfig(); if (!empty($config['quoteData']['entity_id'])) { return $config['quoteData']['entity_id']; } } catch (NoSuchEntityException $e) { if ($e->getMessage() !== 'No such entity with cartId = ') { throw $e; } } return ''; } /** * @return string */ public function getExtraClassname(): string { return $this->getIsCart() ? 'cart' : 'minicart'; } }