Skip to content

Commit

Permalink
Merge pull request #150 from melisource/fix/mp-stuck-session-blocks
Browse files Browse the repository at this point in the history
Fixing stuck chosen_payment_method session on blocks
  • Loading branch information
gubrito authored Jan 11, 2024
2 parents 376bfc5 + 44d55cb commit 86330d2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Blocks/AbstractBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ abstract class AbstractBlock extends AbstractPaymentMethodType implements Mercad
*/
public const GATEWAY_SESSION_KEY = 'mercadopago_blocks_gateway';

/**
* @const
*/
public const CHOSEN_PM_SESSION_KEY = 'chosen_payment_method';

/**
* @const
*/
Expand Down Expand Up @@ -89,6 +94,7 @@ public function resetCheckoutSession()
{
$this->mercadopago->helpers->session->deleteSession(self::ACTION_SESSION_KEY);
$this->mercadopago->helpers->session->deleteSession(self::GATEWAY_SESSION_KEY);
$this->mercadopago->helpers->session->deleteSession(self::CHOSEN_PM_SESSION_KEY);
}

/**
Expand Down Expand Up @@ -231,7 +237,6 @@ public function registerDiscountAndCommissionFeesOnCart()
$action = $this->mercadopago->helpers->session->getSession(self::ACTION_SESSION_KEY);

if ($action == 'add') {
$this->mercadopago->logs->file->info('Trying to add discount/comission with ' . $this->gateway->id, 'Testing');
$this->mercadopago->helpers->cart->addDiscountAndCommissionOnFeesFromBlocks($this->gateway);
}

Expand Down

0 comments on commit 86330d2

Please sign in to comment.