Fix call to drivehub. #737

This commit is contained in:
Korina Cordero 2023-02-21 03:09:21 +00:00
parent d1b8da24bf
commit c9a362cd8f
2 changed files with 8 additions and 16 deletions

View file

@ -24,10 +24,8 @@ class JobOrderCallbackRouter
if ($callback_url != null)
{
// form the body for the callback
// jo id and jo status
$jo_data = [
'job_id' => $jo->getID(),
// 'status' => JOStatus::getName($jo->getStatus()),
];
// send status
@ -48,24 +46,18 @@ class JobOrderCallbackRouter
return false;
}
protected function sendJOInfo($jo_info, $callback_url)
protected function sendJOInfo($jo_data, $callback_url)
{
$body = json_encode($jo_info);
$params = http_build_query($jo_data);
// error_log(print_r($body, true));
// error_log('Sending json output to ' . $callback_url);
//error_log('Sending output to ' . $callback_url . $params);
$curl = curl_init();
$options = [
CURLOPT_URL => $callback_url,
CURLOPT_POST => true,
CURLOPT_URL => $callback_url . $params,
CURLOPT_POST => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POSTFIELDS => $body,
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
],
];
curl_setopt_array($curl, $options);
@ -74,6 +66,6 @@ class JobOrderCallbackRouter
curl_close($curl);
// check result
error_log('Result ' . $res);
error_log('Result ' . $res);
}
}

View file

@ -38,7 +38,7 @@ CREATE TABLE `job_order_source` (
LOCK TABLES `job_order_source` WRITE;
/*!40000 ALTER TABLE `job_order_source` DISABLE KEYS */;
INSERT INTO `job_order_source` VALUES (1,'drivehub','https://ny61i0s3rj.execute-api.ap-southeast-1.amazonaws.com/dev/','DriveHub');
INSERT INTO `job_order_source` VALUES (1,'drivehub','https://ny61i0s3rj.execute-api.ap-southeast-1.amazonaws.com/dev/callback?','DriveHub');
/*!40000 ALTER TABLE `job_order_source` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
@ -51,4 +51,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2023-02-20 7:02:45
-- Dump completed on 2023-02-21 3:08:45