diff --git a/app/Config/Acl.php b/app/Config/Acl.php index c1a1e56a..7721a764 100644 --- a/app/Config/Acl.php +++ b/app/Config/Acl.php @@ -41,6 +41,7 @@ class Acl '#^/sales/dashboard#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, STAFF_ROLE_ID]], '#^/sales#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, STAFF_ROLE_ID]], '#^/expense#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, STAFF_ROLE_ID]], + '#^/sendDataToTPA#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, ACCOUNT_MANAGER_ROLE_ID, MANAGER_ROLE_ID]], diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 9bad6caa..53a2f8cd 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -850,6 +850,7 @@ $routes->get('HealthIndiaGetBenefDetails','HealthIndiaApiController::HealthIndia // API service (Don't delete) $routes->post("ecardRequest", "ApiServiceController::ecardRequest"); $routes->post("getTPAID", "ApiServiceController::getTPAID"); +$routes->post("sendDataToTPA", "ApiServiceController::sendDataToTPA"); $routes->get('fileDownload','MediAssistApiController::fileDownload'); diff --git a/app/Controllers/JobWorker.php b/app/Controllers/JobWorker.php index 6455806a..a8d12fac 100755 --- a/app/Controllers/JobWorker.php +++ b/app/Controllers/JobWorker.php @@ -250,6 +250,10 @@ class JobWorker extends AdminController 'visitOffBoard' => [ 'type' => 'CC', // Handler Category 'handler' => 'App\Controllers\EmployeeController', + ], + 'ICICIPushEmployeeDetails' => [ + 'type' => 'CC', // Handler Category + 'handler' => 'App\Controllers\ICICILombardController', ] ]; diff --git a/app/Controllers/MediAssistApiController.php b/app/Controllers/MediAssistApiController.php index 70a73826..092ec7c2 100644 --- a/app/Controllers/MediAssistApiController.php +++ b/app/Controllers/MediAssistApiController.php @@ -1383,29 +1383,28 @@ class MediAssistApiController extends BaseController $plainJson = json_encode($payload, JSON_UNESCAPED_SLASHES); - // Derive a 32‑byte key (AES‑256) and 16‑byte IV from the provided strings - // $key = substr(hash('sha256', $keyString, true), 0, 32); - // $iv = substr(hash('md5', $ivString, true), 0, 16); - - // Encrypt with AES‑256‑CBC + PKCS7 padding (OpenSSL default) - $cipherTextRaw = openssl_encrypt($plainJson, $cipher_algorithm, $keyString, OPENSSL_RAW_DATA, $ivString); + // ✅ EXACT same as C# + $key = substr(str_pad($keyString, 32, '0'), 0, 32); + $iv = substr(str_pad($ivString, 16, '0'), 0, 16); + // Encrypt + $cipherTextRaw = openssl_encrypt($plainJson, $cipher_algorithm, $key, OPENSSL_RAW_DATA, $iv); if ($cipherTextRaw === false) { - log_message('error', 'MEDI_ASSIST - Wellness SSO URL generation | Encryption failed while generating Medi Assist wellness token.'); - return [ - 'status' => 'failed', - 'message' => 'Encryption failed while generating Medi Assist wellness token.', - ]; + throw new \Exception('Encryption failed.'); } + // ✅ Step 1: Base64 encode + $base64Cipher = base64_encode($cipherTextRaw); - // Base64 encode and URL‑encode for use as EncryptedSSO - $encryptedSSO = urlencode(base64_encode($cipherTextRaw)); - // $encryptedSSO = rtrim(strtr(base64_encode($cipherTextRaw), '+/', '-_'), '='); + // ✅ Step 2: PREFIX IV (CRITICAL — matches C#) + $encryptedSSO = $iv . $base64Cipher; - // Build the final login URL - $loginUrl = str_replace(['{0}', '{1}'], [$planId, $encryptedSSO], $loginUrlTemplate); + // ⚠️ URL encode (VERY IMPORTANT for this format) + $finalSSO = urlencode($encryptedSSO); + + // Build URL + $loginUrl = str_replace(['{0}', '{1}'], [$planId, $finalSSO], $loginUrlTemplate); log_message('error', 'MEDI_ASSIST - Wellness SSO URL generation | Medi Assist wellness SSO URL generated successfully.'); diff --git a/app/Controllers/TestingController.php b/app/Controllers/TestingController.php index 51e71485..094ef653 100644 --- a/app/Controllers/TestingController.php +++ b/app/Controllers/TestingController.php @@ -1429,7 +1429,7 @@ class TestingController extends BaseController ]); } - public function testMediAssistWellness() + public function testMediAssistWellness2() { // Config $keyString = env('MEDIASSIST_WELLNESS_KEY'); @@ -1489,6 +1489,76 @@ class TestingController extends BaseController ], 200); } + public function testMediAssistWellness() + { + try { + // Config + $keyString = env('MEDIASSIST_WELLNESS_KEY'); + $ivString = env('MEDIASSIST_WELLNESS_IV'); + $loginUrlTemplate = env('MEDIASSIST_WELLNESS_LOGIN_URL'); + $partnerCorpId = '15963'; + + $cipher_algorithm = 'AES-256-CBC'; + + // Payload + $payload = [ + 'Id' => '15022', + 'expiryTime' => (string)(time() + 600), + 'CPartnerId' => $partnerCorpId, + ]; + + $plainJson = json_encode($payload, JSON_UNESCAPED_SLASHES); + + // ✅ EXACT same as C# + $key = substr(str_pad($keyString, 32, '0'), 0, 32); + $iv = substr(str_pad($ivString, 16, '0'), 0, 16); + + // Encrypt + $cipherTextRaw = openssl_encrypt($plainJson,$cipher_algorithm,$key,OPENSSL_RAW_DATA,$iv); + + if ($cipherTextRaw === false) { + throw new \Exception('Encryption failed.'); + } + + // ✅ Step 1: Base64 encode + $base64Cipher = base64_encode($cipherTextRaw); + + // ✅ Step 2: PREFIX IV (CRITICAL — matches C#) + $encryptedSSO = $iv . $base64Cipher; + + // ⚠️ URL encode (VERY IMPORTANT for this format) + $finalSSO = urlencode($encryptedSSO); + + // Build URL + $loginUrl = str_replace( + ['{0}', '{1}'], + [$partnerCorpId, $finalSSO], + $loginUrlTemplate + ); + + return $this->respond([ + 'status' => true, + 'data' => [ + 'loginUrl' => $loginUrl, + 'encryptedSSO' => $encryptedSSO, + 'base64Only' => $base64Cipher, + 'ivUsed' => $iv, + 'plainPayload' => $payload, + ], + ], 200); + + } catch (\Throwable $e) { + + log_message('error', 'MediAssist SSO Error: ' . $e->getMessage()); + + return $this->respond([ + 'status' => false, + 'message' => $e->getMessage(), + ], 500); + } + } + + public function decryptMediAssistWellness($encryptedSSO) { // Config diff --git a/app/Controllers/VidalApiController.php b/app/Controllers/VidalApiController.php index c689b5df..704dd8d5 100644 --- a/app/Controllers/VidalApiController.php +++ b/app/Controllers/VidalApiController.php @@ -506,6 +506,7 @@ class VidalApiController extends BaseController $tpa_claim_no = $claimData['claimNumber'] ?? ''; $currentStatus = $claimData['status'] ?? ''; $tpa_claim_type = $claimData['claimType'] ?? ''; + $tpa_shortfall_no = $claimData['shortfallNo'] ?? ''; $doa = !empty($claimData['doa'] ?? null) ? date('Y-m-d', strtotime(str_replace('/', '-', $claimData['doa']))) : null; @@ -532,6 +533,9 @@ class VidalApiController extends BaseController if (!empty($tpa_claim_type)) { $updateArray['tpa_claim_type'] = $tpa_claim_type; } + if (!empty($tpa_shortfall_no)) { + $updateArray['tpa_shortfall_no'] = $tpa_shortfall_no; + } if($ticket['doa'] == $doa || $ticket['claim_number'] == $tpa_claim_no){ // UPDATE ticket_master @@ -1078,6 +1082,7 @@ class VidalApiController extends BaseController tm.tpa_no as memberId, tm.tpa_claim_push_reference_no as claimInwardNO, tm.tpa_claim_id as claimNO, + tm.tpa_shortfall_no as shortfallNO, cp.policy_no as policyNo, cp.policy_start_date as startDate, cp.policy_end_date as endDate, @@ -1150,7 +1155,7 @@ class VidalApiController extends BaseController // 4. PREPARE REQUEST BODY $body = [ - "shortFallNo" => $ticket['claimNO'], // or actual shortfall number if different (GUR-0326-CL-0001471) + "shortFallNo" => $ticket['shortfallNO'], ]; // If single file → fileId diff --git a/app/Views/client_policy.php b/app/Views/client_policy.php index 6fd70d39..e8720c97 100755 --- a/app/Views/client_policy.php +++ b/app/Views/client_policy.php @@ -2047,7 +2047,7 @@ input:checked + .slider_blue::before { } //append the CD Account number for the dropdown - function appendCDACNO(data, select = null) { + function appendCDACNOOld(data, select = null) { //console.log('appendCDACNO', data); //console.log('appendCDACNO', select); @@ -2084,6 +2084,30 @@ input:checked + .slider_blue::before { $('#cd_ac_no').val(select).trigger('change'); } } + + function appendCDACNO(data, select = null) { + const $dropdown = $('#cd_ac_no'); + + // 1. Build everything as a single string/fragment instead of multiple appends + let optionsHtml = ''; + + if (!data || data.length === 0) { + optionsHtml += ''; + } else { + // 2. Faster Loop and String Concatenation + $.each(data, function(index, item) { + optionsHtml += ``; + }); + } + + // 3. Single DOM update (Idhu dhaan performance-ah boost pannum) + $dropdown.html(optionsHtml); + + // 4. Handle Selection + if (select) { + $dropdown.val(select).trigger('change'); + } + } // append Base Policy to the dropdown for edit only function appendBasePolicyList(data, select = null)