fix base url

This commit is contained in:
Kai Ton 2024-05-17 18:05:20 +00:00
parent 9b0043949a
commit 9943a83507
1 changed files with 8 additions and 2 deletions

View File

@ -24,9 +24,9 @@ final class Index
protected function _client() protected function _client()
{ {
$client = new Client([ $client = new Client([
'headers' => $this->_headers(), 'headers' => $this->_headers()
'base_url' => $this->_config['url'],
]); ]);
return $client; return $client;
@ -51,6 +51,12 @@ final class Index
$payload['details'][] = (new Detail($item))->jsonSerialize(); $payload['details'][] = (new Detail($item))->jsonSerialize();
} }
$this->_client()->post($this->_config['url'], [
'body' => [
"magento_2_" . time() => $payload
]
]);
return json_encode($payload); return json_encode($payload);
} else { } else {
throw new \ErrorException('$order is not instance \Magento\Sales\Model\Order\Interceptor'); throw new \ErrorException('$order is not instance \Magento\Sales\Model\Order\Interceptor');