CHANGE_RV

This commit is contained in:
VENKATESHWARAN 2025-07-10 15:18:27 +05:30
parent ef4271b1c7
commit 0971a687c9
2 changed files with 31 additions and 6 deletions

View File

@ -1826,7 +1826,7 @@ class EmployeeRestController extends AdminController
log_message('error', 'STEP 12: Calling post enrollment API with params: ' . json_encode($queryParams));
return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails');
return $restAuthController->callThirdPartyGETAPI($queryParams, 'getClientDetails', ['token' => $jwt]);
} else {
log_message('error', 'STEP 13: Unknown token_type: ' . $token_type);
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => []], 404);

View File

@ -74,21 +74,46 @@ class RestAuthenticationController extends AdminController
return $response->getBody();
}
public function callThirdPartyGETAPI($queryParams, $endPoint)
// public function callThirdPartyGETAPI($queryParams, $endPoint)
// {
// $client = \Config\Services::curlrequest();
// $url = env('POST_ENROLLMENT_BASEURL') . $endPoint;
// $response = $client->get($url, [
// 'query' => $queryParams, // pass as query parameters
// 'http_errors' => false // prevent exception on non-200 status
// ]);
// return $response->getBody();
// }
public function callThirdPartyGETAPI($queryParams, $endPoint, $params = [])
{
$client = \Config\Services::curlrequest();
$url = env('POST_ENROLLMENT_BASEURL') . $endPoint;
$response = $client->get($url, [
'query' => $queryParams, // pass as query parameters
'http_errors' => false // prevent exception on non-200 status
]);
$options = [
'query' => $queryParams,
'http_errors' => false,
];
if (isset($params['token']) && !empty($params['token'])) {
$options['headers'] = [
'Authorization' => 'Bearer ' . $params['token'],
'Accept' => 'application/json'
];
}
$response = $client->get($url, $options);
return $response->getBody();
}
// employee auth api's start