update payload API

This commit is contained in:
Kai Ton 2024-05-24 02:38:28 +00:00
parent bd6006a31d
commit fa3b81a1f9
1 changed files with 8 additions and 3 deletions

View File

@ -54,9 +54,14 @@ final class Index
$payload['details'][] = (new Detail($item))->jsonSerialize(); $payload['details'][] = (new Detail($item))->jsonSerialize();
} }
try { try {
$payloadReq = [
'urlAPI' => '/api/quote/data-save-prology',
'data' => $payload
];
$response = $this->_client()->post($this->_config['url'], [ $response = $this->_client()->post($this->_config['url'], [
'json' => $payload 'json' => $payloadReq
]); ]);
$statusCode = $response->getStatusCode(); $statusCode = $response->getStatusCode();
$responseContent = $response->getBody()->getContents(); $responseContent = $response->getBody()->getContents();
return json_encode([ return json_encode([
@ -64,7 +69,7 @@ final class Index
'statusCode' => $statusCode, 'statusCode' => $statusCode,
'response' => $responseContent 'response' => $responseContent
], ],
'payload' => $payload, 'payloadReq' => $payloadReq,
'config' => $this->_config 'config' => $this->_config
]); ]);
} catch (BadResponseException $ex) { } catch (BadResponseException $ex) {
@ -75,7 +80,7 @@ final class Index
'statusCode' => $statusCode, 'statusCode' => $statusCode,
'response' => $responseContent 'response' => $responseContent
], ],
'payload' => $payload, 'payloadReq' => $payloadReq,
'config' => $this->_config 'config' => $this->_config
]); ]);
} }