diff --git a/app/code/IpSupply/SyncOrder/Api/Repository.php b/app/code/IpSupply/SyncOrder/Api/Repository.php index ecb10796..68abc53f 100755 --- a/app/code/IpSupply/SyncOrder/Api/Repository.php +++ b/app/code/IpSupply/SyncOrder/Api/Repository.php @@ -21,7 +21,7 @@ class Repository implements RepositoryInterface foreach ($headers as $key => $value) { $key = strtolower($key); - if ('api_key' === $key && $value === $apiKey) { + if ('api-key' === $key && $value === $apiKey) { return true; } } diff --git a/app/code/IpSupply/SyncOrder/Controller/Adminhtml/Config/Post.php b/app/code/IpSupply/SyncOrder/Controller/Adminhtml/Config/Post.php new file mode 100644 index 00000000..79303d91 --- /dev/null +++ b/app/code/IpSupply/SyncOrder/Controller/Adminhtml/Config/Post.php @@ -0,0 +1,49 @@ +_pageFactory = $pageFactory; + return parent::__construct($context); + } + + public function execute() + { + $payload = $this->getRequest()->getPostValue(); + + unset($payload['form_key']); + \IpSupply\SyncOrder\Config\Setter::set( + path: 'config', + value: json_encode($payload), + ); + + if ($this->getRequest()->getParam('isAjax')) { + return Helper::responseOk([ + 'status' => true + ]); + } else { + $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); + $resultRedirect->setPath('*/*/index'); + return $resultRedirect; + } + } +} diff --git a/app/code/IpSupply/SyncOrder/view/adminhtml/templates/syncorder_config.phtml b/app/code/IpSupply/SyncOrder/view/adminhtml/templates/syncorder_config.phtml index 450c5f91..ce74f8f2 100755 --- a/app/code/IpSupply/SyncOrder/view/adminhtml/templates/syncorder_config.phtml +++ b/app/code/IpSupply/SyncOrder/view/adminhtml/templates/syncorder_config.phtml @@ -1,10 +1,16 @@
-
+ + getBlockHtml('formkey') ?> getForm() as $field) : ?> -
- - -
+
+ + +
@@ -13,8 +19,6 @@