From d7b0e8c4317d5647e8980d7a03acbfe54e543820 Mon Sep 17 00:00:00 2001 From: Claudio Hessel Date: Tue, 20 Dec 2022 11:16:09 -0300 Subject: [PATCH 1/2] PAOPN-273: change 'getResponseBody' in exception call to 'getMessage' --- Observer/AdminCustomerBeforeSave.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Observer/AdminCustomerBeforeSave.php b/Observer/AdminCustomerBeforeSave.php index 61dbfc60..1b3ce45b 100644 --- a/Observer/AdminCustomerBeforeSave.php +++ b/Observer/AdminCustomerBeforeSave.php @@ -51,7 +51,7 @@ public function execute(EventObserver $observer) $customerService->updateCustomerAtPagarme($platformCustomer); } catch (\Exception $exception) { $log = new LogService('CustomerService'); - $log->info($exception->getResponseBody()); + $log->info($exception->getMessage()); if ($exception->getCode() == 404) { $log->info( From 8086074bc3c9a8e47e1cc2a312dfdd109aed46a1 Mon Sep 17 00:00:00 2001 From: Claudio Hessel Date: Wed, 21 Dec 2022 11:19:11 -0300 Subject: [PATCH 2/2] PAOPN-273: Save Customer on Pagarme just on update --- Observer/AdminCustomerBeforeSave.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Observer/AdminCustomerBeforeSave.php b/Observer/AdminCustomerBeforeSave.php index 1b3ce45b..4725d871 100644 --- a/Observer/AdminCustomerBeforeSave.php +++ b/Observer/AdminCustomerBeforeSave.php @@ -46,6 +46,10 @@ public function execute(EventObserver $observer) $event = $observer->getEvent(); $platformCustomer = new Magento2PlatformCustomerDecorator($event->getCustomer()); + if (empty($platformCustomer->getPagarmeId())) { + return $this; + } + $customerService = new CustomerService(); try { $customerService->updateCustomerAtPagarme($platformCustomer);