_config = Getter::get('config'); } protected function _headers($headers = array()) { return array_merge([ 'Authorization' => 'Bearer ' . '' ], $headers); } protected function _client() { $client = new Client([ 'headers' => $this->_headers(), 'base_url' => $this->_config['url'], ]); return $client; } public function syncOrder($order): bool { if ($order instanceof \Magento\Sales\Model\Order\Interceptor) { $payload = [ 'url' => $this->_config['url'], 'source' => 'magento', ...(new Order($order))->jsonSerialize() ]; return true; } else { throw new \ErrorException('$order is not instance \Magento\Sales\Model\Order\Interceptor'); return false; } } }