![]() 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/old/vendor/magento/module-paypal/Plugin/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\Paypal\Plugin; use Magento\Checkout\Controller\Index\Index; use Magento\Paypal\Model\Config; use Magento\Paypal\Model\ConfigFactory; use Magento\Paypal\Model\SdkUrl; /** * Modify query params in PayPal SDK Url to enable PayNow experience * See https://developer.paypal.com/docs/checkout/integration-features/confirmation-page/ */ class CheckoutIndex { /** * @var SdkUrl */ private $sdkUrl; /** * @var Config */ private $configFactory; /** * @param SdkUrl $sdkUrl * @param Config $config */ public function __construct( SdkUrl $sdkUrl, ConfigFactory $config ) { $this->sdkUrl = $sdkUrl; $this->configFactory = $config; } /** * Modify URL query parameter * * @param Index $subject * @return null * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function beforeExecute(Index $subject) { // Check If PP SmartButtons enabled $config = $this->configFactory->create()->setMethod(Config::METHOD_EXPRESS); if ((bool)(int) $config->getValue('in_context')) { $this->sdkUrl->setQueryParam('commit', 'true'); } return null; } }