![]() 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/ |
<?php namespace PayPal\Braintree\Block\ApplePay; use PayPal\Braintree\Model\ApplePay\Auth; use Magento\Checkout\Model\Session; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Framework\View\Element\Template; use Magento\Framework\View\Element\Template\Context; use Magento\Payment\Model\MethodInterface; /***/ abstract class AbstractButton extends Template { /** * @var Session */ protected $checkoutSession; /** * @var MethodInterface */ protected $payment; /** * @var Auth */ protected $auth; /** * Button constructor. * @param Context $context * @param Session $checkoutSession * @param MethodInterface $payment * @param Auth $auth * @param array $data * @throws InputException * @throws NoSuchEntityException */ public function __construct( Context $context, Session $checkoutSession, MethodInterface $payment, Auth $auth, array $data = [] ) { parent::__construct($context, $data); $this->checkoutSession = $checkoutSession; $this->payment = $payment; $this->auth = $auth->get(); } /** * @inheritdoc */ protected function _toHtml(): string // @codingStandardsIgnoreLine { if ($this->isActive()) { return parent::_toHtml(); } return ''; } /** * @return bool */ public function isActive(): bool { return $this->payment->isAvailable($this->checkoutSession->getQuote()); } /** * Merchant name to display in popup * * @return string */ public function getMerchantName(): string { return $this->auth->getDisplayName(); } /** * Braintree's API token * * @return string|null * @throws InputException * @throws NoSuchEntityException */ public function getClientToken() { return $this->auth->getClientToken(); } /** * URL To success page * * @return string */ public function getActionSuccess(): string { return $this->auth->getActionSuccess(); } /** * Is customer logged in flag * * @return bool */ public function isCustomerLoggedIn(): bool { return $this->auth->isLoggedIn(); } /** * Cart grand total * * @return float|null */ public function getAmount() { return $this->checkoutSession->getQuote()->getBaseGrandTotal(); } /** * @return string * @throws NoSuchEntityException */ public function getStorecode(): string { return $this->auth->getStoreCode(); } }