* * @copyright Copyright (c) 2022 OXID eSales AG (https://www.oxid-esales.com) * @copyright Copyright (c) 2022 O3-Shop (https://www.o3-shop.com) * @license https://www.gnu.org/licenses/gpl-3.0 GNU General Public License 3 (GPLv3) */ namespace OxidEsales\PayPalModule\Controller; /** * PayPal Wrapping class * * @mixin \OxidEsales\Eshop\Application\Controller\WrappingController */ class WrappingController extends WrappingController_parent { /** * Checks if payment action is processed by PayPal * * @return bool */ public function isPayPal() { $session = \OxidEsales\Eshop\Core\Registry::getSession(); return ($session->getVariable("paymentid") == "oxidpaypal") ? true : false; } /** * Detects is current payment must be processed by PayPal and instead of standard validation * redirects to standard PayPal dispatcher * * @return bool */ public function changeWrapping() { $return = parent::changeWrapping(); // in case user adds wrapping, basket info must be resubmitted.. if ($this->isPayPal()) { $session = \OxidEsales\Eshop\Core\Registry::getSession(); $payPalType = (int) $session->getVariable("oepaypal"); if ($payPalType == 1) { $return = "payment"; } else { $return = "basket"; } } return $return; } }