From 2742b7c05e361a0eacb14358a2cdf13341eb5d93 Mon Sep 17 00:00:00 2001 From: Elisei Date: Thu, 11 Apr 2024 09:25:49 -0300 Subject: [PATCH] =?UTF-8?q?PagBank=20=F0=9F=98=8D=20Magento=20-=20Corrige?= =?UTF-8?q?=20erro=20500=20no=20tratamento=20de=20notifica=C3=A7=C3=A3o=20?= =?UTF-8?q?n=C3=A3o=20v=C3=A1lidas.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controller/Notification/All.php | 13 ++++++++++++- Gateway/Request/ItemsDataRequest.php | 4 ++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Controller/Notification/All.php b/Controller/Notification/All.php index 356d89d..e6ab084 100644 --- a/Controller/Notification/All.php +++ b/Controller/Notification/All.php @@ -71,7 +71,18 @@ public function execute() $response = $this->getRequest()->getContent(); - $psData = $this->json->unserialize($response); + try { + $psData = $this->json->unserialize($response); + } catch (Exception $exc) { + /** @var ResultInterface $result */ + return $this->createResult( + 205, + [ + 'error' => 205, + 'message' => $exc->getMessage(), + ] + ); + } if (!isset($psData['id'])) { return $this->createResult( diff --git a/Gateway/Request/ItemsDataRequest.php b/Gateway/Request/ItemsDataRequest.php index e0271c0..857d94c 100644 --- a/Gateway/Request/ItemsDataRequest.php +++ b/Gateway/Request/ItemsDataRequest.php @@ -99,6 +99,10 @@ public function getPurchaseItems( continue; } + if ((int) $this->config->formatPrice($item->getPrice()) === 0) { + continue; + } + $replacements = [ 'á' => 'a', 'à' => 'a',