From 2a71802d604504054a808ff486728428920680be Mon Sep 17 00:00:00 2001 From: shin Date: Wed, 22 Sep 2021 18:04:43 +0700 Subject: [PATCH 01/12] - Fix Proxy --- Helper/EmailMarketing.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Helper/EmailMarketing.php b/Helper/EmailMarketing.php index f4809ab..b9f19c9 100755 --- a/Helper/EmailMarketing.php +++ b/Helper/EmailMarketing.php @@ -1697,9 +1697,9 @@ public function sendRequestProxy($data) if ($this->_request->getMethod() === 'POST') { $body = $this->setHeaders($data, $url); - $this->_curl->post($this->url, $body); + $this->_curl->post($url, $body); } else { - $this->_curl->get($this->url); + $this->_curl->get($url); } $body = $this->_curl->getBody(); From 73abbf9bafd077babeca011cac52c1bbdb9fdc24 Mon Sep 17 00:00:00 2001 From: shin Date: Fri, 24 Sep 2021 11:20:38 +0700 Subject: [PATCH 02/12] - Fix proxy --- Controller/Proxy/Index.php | 13 +++++++++++-- Helper/EmailMarketing.php | 19 +++++-------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Controller/Proxy/Index.php b/Controller/Proxy/Index.php index 22ab1e5..8ef3a40 100644 --- a/Controller/Proxy/Index.php +++ b/Controller/Proxy/Index.php @@ -61,8 +61,17 @@ public function __construct( public function execute() { try { - $params = $this->getRequest()->getParams(); - $response = $this->helperEmailMarketing->sendRequestProxy($params); + $params = $this->getRequest()->getParams(); + $url = EmailMarketing::PROXY_URL; + if (isset($params['path'])) { + $url = EmailMarketing::PROXY_URL . $params['path']; + } + + if ($this->_request->getMethod() === 'GET') { + return $this->_redirect($url); + } + + $response = $this->helperEmailMarketing->sendRequestProxy($url, $params); } catch (Exception $e) { $response = []; } diff --git a/Helper/EmailMarketing.php b/Helper/EmailMarketing.php index b9f19c9..110330d 100755 --- a/Helper/EmailMarketing.php +++ b/Helper/EmailMarketing.php @@ -1680,27 +1680,18 @@ public function isTracking($storeId = null) } /** - * @param array $data + * @param string $url + * @param array|null $data * * @return mixed - * @throws LocalizedException * @throws NoSuchEntityException */ - public function sendRequestProxy($data) + public function sendRequestProxy($url, $data) { - $url = self::PROXY_URL; - if (isset($data['path'])) { - $url = self::PROXY_URL . $data['path']; - } - $this->initCurl(); - if ($this->_request->getMethod() === 'POST') { - $body = $this->setHeaders($data, $url); - $this->_curl->post($url, $body); - } else { - $this->_curl->get($url); - } + $body = $this->setHeaders($data, $url); + $this->_curl->post($url, $body); $body = $this->_curl->getBody(); $bodyData = self::jsonDecode($body); From b12c0f7de3ceea1bc91088e301a543005608b6e5 Mon Sep 17 00:00:00 2001 From: shin Date: Tue, 28 Sep 2021 16:46:18 +0700 Subject: [PATCH 03/12] - Fix bug --- Model/Config/Source/SyncType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Config/Source/SyncType.php b/Model/Config/Source/SyncType.php index 57cd7d7..fb09bd7 100755 --- a/Model/Config/Source/SyncType.php +++ b/Model/Config/Source/SyncType.php @@ -56,7 +56,7 @@ public function toOptionArray() ], [ 'value' => self::ALL, - 'label' => __('Every Thing') + 'label' => __('Everything') ] ]; From 888df0580111f303ccd1512ec9f095547ae6f4d3 Mon Sep 17 00:00:00 2001 From: shin Date: Tue, 28 Sep 2021 17:34:21 +0700 Subject: [PATCH 04/12] - Update Sync --- .../system/config/sync-template.phtml | 38 ++++++++++++++++--- view/adminhtml/web/js/model/sync.js | 19 +++++++--- 2 files changed, 47 insertions(+), 10 deletions(-) diff --git a/view/adminhtml/templates/system/config/sync-template.phtml b/view/adminhtml/templates/system/config/sync-template.phtml index 42c54f2..dc99b6d 100644 --- a/view/adminhtml/templates/system/config/sync-template.phtml +++ b/view/adminhtml/templates/system/config/sync-template.phtml @@ -26,12 +26,9 @@ use Mageplaza\Smtp\Helper\Data; ?>
- + + + +