CHANGE_ : chat bot flow : GWM
This commit is contained in:
parent
a36cb3501f
commit
3f3d97d323
0
.cpanel.yml
Normal file → Executable file
0
.cpanel.yml
Normal file → Executable file
0
.env.sample
Normal file → Executable file
0
.env.sample
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
0
Papirus-Team-Papirus-Apps-Fusion-icon.512.png
Normal file → Executable file
0
Papirus-Team-Papirus-Apps-Fusion-icon.512.png
Normal file → Executable file
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
0
app/.htaccess
Normal file → Executable file
0
app/.htaccess
Normal file → Executable file
0
app/Common.php
Normal file → Executable file
0
app/Common.php
Normal file → Executable file
0
app/Config/App.php
Normal file → Executable file
0
app/Config/App.php
Normal file → Executable file
0
app/Config/Boot/development.php
Normal file → Executable file
0
app/Config/Boot/development.php
Normal file → Executable file
0
app/Config/Boot/production.php
Normal file → Executable file
0
app/Config/Boot/production.php
Normal file → Executable file
0
app/Config/Boot/test.php
Normal file → Executable file
0
app/Config/Boot/test.php
Normal file → Executable file
0
app/Config/Boot/testing.php
Normal file → Executable file
0
app/Config/Boot/testing.php
Normal file → Executable file
0
app/Config/Boot/uat.php
Normal file → Executable file
0
app/Config/Boot/uat.php
Normal file → Executable file
0
app/Config/CURLRequest.php
Normal file → Executable file
0
app/Config/CURLRequest.php
Normal file → Executable file
0
app/Config/Cache.php
Normal file → Executable file
0
app/Config/Cache.php
Normal file → Executable file
0
app/Config/Constants.php
Normal file → Executable file
0
app/Config/Constants.php
Normal file → Executable file
0
app/Config/ContentSecurityPolicy.php
Normal file → Executable file
0
app/Config/ContentSecurityPolicy.php
Normal file → Executable file
0
app/Config/Cookie.php
Normal file → Executable file
0
app/Config/Cookie.php
Normal file → Executable file
0
app/Config/Database.php
Normal file → Executable file
0
app/Config/Database.php
Normal file → Executable file
0
app/Config/Email.php
Normal file → Executable file
0
app/Config/Email.php
Normal file → Executable file
0
app/Config/Encryption.php
Normal file → Executable file
0
app/Config/Encryption.php
Normal file → Executable file
0
app/Config/Events.php
Normal file → Executable file
0
app/Config/Events.php
Normal file → Executable file
0
app/Config/Exceptions.php
Normal file → Executable file
0
app/Config/Exceptions.php
Normal file → Executable file
0
app/Config/Feature.php
Normal file → Executable file
0
app/Config/Feature.php
Normal file → Executable file
0
app/Config/Filters.php
Normal file → Executable file
0
app/Config/Filters.php
Normal file → Executable file
0
app/Config/ForeignCharacters.php
Normal file → Executable file
0
app/Config/ForeignCharacters.php
Normal file → Executable file
0
app/Config/Format.php
Normal file → Executable file
0
app/Config/Format.php
Normal file → Executable file
0
app/Config/Generators.php
Normal file → Executable file
0
app/Config/Generators.php
Normal file → Executable file
0
app/Config/Honeypot.php
Normal file → Executable file
0
app/Config/Honeypot.php
Normal file → Executable file
0
app/Config/Images.php
Normal file → Executable file
0
app/Config/Images.php
Normal file → Executable file
0
app/Config/Kint.php
Normal file → Executable file
0
app/Config/Kint.php
Normal file → Executable file
0
app/Config/Logger.php
Normal file → Executable file
0
app/Config/Logger.php
Normal file → Executable file
0
app/Config/Migrations.php
Normal file → Executable file
0
app/Config/Migrations.php
Normal file → Executable file
0
app/Config/Mimes.php
Normal file → Executable file
0
app/Config/Mimes.php
Normal file → Executable file
0
app/Config/Modules.php
Normal file → Executable file
0
app/Config/Modules.php
Normal file → Executable file
0
app/Config/Pager.php
Normal file → Executable file
0
app/Config/Pager.php
Normal file → Executable file
0
app/Config/Paths.php
Normal file → Executable file
0
app/Config/Paths.php
Normal file → Executable file
0
app/Config/Publisher.php
Normal file → Executable file
0
app/Config/Publisher.php
Normal file → Executable file
4
app/Config/Routes.php
Normal file → Executable file
4
app/Config/Routes.php
Normal file → Executable file
@ -309,12 +309,12 @@ $routes->group("/api", ["filter" => "authJWT"], function ($routes) {
|
||||
|
||||
|
||||
|
||||
|
||||
// $routes->post("getChatResponse", "ChatBotController::getChatResponse");
|
||||
$routes->group("employeeRest", ["filter" => "authJWT"], function ($routes) {
|
||||
$routes->post("storeFireBase", "EmployeeRestController::storeFireBase");
|
||||
$routes->post("saveMpin", "RestAuthenticationController::saveMpin");
|
||||
$routes->post("updateMpin", "RestAuthenticationController::updateMpin");
|
||||
$routes->get("getChatResponse", "ChatBotController::getChatResponse");
|
||||
$routes->post("getChatResponse", "ChatBotController::getChatResponse");
|
||||
$routes->get("getEmployeeProfile", "EmployeeRestController::getEmployeeProfile");
|
||||
$routes->post("employeeUpload", "EmployeeRestController::employeeUpload");
|
||||
$routes->get("relationshipList", "EmployeeRestController::relationshipList");
|
||||
|
||||
0
app/Config/Routing.php
Normal file → Executable file
0
app/Config/Routing.php
Normal file → Executable file
0
app/Config/Security.php
Normal file → Executable file
0
app/Config/Security.php
Normal file → Executable file
0
app/Config/Services.php
Normal file → Executable file
0
app/Config/Services.php
Normal file → Executable file
0
app/Config/Session.php
Normal file → Executable file
0
app/Config/Session.php
Normal file → Executable file
0
app/Config/Toolbar.php
Normal file → Executable file
0
app/Config/Toolbar.php
Normal file → Executable file
0
app/Config/UserAgents.php
Normal file → Executable file
0
app/Config/UserAgents.php
Normal file → Executable file
0
app/Config/Validation.php
Normal file → Executable file
0
app/Config/Validation.php
Normal file → Executable file
0
app/Config/View.php
Normal file → Executable file
0
app/Config/View.php
Normal file → Executable file
0
app/Config/google-services.json
Normal file → Executable file
0
app/Config/google-services.json
Normal file → Executable file
0
app/Controllers/AdminController.php
Normal file → Executable file
0
app/Controllers/AdminController.php
Normal file → Executable file
0
app/Controllers/AppContentManagementController.php
Normal file → Executable file
0
app/Controllers/AppContentManagementController.php
Normal file → Executable file
0
app/Controllers/BaseController.php
Normal file → Executable file
0
app/Controllers/BaseController.php
Normal file → Executable file
333
app/Controllers/ChatBotController.php
Normal file → Executable file
333
app/Controllers/ChatBotController.php
Normal file → Executable file
@ -74,39 +74,61 @@ class ChatBotController extends AdminController
|
||||
public function getChatResponse()
|
||||
{
|
||||
// try {
|
||||
$request_for = $this->request->getGet('request_for');
|
||||
$option = $this->request->getGet('option');
|
||||
$is_option = $this->request->getGet('is_option');
|
||||
$emp_code = $this->request->getVar('emp_code');
|
||||
$client_id = $this->request->getVar('client_id');
|
||||
$client_branch_id = $this->request->getVar('client_branch_id');
|
||||
$request_for = $this->request->getVar('request_for');
|
||||
$option = $this->request->getVar('option');
|
||||
$is_option = $this->request->getVar('is_option');
|
||||
|
||||
$responseData = $this->ChatBotModel->where('request', $request_for)
|
||||
->where('is_active', 1 )
|
||||
->first();
|
||||
|
||||
|
||||
|
||||
if ($responseData) {
|
||||
|
||||
|
||||
if(isset($option) && $option != 0){
|
||||
if(isset($option) && $option != 0)
|
||||
{
|
||||
|
||||
$decodedData = json_decode($responseData['options'],true);
|
||||
|
||||
|
||||
|
||||
if (isset($decodedData[$option]) && $decodedData[$option] !== null) {
|
||||
|
||||
|
||||
$requestFor = $decodedData[$option];
|
||||
$responseData = $this->ChatBotModel->where('request', $requestFor)
|
||||
->where('is_active', 1 )
|
||||
->first();
|
||||
|
||||
if($responseData['request'] == 'Call' || $responseData['request'] == 'Mail'){
|
||||
|
||||
$AccountManagerDetails = $this->clientRMModel->select('client_rm.* , user_profiles.*')
|
||||
->join('user_profiles', 'client_rm.user_id = user_profiles.id', 'left')
|
||||
->where('client_rm.client_id', $client_id )
|
||||
->where('client_rm.level', 3 )
|
||||
->findAll();
|
||||
|
||||
if(isset($AccountManagerDetails) && $responseData['request'] == 'Call'){
|
||||
$responseData['options'] = $AccountManagerDetails[0]['mobile'];
|
||||
}else if(isset($AccountManagerDetails) && $responseData['request'] == 'Mail'){
|
||||
$responseData['options'] = $AccountManagerDetails[0]['email'];
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
if( $request_for == 'Create claim'){
|
||||
if( $request_for == 'Initiate claim'){
|
||||
$result = [
|
||||
'request_for' => $request_for,
|
||||
'options' => json_decode($responseData['options'], true),
|
||||
'text' => "Enter Message",
|
||||
'is_option' => "0",
|
||||
'policy_id' => $option,
|
||||
'mobile_no' => $this->request->getGet('mobile_no')
|
||||
'mobile_no' => $this->request->getVar('mobile_no'),
|
||||
'navigation' => $responseData['navigation'],
|
||||
'navigation_type' => $responseData['navigation_type']
|
||||
];
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
||||
@ -123,8 +145,8 @@ class ChatBotController extends AdminController
|
||||
|
||||
if(isset($is_option) && $is_option == 0){
|
||||
|
||||
$text = $this->request->getGet('text');
|
||||
$value = $this->request->getGet('value');
|
||||
$text = $this->request->getVar('text');
|
||||
$value = $this->request->getVar('value');
|
||||
$Data = $this->ChatBotModel->where('options', $text)->where('is_active', 1 )->first();
|
||||
if($Data){
|
||||
|
||||
@ -132,7 +154,7 @@ class ChatBotController extends AdminController
|
||||
{
|
||||
$result = $this->getAllPolicyByMobileNumber($value,'text');
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
||||
}else if($Data['options'] == 'Please Enter Your Mobile Number To Raise Ticket'){
|
||||
}else if($Data['options'] == 'Please Enter Your Mobile Number To Raise Claim'){
|
||||
$result = $this->getAllPolicyByMobileNumber($value,'options');
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
||||
}
|
||||
@ -151,8 +173,10 @@ class ChatBotController extends AdminController
|
||||
$result = [
|
||||
'request_for' => $request_for,
|
||||
'options' => null,
|
||||
'text' => $ticket['message'].', Your Ticket id is '.$ticket['ticket_id'],
|
||||
'is_option' => "0"
|
||||
'text' => $ticket['message'].', Your Claim id is '.$ticket['ticket_id'],
|
||||
'is_option' => "0",
|
||||
'navigation' => "0",
|
||||
'navigation_type' => null
|
||||
];
|
||||
}else{
|
||||
|
||||
@ -160,7 +184,9 @@ class ChatBotController extends AdminController
|
||||
'request_for' => $request_for,
|
||||
'options' => null,
|
||||
'text' => $ticket['message'],
|
||||
'is_option' => "0"
|
||||
'is_option' => "0",
|
||||
'navigation' => "0",
|
||||
'navigation_type' => null
|
||||
];
|
||||
}
|
||||
|
||||
@ -178,11 +204,15 @@ class ChatBotController extends AdminController
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$result = [
|
||||
'request_for' => $responseData['request'],
|
||||
'options' => json_decode($responseData['options'], true),
|
||||
'text' => $responseData['is_option'] != 1 ? $responseData['options'] : null,
|
||||
'is_option' => $responseData['is_option']
|
||||
'is_option' => $responseData['is_option'],
|
||||
'navigation' => $responseData['navigation'],
|
||||
'navigation_type' => $responseData['navigation_type']
|
||||
];
|
||||
|
||||
return $this->respond(['status' => 'success','code' => 200,'data' => $result ],200);
|
||||
@ -190,180 +220,181 @@ class ChatBotController extends AdminController
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404);
|
||||
}
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => 'failed','code' => 404,'data' => 'No Data'],404);
|
||||
}
|
||||
// } catch (\Throwable $th) {
|
||||
// return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
public function sendDefaultMessage()
|
||||
{
|
||||
$responseData = $this->ChatBotModel->where('id', 1)->where('is_active', 1 )->first();
|
||||
return [
|
||||
'request_for' => $responseData['request'],
|
||||
'options' => json_decode($responseData['options'], true),
|
||||
'text' => $responseData['is_option'] != 1 ? $responseData['options'] : null,
|
||||
'is_option' => $responseData['is_option']
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
public function sendDefaultMessage()
|
||||
{
|
||||
$responseData = $this->ChatBotModel->where('id', 1)->where('is_active', 1 )->first();
|
||||
return [
|
||||
'request_for' => $responseData['request'],
|
||||
'options' => json_decode($responseData['options'], true),
|
||||
'text' => $responseData['is_option'] != 1 ? $responseData['options'] : null,
|
||||
'is_option' => $responseData['is_option'],
|
||||
'navigation' => $responseData['navigation'],
|
||||
'navigation_type' => $responseData['navigation_type']
|
||||
];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function getAllPolicyByMobileNumber($mobileNo,$action)
|
||||
{
|
||||
$employee = $this->employeeModel->where('mobile', $mobileNo)->where('is_active', 1 )->first();
|
||||
if($employee){
|
||||
public function getAllPolicyByMobileNumber($mobileNo,$action)
|
||||
{
|
||||
$employee = $this->employeeModel->where('mobile', $mobileNo)->where('is_active', 1 )->first();
|
||||
if($employee){
|
||||
|
||||
$employeeData = $this->employeeModel->where('emp_code', $employee['emp_code'])
|
||||
->where('client_id',$employee['client_id'])
|
||||
->where('client_branch_id',$employee['client_branch_id'])
|
||||
->where('is_active', 1 )->findAll();
|
||||
$whereArrayForId = [];
|
||||
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
||||
$employeeData = $this->employeeModel->where('emp_code', $employee['emp_code'])
|
||||
->where('client_id',$employee['client_id'])
|
||||
->where('client_branch_id',$employee['client_branch_id'])
|
||||
->where('is_active', 1 )->findAll();
|
||||
$whereArrayForId = [];
|
||||
foreach ( $employeeData as $key => $value) { array_push($whereArrayForId, $value['id']); }
|
||||
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policies.name as policy_name , policy_type.policy_type as policy_type')
|
||||
->join('policies', 'client_policy.policy_id = policies.id', 'left')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('client_policy.client_id', $employee['client_id'] )
|
||||
->where('client_policy.client_branch_id', $employee['client_branch_id'] )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->orderby('client_policy.id' , 'ASC')
|
||||
->findAll();
|
||||
$options = [];
|
||||
$text = '';
|
||||
if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
|
||||
{
|
||||
|
||||
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
|
||||
$ClientPolicyData = $this->clientPolicyModel->select('client_policy.* , policy_type.long_name as policy_name , policy_type.policy_type as policy_type')
|
||||
->join('policy_type', 'client_policy.policy_type_id = policy_type.id', 'left')
|
||||
->where('client_policy.client_id', $employee['client_id'] )
|
||||
->where('client_policy.client_branch_id', $employee['client_branch_id'] )
|
||||
->where('client_policy.is_active', 1 )
|
||||
->where('client_policy.policy_status', 1)
|
||||
->orderby('client_policy.id' , 'ASC')
|
||||
->findAll();
|
||||
$options = [];
|
||||
$text = '';
|
||||
if(count($ClientPolicyData) > 0 && count($employeeData) > 0)
|
||||
{
|
||||
|
||||
foreach ($ClientPolicyData as $key => $ClientPolicyValue) {
|
||||
|
||||
$data['policy_name'] = $ClientPolicyValue['policy_name'];
|
||||
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
||||
$data['policy_no'] = $ClientPolicyValue['policy_no'];
|
||||
|
||||
$data['policy_name'] = $ClientPolicyValue['policy_name'];
|
||||
$data['policy_type'] = $ClientPolicyValue['policy_type'];
|
||||
$data['policy_no'] = $ClientPolicyValue['policy_no'];
|
||||
|
||||
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->whereIn('employee_polices.employee_id',$whereArrayForId)
|
||||
->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
if(count($employee_policy) > 0)
|
||||
{
|
||||
$policy[$ClientPolicyValue['id']] = $ClientPolicyValue['policy_name']."(".$ClientPolicyValue['policy_type'].")";
|
||||
array_push($options, $policy);
|
||||
$text .= $ClientPolicyValue['policy_name']."(".$ClientPolicyValue['policy_type'].") % ";
|
||||
|
||||
$employee_policy = $this->employeePolicyModel->select('employees.*,employee_polices.employee_id , employee_polices.basic_cover_si , employee_polices.premium , employee_polices.gst , employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->whereIn('employee_polices.employee_id',$whereArrayForId)
|
||||
->where('employee_polices.client_policy_id',$ClientPolicyValue['id'])
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
if(count($employee_policy) > 0)
|
||||
{
|
||||
$policy[$ClientPolicyValue['id']] = $ClientPolicyValue['policy_name']."(".$ClientPolicyValue['policy_type'].")";
|
||||
array_push($options, $policy);
|
||||
$text .= $ClientPolicyValue['policy_name']." % ";
|
||||
}else{
|
||||
$text .= "There is no any active policies ";
|
||||
}
|
||||
|
||||
}
|
||||
if($action == 'options'){
|
||||
return [
|
||||
'request_for' => $this->request->getVar('request_for'),
|
||||
'options' => $options[count($options) - 1],
|
||||
'text' => null,
|
||||
'is_option' => "1",
|
||||
'mobile_no' => $mobileNo,
|
||||
];
|
||||
}else{
|
||||
$text .= "There is no any active policies ";
|
||||
return [
|
||||
'request_for' => $this->request->getVar('request_for'),
|
||||
'options' => null,
|
||||
'text' => $text,
|
||||
'is_option' => "0",
|
||||
'mobile_no' => $mobileNo,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
if($action == 'options'){
|
||||
return [
|
||||
'request_for' => $this->request->getGet('request_for'),
|
||||
'options' => $options[count($options) - 1],
|
||||
'text' => null,
|
||||
'is_option' => "1",
|
||||
'mobile_no' => $mobileNo,
|
||||
];
|
||||
|
||||
|
||||
}else{
|
||||
return [
|
||||
'request_for' => $this->request->getGet('request_for'),
|
||||
'request_for' => $this->request->getVar('request_for'),
|
||||
'options' => null,
|
||||
'text' => $text,
|
||||
'is_option' => "0",
|
||||
'mobile_no' => $mobileNo,
|
||||
'text' => "Dear ".$employee['name']." Policy not yet bound for you.",
|
||||
'is_option' => "0"
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
return [
|
||||
'request_for' => $this->request->getGet('request_for'),
|
||||
'request_for' => $this->request->getVar('request_for'),
|
||||
'options' => null,
|
||||
'text' => "Dear ".$employee['name'].", % Policy not yet bound for you.",
|
||||
'text' => "Invalid Mobile Number",
|
||||
'is_option' => "0"
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}else{
|
||||
return [
|
||||
'request_for' => $this->request->getGet('request_for'),
|
||||
'options' => null,
|
||||
'text' => "Invalid Mobile Number",
|
||||
'is_option' => "0"
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
public function claimTicket()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
$employee = $this->employeeModel->where('mobile', $this->request->getVar('mobile_no'))->where('is_active', 1 )->first();
|
||||
if($employee){
|
||||
|
||||
public function claimTicket()
|
||||
{
|
||||
|
||||
$url = 'https://venbait.in/nhance/helpdesk/dev/api/tickets/create';
|
||||
|
||||
$employee = $this->employeeModel->where('mobile', $this->request->getGet('mobile_no'))->where('is_active', 1 )->first();
|
||||
if($employee){
|
||||
|
||||
$token = 'uncp8FvG310bEyYdV9MmStlo7KDRZ65fLWTeXCI2JzwPrNHjBqQhUiAgxsaO';
|
||||
$headers = [
|
||||
'Token: ' . $token,
|
||||
];
|
||||
|
||||
$url = 'https://venbait.in/nhance/helpdesk/dev/api/tickets/create';
|
||||
// Form data
|
||||
$data = [
|
||||
'opener' => 'user',
|
||||
'department_id' => 2,
|
||||
'subject' => 'Claim Raised by Chat Bot',
|
||||
'body' => $this->request->getVar('value'),
|
||||
'policy_id' => $this->request->getVar('policy_id'),
|
||||
'emp_code' => $employee['emp_code'],
|
||||
'mobile_number' => $this->request->getVar('mobile_no'),
|
||||
'email' => 'adhavanvalli@gmail.com',
|
||||
'fullname' => $employee['name'],
|
||||
];
|
||||
|
||||
// Initialize cURL session
|
||||
$ch = curl_init();
|
||||
|
||||
// Set cURL options
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
return $response;
|
||||
// Check for errors
|
||||
// if (curl_errno($ch)) {
|
||||
// $error = curl_error($ch);
|
||||
// curl_close($ch);
|
||||
// return ['status' => 'failed', 'response' => $error];
|
||||
// } else {
|
||||
// // Close cURL session
|
||||
// curl_close($ch);
|
||||
// return ['status' => 'success', 'response' => $response];
|
||||
// }
|
||||
|
||||
|
||||
$token = 'uncp8FvG310bEyYdV9MmStlo7KDRZ65fLWTeXCI2JzwPrNHjBqQhUiAgxsaO';
|
||||
$headers = [
|
||||
'Token: ' . $token,
|
||||
];
|
||||
|
||||
// Form data
|
||||
$data = [
|
||||
'opener' => 'user',
|
||||
'department_id' => 2,
|
||||
'subject' => 'Claim Raised by Chat Bot',
|
||||
'body' => $this->request->getGet('value'),
|
||||
'policy_id' => $this->request->getGet('policy_id'),
|
||||
'emp_code' => $employee['emp_code'],
|
||||
'mobile_number' => $this->request->getGet('mobile_no'),
|
||||
'email' => 'adhavanvalli@gmail.com',
|
||||
'fullname' => $employee['name'],
|
||||
];
|
||||
|
||||
// Initialize cURL session
|
||||
$ch = curl_init();
|
||||
|
||||
// Set cURL options
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_POST, true);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
$response = curl_exec($ch);
|
||||
return $response;
|
||||
// Check for errors
|
||||
// if (curl_errno($ch)) {
|
||||
// $error = curl_error($ch);
|
||||
// curl_close($ch);
|
||||
// return ['status' => 'failed', 'response' => $error];
|
||||
// } else {
|
||||
// // Close cURL session
|
||||
// curl_close($ch);
|
||||
// return ['status' => 'success', 'response' => $response];
|
||||
// }
|
||||
|
||||
|
||||
}else{
|
||||
return ['status' => 'failed', 'response' => 'Employee Not Found'];
|
||||
}else{
|
||||
return ['status' => 'failed', 'response' => 'Employee Not Found'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
0
app/Controllers/ClientController.php
Normal file → Executable file
0
app/Controllers/ClientController.php
Normal file → Executable file
0
app/Controllers/DashboardController.php
Normal file → Executable file
0
app/Controllers/DashboardController.php
Normal file → Executable file
0
app/Controllers/EmpDataServiceController.php
Normal file → Executable file
0
app/Controllers/EmpDataServiceController.php
Normal file → Executable file
0
app/Controllers/EmployeeController.php
Normal file → Executable file
0
app/Controllers/EmployeeController.php
Normal file → Executable file
0
app/Controllers/EmployeeRestController.php
Normal file → Executable file
0
app/Controllers/EmployeeRestController.php
Normal file → Executable file
0
app/Controllers/EmployeeServiceController.php
Normal file → Executable file
0
app/Controllers/EmployeeServiceController.php
Normal file → Executable file
0
app/Controllers/Home.php
Normal file → Executable file
0
app/Controllers/Home.php
Normal file → Executable file
0
app/Controllers/JobWorker.php
Normal file → Executable file
0
app/Controllers/JobWorker.php
Normal file → Executable file
0
app/Controllers/Jobs.php
Normal file → Executable file
0
app/Controllers/Jobs.php
Normal file → Executable file
0
app/Controllers/Jobs/AddJob.php
Normal file → Executable file
0
app/Controllers/Jobs/AddJob.php
Normal file → Executable file
0
app/Controllers/Jobs/SubJob.php
Normal file → Executable file
0
app/Controllers/Jobs/SubJob.php
Normal file → Executable file
0
app/Controllers/LoginController.php
Normal file → Executable file
0
app/Controllers/LoginController.php
Normal file → Executable file
0
app/Controllers/MasterController.php
Normal file → Executable file
0
app/Controllers/MasterController.php
Normal file → Executable file
0
app/Controllers/NotificationController.php
Normal file → Executable file
0
app/Controllers/NotificationController.php
Normal file → Executable file
0
app/Controllers/PendingActionsController.php
Normal file → Executable file
0
app/Controllers/PendingActionsController.php
Normal file → Executable file
0
app/Controllers/PublicController.php
Normal file → Executable file
0
app/Controllers/PublicController.php
Normal file → Executable file
0
app/Controllers/RestAuthenticationController.php
Normal file → Executable file
0
app/Controllers/RestAuthenticationController.php
Normal file → Executable file
0
app/Controllers/SwaggerController.php
Normal file → Executable file
0
app/Controllers/SwaggerController.php
Normal file → Executable file
0
app/Controllers/UserController.php
Normal file → Executable file
0
app/Controllers/UserController.php
Normal file → Executable file
0
app/Database/Migrations/.gitkeep
Normal file → Executable file
0
app/Database/Migrations/.gitkeep
Normal file → Executable file
0
app/Database/Seeds/.gitkeep
Normal file → Executable file
0
app/Database/Seeds/.gitkeep
Normal file → Executable file
0
app/Filters/.gitkeep
Normal file → Executable file
0
app/Filters/.gitkeep
Normal file → Executable file
0
app/Filters/AuthJWT.php
Normal file → Executable file
0
app/Filters/AuthJWT.php
Normal file → Executable file
0
app/Filters/AuthMVC.php
Normal file → Executable file
0
app/Filters/AuthMVC.php
Normal file → Executable file
0
app/Filters/CloseDbConnection.php
Normal file → Executable file
0
app/Filters/CloseDbConnection.php
Normal file → Executable file
0
app/Filters/HttpRequestLog.php
Normal file → Executable file
0
app/Filters/HttpRequestLog.php
Normal file → Executable file
0
app/Filters/RoleCheck.php
Normal file → Executable file
0
app/Filters/RoleCheck.php
Normal file → Executable file
0
app/Helpers/.gitkeep
Normal file → Executable file
0
app/Helpers/.gitkeep
Normal file → Executable file
0
app/Helpers/DepositHelper.php
Normal file → Executable file
0
app/Helpers/DepositHelper.php
Normal file → Executable file
0
app/Helpers/HttpRequestHelper.php
Normal file → Executable file
0
app/Helpers/HttpRequestHelper.php
Normal file → Executable file
0
app/Helpers/JWTToken.php
Normal file → Executable file
0
app/Helpers/JWTToken.php
Normal file → Executable file
0
app/Helpers/MailHelper.php
Normal file → Executable file
0
app/Helpers/MailHelper.php
Normal file → Executable file
0
app/Helpers/excel_import_export_helper.php
Normal file → Executable file
0
app/Helpers/excel_import_export_helper.php
Normal file → Executable file
0
app/Helpers/excel_util_helper.php
Normal file → Executable file
0
app/Helpers/excel_util_helper.php
Normal file → Executable file
0
app/Helpers/fileupload_helper.php
Normal file → Executable file
0
app/Helpers/fileupload_helper.php
Normal file → Executable file
0
app/Helpers/header.php
Normal file → Executable file
0
app/Helpers/header.php
Normal file → Executable file
0
app/Helpers/oauth_helper.php
Normal file → Executable file
0
app/Helpers/oauth_helper.php
Normal file → Executable file
0
app/Helpers/sendMailNotification.php
Normal file → Executable file
0
app/Helpers/sendMailNotification.php
Normal file → Executable file
0
app/Helpers/session_helper.php
Normal file → Executable file
0
app/Helpers/session_helper.php
Normal file → Executable file
0
app/Helpers/utility_helper.php
Normal file → Executable file
0
app/Helpers/utility_helper.php
Normal file → Executable file
0
app/Helpers/uuid_helper.php
Normal file → Executable file
0
app/Helpers/uuid_helper.php
Normal file → Executable file
0
app/Language/.gitkeep
Normal file → Executable file
0
app/Language/.gitkeep
Normal file → Executable file
0
app/Language/en/Validation.php
Normal file → Executable file
0
app/Language/en/Validation.php
Normal file → Executable file
0
app/Libraries/.gitkeep
Normal file → Executable file
0
app/Libraries/.gitkeep
Normal file → Executable file
0
app/Libraries/DataServiceSqlite.php
Normal file → Executable file
0
app/Libraries/DataServiceSqlite.php
Normal file → Executable file
0
app/Libraries/GmailAPI.php
Normal file → Executable file
0
app/Libraries/GmailAPI.php
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user