FEAT_FEAT_TPA
This commit is contained in:
parent
29c642a048
commit
576344edb0
@ -402,6 +402,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
$routes->match(['get', 'post', 'delete'], 'rtoMaster', 'MasterController::rtoMaster');
|
$routes->match(['get', 'post', 'delete'], 'rtoMaster', 'MasterController::rtoMaster');
|
||||||
$routes->get('checkDuplicateCdAccount', 'MasterController::checkDuplicateCdAccount');
|
$routes->get('checkDuplicateCdAccount', 'MasterController::checkDuplicateCdAccount');
|
||||||
$routes->get('proceedExcelFileDataValidation', 'EmployeeController::proceedExcelFileDataValidation');
|
$routes->get('proceedExcelFileDataValidation', 'EmployeeController::proceedExcelFileDataValidation');
|
||||||
|
$routes->get('checkTpaApiEnable', 'EmployeeRestController::checkTpaApiEnable');
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
||||||
|
|||||||
@ -54,6 +54,7 @@ use Illuminate\Http\Request;
|
|||||||
use App\Controllers\EmployeeServiceController;
|
use App\Controllers\EmployeeServiceController;
|
||||||
use App\Models\ClaimFilesModel;
|
use App\Models\ClaimFilesModel;
|
||||||
use App\Models\TicketMailTemplateModel;
|
use App\Models\TicketMailTemplateModel;
|
||||||
|
use App\Models\TpaApiSeviceModel;
|
||||||
use Composer\Pcre\Preg;
|
use Composer\Pcre\Preg;
|
||||||
use Kreait\Firebase\Factory;
|
use Kreait\Firebase\Factory;
|
||||||
use Kreait\Firebase\Messaging\CloudMessage;
|
use Kreait\Firebase\Messaging\CloudMessage;
|
||||||
@ -2189,7 +2190,7 @@ class EmployeeRestController extends AdminController
|
|||||||
// print_r($params);die;
|
// print_r($params);die;
|
||||||
$wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
|
$wholeData =sendMailNotification::sendMailNotification('member_review_and_summary_mail', $params);
|
||||||
$mail_send_return = MailHelper::send_email($wholeData[0]);
|
$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])) {
|
if (isset($wholeData[0])) {
|
||||||
|
|
||||||
@ -2200,7 +2201,7 @@ class EmployeeRestController extends AdminController
|
|||||||
{
|
{
|
||||||
foreach ($account_manager_wholeData as $key => $value) {
|
foreach ($account_manager_wholeData as $key => $value) {
|
||||||
$mail_send_return1 = MailHelper::send_email($value);
|
$mail_send_return1 = MailHelper::send_email($value);
|
||||||
$this->myLogger->logme("info", $mail_send_return1);
|
$this->myLogger->logme("error", $mail_send_return1);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->myLogger->logme("error", 'Account Manager Mail Configuration not Enable for this client');
|
$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) {
|
foreach ($client_hr_wholeData as $key => $value) {
|
||||||
$mail_send_return2 = MailHelper::send_email($value);
|
$mail_send_return2 = MailHelper::send_email($value);
|
||||||
$this->myLogger->logme("info", $mail_send_return2);
|
$this->myLogger->logme("error", $mail_send_return2);
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$this->myLogger->logme("error", 'Client HR Mail Configuration not Enable for this client');
|
$this->myLogger->logme("error", 'Client HR Mail Configuration not Enable for this client');
|
||||||
@ -3720,7 +3721,7 @@ class EmployeeRestController extends AdminController
|
|||||||
])->setStatusCode(404);
|
])->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;
|
$ticket_type = $this->ticketController->ticketType;
|
||||||
$filtered = [];
|
$filtered = [];
|
||||||
@ -3748,9 +3749,9 @@ class EmployeeRestController extends AdminController
|
|||||||
'name' => $mappedName
|
'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 {
|
} 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}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4463,7 +4464,6 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function hrFileUploadMasters()
|
public function hrFileUploadMasters()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
@ -4480,4 +4480,88 @@ class EmployeeRestController extends AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 ---');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
19
app/Models/TpaApiSeviceModel.php
Normal file
19
app/Models/TpaApiSeviceModel.php
Normal 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',
|
||||||
|
];
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user