_authorization(); } private function _authorization() { $headers = apache_request_headers(); $apiKey = \IpSupply\SyncOrder\Helper::API_KEY; foreach ($headers as $key => $value) { $key = strtolower($key); if ('api-key' === $key && $value === $apiKey) { return true; } } header('HTTP/1.1 401 Unauthorized'); header('Accept: application/json'); header('Content-Type: application/json'); die(json_encode(['message' => 'unauthorized'])); } public function getData() { return \IpSupply\SyncOrder\Helper::responseOk([ 'status' => true, 'data' => [] ]); } public function postData() { parse_str( string: file_get_contents('php://input'), result: $payload, ); unset($payload['form_key']); \IpSupply\SyncOrder\Config\Setter::set( path: 'config', value: json_encode($payload), ); return \IpSupply\SyncOrder\Helper::responseOk([ 'status' => true, ]); } }