FEAT_FEAT_TPA

This commit is contained in:
VENKATESHWARAN 2025-11-05 12:47:26 +05:30
parent 29c642a048
commit 576344edb0
3 changed files with 126 additions and 22 deletions

View File

@ -402,6 +402,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
$routes->match(['get', 'post', 'delete'], 'rtoMaster', 'MasterController::rtoMaster');
$routes->get('checkDuplicateCdAccount', 'MasterController::checkDuplicateCdAccount');
$routes->get('proceedExcelFileDataValidation', 'EmployeeController::proceedExcelFileDataValidation');
$routes->get('checkTpaApiEnable', 'EmployeeRestController::checkTpaApiEnable');
});
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");

View File

@ -54,6 +54,7 @@ use Illuminate\Http\Request;
use App\Controllers\EmployeeServiceController;
use App\Models\ClaimFilesModel;
use App\Models\TicketMailTemplateModel;
use App\Models\TpaApiSeviceModel;
use Composer\Pcre\Preg;
use Kreait\Firebase\Factory;
use Kreait\Firebase\Messaging\CloudMessage;
@ -2189,7 +2190,7 @@ class EmployeeRestController extends AdminController
// print_r($params);die;
$wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
$mail_send_return = MailHelper::send_email($wholeData[0]);
$this->myLogger->logme("info", $mail_send_return);
$this->myLogger->logme("error", $mail_send_return);
if (isset($wholeData[0])) {
@ -2200,7 +2201,7 @@ class EmployeeRestController extends AdminController
{
foreach ($account_manager_wholeData as $key => $value) {
$mail_send_return1 = MailHelper::send_email($value);
$this->myLogger->logme("info", $mail_send_return1);
$this->myLogger->logme("error", $mail_send_return1);
}
}else{
$this->myLogger->logme("error", 'Account Manager Mail Configuration not Enable for this client');
@ -2213,7 +2214,7 @@ class EmployeeRestController extends AdminController
{
foreach ($client_hr_wholeData as $key => $value) {
$mail_send_return2 = MailHelper::send_email($value);
$this->myLogger->logme("info", $mail_send_return2);
$this->myLogger->logme("error", $mail_send_return2);
}
}else{
$this->myLogger->logme("error", 'Client HR Mail Configuration not Enable for this client');
@ -3720,7 +3721,7 @@ class EmployeeRestController extends AdminController
])->setStatusCode(404);
}
$this->myLogger->logme('info', "Policy type IDs fetched: " . json_encode($policy_type_ids));
$this->myLogger->logme('error', "Policy type IDs fetched: " . json_encode($policy_type_ids));
$ticket_type = $this->ticketController->ticketType;
$filtered = [];
@ -3748,9 +3749,9 @@ class EmployeeRestController extends AdminController
'name' => $mappedName
];
$this->myLogger->logme('info', "Ticket type resolved: ID={$ticketTypeId}, Name={$mappedName}");
$this->myLogger->logme('error', "Ticket type resolved: ID={$ticketTypeId}, Name={$mappedName}");
} else {
$this->myLogger->logme('warning', "No valid ticket type mapping for policy_type_id={$ticketTypeId}");
$this->myLogger->logme('error', "No valid ticket type mapping for policy_type_id={$ticketTypeId}");
}
}
@ -4462,22 +4463,105 @@ class EmployeeRestController extends AdminController
return $this->failServerError($e->getMessage());
}
}
public function hrFileUploadMasters()
{
try {
//for inception upload
$data['actions'] = ['addition' => 'Addition (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
return $this->respond([
'status' => true,
'message' => 'File inception upload masters',
'data' => $data
]);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
public function checkTpaApiEnable($policy_id = null, $api_name = null, $return_type = 'api')
{
$this->myLogger->logme('error', '--- START checkTpaApiEnable ---');
try {
// Step 1: Handle input parameters
if (empty($policy_id)) {
$policy_id = $this->request->getGet('policy_id');
$api_name = $this->request->getGet('api_name');
log_message('error', "Input parameters fetched from GET: policy_id={$policy_id}, api_name={$api_name}");
} else {
log_message('error', "Input parameters received directly: policy_id={$policy_id}, api_name={$api_name}");
}
// Step 2: Validate policy_id
if (empty($policy_id)) {
log_message('error', 'Policy ID is empty');
if ($return_type == 'api') {
return $this->respond(['status' => false, 'code' => 200, 'message' => 'Policy ID missing']);
}
return false;
}
// Step 3: Fetch policy data
log_message('error', "Fetching policy data for policy_id={$policy_id}");
$policy_data = $this->clientPolicyModel
->where('is_active', 1)
->where('id', $policy_id)
->first();
if (empty($policy_data)) {
log_message('error', "Policy data not found for policy_id={$policy_id}");
if ($return_type == 'api') {
return $this->respond(['status' => false, 'code' => 200, 'message' => 'Policy data not found']);
}
return false;
}
// Step 4: Check for TPA ID
if (empty($policy_data['tpa_id'])) {
log_message('error', "TPA ID not found for policy_id={$policy_id}");
if ($return_type == 'api') {
return $this->respond(['status' => false, 'code' => 200, 'message' => 'TPA ID not found']);
}
return false;
}
$tpa_id = $policy_data['tpa_id'];
log_message('error', "Found TPA ID={$tpa_id} for policy_id={$policy_id}");
// Step 5: Check if API service is enabled
log_message('error', "Checking TPA API service for TPA ID={$tpa_id} and API name={$api_name}");
$tpaApiServiceModel = new TpaApiSeviceModel();
$api_data = $tpaApiServiceModel
->where('is_active', 1)
->where('api_name', $api_name)
->where('tpa_id', $tpa_id)
->first();
if (!empty($api_data)) {
log_message('error', "API '{$api_name}' is enabled for TPA ID={$tpa_id}");
if ($return_type == 'api') {
return $this->respond(['status' => true, 'code' => 200, 'message' => 'API services enabled']);
}
return true;
} else {
log_message('error', "API '{$api_name}' is NOT enabled for TPA ID={$tpa_id}");
if ($return_type == 'api') {
return $this->respond(['status' => false, 'code' => 200, 'message' => 'API services not enabled']);
}
return false;
}
} catch (\Throwable $th) {
log_message('error', 'Exception in checkTpaApiEnable: ' . $th->getMessage());
if ($return_type == 'api') {
return $this->respond(['status' => false, 'code' => 500, 'message' => 'Internal Server Error']);
}
return false;
} finally {
log_message('error', '--- END checkTpaApiEnable ---');
}
}
public function hrFileUploadMasters()
{
try {
//for inception upload
$data['actions'] = ['addition' => 'Addition (Employee + Dependents)', 'missed_inception' => 'Missed Inception (Employee + Dependents)', 'dependent_addition' => 'Dependent Addition (Only Dependents)', 'deletion' => 'Deletion', 'correction' => 'Correction', 'si_enhancement' => 'SI Enhancement'];
return $this->respond([
'status' => true,
'message' => 'File inception upload masters',
'data' => $data
]);
} catch (\Exception $e) {
return $this->failServerError($e->getMessage());
}
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class TpaApiSeviceModel extends Model
{
protected $table = 'tpa_api_services';
protected $primaryKey = 'id';
protected $protectFields = true;
protected $allowedFields = [
'id',
'tpa_id',
'api_name',
'description',
'is_active',
];
}