From 4e5dff24670d50fedd94468109f50e48a1c02e06 Mon Sep 17 00:00:00 2001 From: Fabiano Mallmann <25328512+fabiano-mallmann@users.noreply.github.com> Date: Tue, 13 Dec 2022 09:40:27 -0300 Subject: [PATCH 1/6] replaces mundipaggapi references to pagarmecoreapi in client changes --- Controller/Customer/Remove.php | 4 ++-- Gateway/Transaction/Billet/Command/AuthorizeCommand.php | 2 -- Helper/CustomerUpdatePagarmeHelper.php | 8 ++++---- composer.json | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Controller/Customer/Remove.php b/Controller/Customer/Remove.php index 4e73e208..6574d2e8 100644 --- a/Controller/Customer/Remove.php +++ b/Controller/Customer/Remove.php @@ -163,10 +163,10 @@ private function deleteCoreCard($coreCardId, $baseException) } /** - * @return \MundiAPILib\MundiAPIClient + * @return \PagarmeCoreApiLib\PagarmeCoreApiClient */ private function getApi() { - return new \MundiAPILib\MundiAPIClient($this->config->getSecretKey(), ''); + return new \PagarmeCoreApiLib\PagarmeCoreApiClient($this->config->getSecretKey(), ''); } } diff --git a/Gateway/Transaction/Billet/Command/AuthorizeCommand.php b/Gateway/Transaction/Billet/Command/AuthorizeCommand.php index f62bdc73..5cbe6cc1 100755 --- a/Gateway/Transaction/Billet/Command/AuthorizeCommand.php +++ b/Gateway/Transaction/Billet/Command/AuthorizeCommand.php @@ -14,8 +14,6 @@ use Pagarme\Pagarme\Gateway\Transaction\Base\Command\AbstractApiCommand; -use MundiAPILib\Models\CreateOrderRequest; - class AuthorizeCommand extends AbstractApiCommand { /** diff --git a/Helper/CustomerUpdatePagarmeHelper.php b/Helper/CustomerUpdatePagarmeHelper.php index 321bb6f1..54547688 100644 --- a/Helper/CustomerUpdatePagarmeHelper.php +++ b/Helper/CustomerUpdatePagarmeHelper.php @@ -9,8 +9,8 @@ namespace Pagarme\Pagarme\Helper; use Magento\Customer\Api\CustomerRepositoryInterface; -use MundiAPILib\Controllers; -use MundiAPILib\Models\UpdateCustomerRequest; +use PagarmeCoreApiLib\Controllers; +use PagarmeCoreApiLib\Models\UpdateCustomerRequest; use Pagarme\Pagarme\Gateway\Transaction\Base\Config\Config; class CustomerUpdatePagarmeHelper @@ -70,11 +70,11 @@ public function getCustomers() } /** - * @return \MundiAPILib\MundiAPIClient + * @return \PagarmeCoreApiLib\PagarmeCoreApiClient */ public function getApi() { - return new \MundiAPILib\MundiAPIClient($this->config->getSecretKey(), ''); + return new \PagarmeCoreApiLib\PagarmeCoreApiClient($this->config->getSecretKey(), ''); } } diff --git a/composer.json b/composer.json index 9405aabc..bbc41334 100755 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "description": "Magento 2 Module Pagar.me", "require": { "php": "~7.1", - "mundipagg/mundiapi": "^3.0", + "pagarme/pagarmecoreapi": "^5.7", "pagarme/ecommerce-module-core": "~1.1.5" }, "require-dev": { From 75daf15ddbce66bdb0a69f288a23cfd91d2268c5 Mon Sep 17 00:00:00 2001 From: Fabiano Mallmann <25328512+fabiano-mallmann@users.noreply.github.com> Date: Tue, 13 Dec 2022 10:53:17 -0300 Subject: [PATCH 2/6] module version change in composer --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index bbc41334..d4ae9c25 100755 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "pagarme/pagarme-magento2-module", "license": "MIT", - "version": "1.1.7", + "version": "1.2.0", "type": "magento2-module", "description": "Magento 2 Module Pagar.me", "require": { From 595830bfddb76b26de98d66c2c792a9b8a4249c6 Mon Sep 17 00:00:00 2001 From: Claudio Hessel Date: Tue, 20 Dec 2022 11:26:49 -0300 Subject: [PATCH 3/6] PAOPN-279: 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 557c2f4899db4d4f555252de9d860243c5fa0867 Mon Sep 17 00:00:00 2001 From: mauriciohaygert Date: Wed, 21 Dec 2022 01:25:54 -0300 Subject: [PATCH 4/6] Save Customer on Pagarme just on update --- Observer/AdminCustomerBeforeSave.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Observer/AdminCustomerBeforeSave.php b/Observer/AdminCustomerBeforeSave.php index 1b3ce45b..9fd530f1 100644 --- a/Observer/AdminCustomerBeforeSave.php +++ b/Observer/AdminCustomerBeforeSave.php @@ -44,14 +44,19 @@ 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); } catch (\Exception $exception) { $log = new LogService('CustomerService'); - $log->info($exception->getMessage()); + $log->info("ola" . $exception->getMessage()); if ($exception->getCode() == 404) { $log->info( From 5fd8d77bdd9b39fbc4b4f2e1b841772d188bc660 Mon Sep 17 00:00:00 2001 From: mauriciohaygert Date: Wed, 21 Dec 2022 01:28:23 -0300 Subject: [PATCH 5/6] Save Customer on Pagarme just on update --- Observer/AdminCustomerBeforeSave.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Observer/AdminCustomerBeforeSave.php b/Observer/AdminCustomerBeforeSave.php index 9fd530f1..4725d871 100644 --- a/Observer/AdminCustomerBeforeSave.php +++ b/Observer/AdminCustomerBeforeSave.php @@ -44,7 +44,6 @@ public function execute(EventObserver $observer) } $event = $observer->getEvent(); - $platformCustomer = new Magento2PlatformCustomerDecorator($event->getCustomer()); if (empty($platformCustomer->getPagarmeId())) { @@ -56,7 +55,7 @@ public function execute(EventObserver $observer) $customerService->updateCustomerAtPagarme($platformCustomer); } catch (\Exception $exception) { $log = new LogService('CustomerService'); - $log->info("ola" . $exception->getMessage()); + $log->info($exception->getMessage()); if ($exception->getCode() == 404) { $log->info( From 4d662706baec1eca3b45931ff277c595e35cf3c3 Mon Sep 17 00:00:00 2001 From: Fabiano Mallmann <25328512+fabiano-mallmann@users.noreply.github.com> Date: Mon, 9 Jan 2023 16:16:10 -0300 Subject: [PATCH 6/6] update composer.json requires --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d4ae9c25..a21e6554 100755 --- a/composer.json +++ b/composer.json @@ -7,7 +7,7 @@ "require": { "php": "~7.1", "pagarme/pagarmecoreapi": "^5.7", - "pagarme/ecommerce-module-core": "~1.1.5" + "pagarme/ecommerce-module-core": "~1.2.0" }, "require-dev": { "phpunit/phpunit": "4.1.0",