From 44d55cb58765efe501540f13e96767a0677af1e4 Mon Sep 17 00:00:00 2001 From: Gustavo Brito Date: Thu, 11 Jan 2024 11:15:19 -0300 Subject: [PATCH] fix: releasing stuck chosen_payment_method on blocks --- src/Blocks/AbstractBlock.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Blocks/AbstractBlock.php b/src/Blocks/AbstractBlock.php index 18c3cb62a..aa76c84d9 100644 --- a/src/Blocks/AbstractBlock.php +++ b/src/Blocks/AbstractBlock.php @@ -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 */ @@ -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); } /** @@ -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); }