ICICI LOMBARD : GWM
This commit is contained in:
parent
c815570e8f
commit
f7f3d845e8
@ -595,4 +595,7 @@ $routes->post("retrieveWebhookDataClaim","ClientWebHooksController::pullData_cla
|
||||
|
||||
//Third party Api Call
|
||||
|
||||
$routes->get('testCall','ICICILombardController::testCall');
|
||||
$routes->get('generateAuthToken','ICICILombardController::generateAuthToken');
|
||||
$routes->get('createEnrollmentBatch','ICICILombardController::createEnrollmentBatch');
|
||||
$routes->get('getEnrollmentBatchStatus','ICICILombardController::getEnrollmentBatchStatus');
|
||||
$routes->get('fetchUHIDDetails','ICICILombardController::fetchUHIDDetails');
|
||||
@ -6,7 +6,7 @@ use CodeIgniter\Controller;
|
||||
|
||||
class ICICILombardController extends AdminController
|
||||
{
|
||||
public function generateAuthToken($scope)
|
||||
public function generateAuthToken($scope = 'esbhealth')
|
||||
{
|
||||
helper('api');
|
||||
|
||||
@ -26,10 +26,157 @@ class ICICILombardController extends AdminController
|
||||
|
||||
$response = call_third_party_api($url, $method, $headers, $body);
|
||||
|
||||
if($response['status'] != false){
|
||||
|
||||
if($response['status'] != true){
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Token generation failed.',
|
||||
'data' => $response
|
||||
]);
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function createEnrollmentBatch()
|
||||
{
|
||||
helper('api');
|
||||
|
||||
//fetch token
|
||||
$tokenResponse = $this->generateAuthToken('esbgpabatchcreation');
|
||||
if (!$tokenResponse || empty($tokenResponse['data']['access_token'])) {
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Token generation failed.',
|
||||
'data' => $tokenResponse
|
||||
]);
|
||||
}
|
||||
$token = $tokenResponse['data']['access_token'];
|
||||
|
||||
|
||||
$url = 'https://ilesbapigee.insurancearticlez.com/health/ilservices/health/v1/enrollment/batchcreation';
|
||||
$headers = [
|
||||
'Authorization: Bearer ' . $token,
|
||||
'Content-Type: application/json'
|
||||
];
|
||||
|
||||
$body = [
|
||||
"PolicyNumber" => "4016/A/51974976/00/000",
|
||||
"CDBGAccountNumber" => "CD-MUM-3344",
|
||||
"CorrelationId" => "86383c78-4c67-4e4d-9aa0-8f926fb0d55f",
|
||||
"MemberDetails" => [
|
||||
[
|
||||
"EmployeeMemberId" => "EMPID3625556",
|
||||
"DOJ" => "21-MAR-2019",
|
||||
"InsuredName" => "ABC28144",
|
||||
"DOB" => "7-JUL-1983",
|
||||
"Relationship" => "SELF",
|
||||
"Gender" => "MALE",
|
||||
"DOC" => "20-JAN-2020",
|
||||
"SumInsured" => "600000",
|
||||
"EmailId" => "ABC@GMAIL.COM",
|
||||
"FlagStatus" => "A"
|
||||
],
|
||||
[
|
||||
"EmployeeMemberId" => "EMPID3625556",
|
||||
"DOJ" => "21-MAR-2019",
|
||||
"InsuredName" => "ABC28146",
|
||||
"DOB" => "8-AUG-1970",
|
||||
"Relationship" => "MOTHER",
|
||||
"Gender" => "FEMALE",
|
||||
"DOC" => "20-JAN-2020",
|
||||
"SumInsured" => "600000",
|
||||
"EmailId" => "ABC@GMAIL.COM",
|
||||
"FlagStatus" => "A"
|
||||
],
|
||||
[
|
||||
"EmployeeMemberId" => "EMPID0502220011",
|
||||
"UHID" => "IL00688842553",
|
||||
"InsuredName" => "ABC28142",
|
||||
"DOB" => "8-SEP-1970",
|
||||
"Gender" => "MALE",
|
||||
"SumInsured" => "600000",
|
||||
"EmailId" => "ABC@GMAIL.COM",
|
||||
"FlagStatus" => "M"
|
||||
],
|
||||
[
|
||||
"UHID" => "IL00688842552",
|
||||
"DOL" => "20-JAN-2020",
|
||||
"FlagStatus" => "D"
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, 'POST', $headers, json_encode($body), true); // true = raw body mode
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
public function getEnrollmentBatchStatus()
|
||||
{
|
||||
helper('api');
|
||||
|
||||
//fetch token
|
||||
$tokenResponse = $this->generateAuthToken('esbgpabatchstatus');
|
||||
if (!$tokenResponse || empty($tokenResponse['data']['access_token'])) {
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Token generation failed.',
|
||||
'data' => $tokenResponse
|
||||
]);
|
||||
}
|
||||
$token = $tokenResponse['data']['access_token'];
|
||||
|
||||
|
||||
$url = 'https://ilesbapigee.insurancearticlez.com/health/ilservices/health/v1/enrollment/batchstatus';
|
||||
$headers = [
|
||||
'Authorization: Bearer ' . $token,
|
||||
'Content-Type: application/json'
|
||||
];
|
||||
|
||||
$body = [
|
||||
"PolicyNumber" => "4016/A/51974976/00/000",
|
||||
"BatchId" => "2345617878",
|
||||
"CorrelationId" => "86383c78-4c67-4e4d-9aa0-8f926fb0d55f"
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, 'POST', $headers, json_encode($body), true);
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
public function fetchUHIDDetails()
|
||||
{
|
||||
helper('api');
|
||||
|
||||
//fetch token
|
||||
$tokenResponse = $this->generateAuthToken('esbgpauhid');
|
||||
if (!$tokenResponse || empty($tokenResponse['data']['access_token'])) {
|
||||
return $this->response->setJSON([
|
||||
'status' => false,
|
||||
'message' => 'Token generation failed.',
|
||||
'data' => $tokenResponse
|
||||
]);
|
||||
}
|
||||
$token = $tokenResponse['data']['access_token'];
|
||||
|
||||
$url = 'https://ilesbapigee.insurancearticlez.com/health/ilservices/health/v1/enrollment/fetchuhid';
|
||||
$headers = [
|
||||
'Authorization: Bearer ' . $token,
|
||||
'Content-Type: application/json'
|
||||
];
|
||||
|
||||
$body = [
|
||||
"PolicyNumber" => "4016/A/51974976/00/000",
|
||||
"IMID" => "2345617878",
|
||||
"CorrelationId" => "86383c78-4c67-4e4d-9aa0-8f926fb0d55f"
|
||||
];
|
||||
|
||||
$response = call_third_party_api($url, 'POST', $headers, json_encode($body), true);
|
||||
|
||||
return $this->response->setJSON($response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -16,13 +16,11 @@ if (!function_exists('call_third_party_api')) {
|
||||
}
|
||||
}
|
||||
|
||||
// return $contentType;
|
||||
// echo '<pre>';
|
||||
// print_r($headers);
|
||||
// print_r($body);
|
||||
// die;
|
||||
|
||||
|
||||
// Setup curl options
|
||||
$options = [
|
||||
CURLOPT_URL => $url,
|
||||
@ -50,7 +48,7 @@ if (!function_exists('call_third_party_api')) {
|
||||
$response = curl_exec($ch);
|
||||
$error = curl_error($ch);
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
if ($error) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user