From d3ce196487e0c2f1b8e0309a4ff9e10b2da1fae6 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Wed, 12 Jul 2023 17:28:51 +0200 Subject: [PATCH] Fixed non working sandbox mode --- Config/module.xml | 15 +-------------- Service/Base/PayPalBaseService.php | 16 ++++++---------- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/Config/module.xml b/Config/module.xml index a299a83..0d3c48d 100644 --- a/Config/module.xml +++ b/Config/module.xml @@ -5,11 +5,6 @@ PayPal\PayPal PayPal - PayPal @@ -20,7 +15,7 @@ en_US fr_FR - 4.0.4 + 4.0.5 gbarral @@ -28,14 +23,6 @@ classic - 2.4.0 other diff --git a/Service/Base/PayPalBaseService.php b/Service/Base/PayPalBaseService.php index 7df6423..a623c0d 100644 --- a/Service/Base/PayPalBaseService.php +++ b/Service/Base/PayPalBaseService.php @@ -356,7 +356,7 @@ public static function getApiContext() */ public static function getLogin() { - if ((bool)PayPal::getConfigValue('sandbox') === 1) { + if ((bool)PayPal::getConfigValue('sandbox') === true) { $login = PayPal::getConfigValue('sandbox_login'); } else { $login = PayPal::getConfigValue('login'); @@ -370,7 +370,7 @@ public static function getLogin() */ public static function getPassword() { - if ((bool)PayPal::getConfigValue('sandbox') === 1) { + if ((bool)PayPal::getConfigValue('sandbox') === true) { $password = PayPal::getConfigValue('sandbox_password'); } else { $password = PayPal::getConfigValue('password'); @@ -384,7 +384,7 @@ public static function getPassword() */ public static function getMerchantId() { - if ((bool)PayPal::getConfigValue('sandbox') === 1) { + if ((bool)PayPal::getConfigValue('sandbox') === true) { $login = PayPal::getConfigValue('sandbox_merchant_id'); } else { $login = PayPal::getConfigValue('merchant_id'); @@ -398,7 +398,7 @@ public static function getMerchantId() */ public static function getMode() { - if ((bool)PayPal::getConfigValue('sandbox') === 1) { + if ((bool)PayPal::getConfigValue('sandbox') === true) { $mode = 'sandbox'; } else { $mode = 'live'; @@ -407,12 +407,8 @@ public static function getMode() return $mode; } - public static function isSandboxMode() + public static function isSandboxMode(): bool { - if (self::getMode() === 'live') { - return false; - } - - return true; + return self::getMode() === 'sandbox'; } }