'password', 'username' => 'Nhanceins', 'password' => 'SSWW7bFNaLxxQyw', 'scope' => $scope, 'client_id' => 'Nhanceins', 'client_secret' => 'P4W0G6TAYMa0MV8bbVSx4pTAqbCcUIg48kCWa6PJykAhGWzPmpPr0iLuNWtz5wqN' ]; print_rr(json_encode($body));//die; $response = call_third_party_api($url, $method, $headers, $body); print_rr(json_encode($response));//die; 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(); if (!$tokenResponse || empty($tokenResponse['data']['access_token'])) { return $this->response->setJSON([ 'status' => false, 'message' => 'Token generation failed.', 'data' => $tokenResponse ]); } $token = $tokenResponse['data']['access_token']; // dd($token); $url = 'https://ilesbapigee.insurancearticlez.com/health/ilservices/health/v1/enrollment/batchcreation'; $headers = [ 'Authorization: Bearer ' . $token, 'Content-Type: application/json', //'Scope: esbgpabatchcreation' ]; #old policy info start #"PolicyNumber" => "4016/A/51974976/00/000", # "CDBGAccountNumber" => "CD-MUM-3344", #"CorrelationId" => "86383c78-4c67-4e4d-9aa0-8f926fb0d55f", #old policy inf end $body = [ "PolicyNumber" => "4016/A/O/53077718/00/000", "CDBGAccountNumber" => "CD-MUM-0026", "CorrelationId" => "86383c78-4c67-4e4d-9aa0-8f926fb0d55f", "MemberDetails" => [ [ "EmployeeMemberId" => "EMPID3625556", "DOJ" => "21-MAR-2019", "InsuredName" => "ABC28144", "DOB" => "7-JUL-1983", "Relationship" => "SELF", "Gender" => "MALE", "DOC" => "08-JUL-2025", "SumInsured" => "400000", "EmailId" => "ABC@GMAIL.COM", "FlagStatus" => "A" ], [ "EmployeeMemberId" => "EMPID3625556", "DOJ" => "21-MAR-2019", "InsuredName" => "ABC28146", "DOB" => "8-AUG-1970", "Relationship" => "MOTHER", "Gender" => "FEMALE", "DOC" => "08-JUL-2025", "SumInsured" => "400000", "EmailId" => "ABC@GMAIL.COM", "FlagStatus" => "A" ], [ "EmployeeMemberId" => "EMPID0502220011", "UHID" => "IL00688842553", "InsuredName" => "ABC28142", "DOB" => "8-SEP-1970", "Gender" => "MALE", "SumInsured" => "400000", "EmailId" => "ABC@GMAIL.COM", "FlagStatus" => "M" ], [ "UHID" => "IL00688842552", "DOL" => "08-JUL-2025", "FlagStatus" => "D" ] ] ]; // Kint::dump($body); print_rr(json_encode($body)); // dd(); $response = call_third_party_api($url, 'POST', $headers, ($body),true); // true = raw body mode print_rr(json_encode($response));die(); 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); } }