diff --git a/classes/AbstractMethodPaypal.php b/classes/AbstractMethodPaypal.php index 862fe0bb..df940a84 100755 --- a/classes/AbstractMethodPaypal.php +++ b/classes/AbstractMethodPaypal.php @@ -77,6 +77,8 @@ abstract class AbstractMethodPaypal extends AbstractMethod { + const AUTHORIZE = 'AUTHORIZE'; + const SALE = 'CAPTURE'; /** @var bool */ protected $isSandbox; diff --git a/classes/MethodEC.php b/classes/MethodEC.php index f128bb47..f56ad7a8 100755 --- a/classes/MethodEC.php +++ b/classes/MethodEC.php @@ -42,10 +42,6 @@ */ class MethodEC extends AbstractMethodPaypal { - const AUTHORIZE = 'AUTHORIZE'; - - const SALE = 'CAPTURE'; - /** @var bool pay with card without pp account */ public $credit_card; diff --git a/classes/MethodMB.php b/classes/MethodMB.php index 54e6b390..ae4d126d 100644 --- a/classes/MethodMB.php +++ b/classes/MethodMB.php @@ -164,6 +164,7 @@ public function validation() */ public function confirmCapture($orderPayPal) { + return $this->paypalApiManager->getCaptureAuthorizeRequest($orderPayPal)->execute(); } /** @@ -171,6 +172,7 @@ public function confirmCapture($orderPayPal) */ public function void($orderPayPal) { + return $this->paypalApiManager->getAuthorizationVoidRequest($orderPayPal)->execute(); } /** @@ -454,7 +456,7 @@ public function getPaypalPartnerId() public function getIntent() { - return Configuration::get('PAYPAL_API_INTENT') == 'sale' ? 'CAPTURE' : 'AUTHORIZE'; + return Configuration::get('PAYPAL_API_INTENT') == 'sale' ? self::SALE : self::AUTHORIZE; } public function getMerchantId() diff --git a/classes/MethodPPP.php b/classes/MethodPPP.php index 95e56182..de1b4721 100755 --- a/classes/MethodPPP.php +++ b/classes/MethodPPP.php @@ -278,7 +278,7 @@ public function getSecret($sandbox = null) public function getIntent() { - return 'CAPTURE'; + return self::SALE; } public function getReturnUrl() diff --git a/services/StatusMapping.php b/services/StatusMapping.php index 6164483d..278ea112 100644 --- a/services/StatusMapping.php +++ b/services/StatusMapping.php @@ -30,7 +30,6 @@ use Configuration; use MethodEC; use MethodMB; -use MethodPPP; use PaypalAddons\classes\AbstractMethodPaypal; use PaypalAddons\classes\Constants\PaypalConfigurations; use PaypalAddons\classes\Constants\WebHookType; @@ -182,15 +181,7 @@ public function isModeSale($method = null) $method = AbstractMethodPaypal::load(); } - if ($method instanceof MethodPPP) { - return true; - } - - if ($method instanceof MethodMB) { - return true; - } - - return Configuration::get('PAYPAL_API_INTENT') == 'sale'; + return $method->getIntent() === AbstractMethodPaypal::SALE; } /**