Skip to content

Commit

Permalink
refs #49333 not use authorize mode for mx/br
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan202 committed Dec 10, 2024
1 parent 14fe751 commit a4f2313
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 17 deletions.
2 changes: 2 additions & 0 deletions classes/AbstractMethodPaypal.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@

abstract class AbstractMethodPaypal extends AbstractMethod
{
const AUTHORIZE = 'AUTHORIZE';
const SALE = 'CAPTURE';
/** @var bool */
protected $isSandbox;

Expand Down
2 changes: 1 addition & 1 deletion classes/Form/CheckoutForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function getDescription()
];
}

if (in_array($this->method, ['EC', 'MB'])) {
if (in_array($this->method, ['EC'])) {
$fields[PaypalConfigurations::INTENT] = [
'type' => 'select',
'label' => $this->module->l('Payment action', 'AdminPayPalSetupController'),
Expand Down
4 changes: 0 additions & 4 deletions classes/MethodEC.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion classes/MethodMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ public function getPaypalPartnerId()

public function getIntent()
{
return Configuration::get('PAYPAL_API_INTENT') == 'sale' ? 'CAPTURE' : 'AUTHORIZE';
return self::SALE;
}

public function getMerchantId()
Expand Down
2 changes: 1 addition & 1 deletion classes/MethodPPP.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public function getSecret($sandbox = null)

public function getIntent()
{
return 'CAPTURE';
return self::SALE;
}

public function getReturnUrl()
Expand Down
11 changes: 1 addition & 10 deletions services/StatusMapping.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit a4f2313

Please sign in to comment.