diff --git a/app/Controllers/JobWorker.php b/app/Controllers/JobWorker.php index b401fe8b..f6d9f2eb 100755 --- a/app/Controllers/JobWorker.php +++ b/app/Controllers/JobWorker.php @@ -191,6 +191,10 @@ class JobWorker extends AdminController 'type' => 'CC', // Handler Category 'handler' => 'App\Controllers\VidalApiController', ], + 'VidalGetBenefDetailsV2' => [ + 'type' => 'CC', // Handler Category + 'handler' => 'App\Controllers\VidalApiController', + ], 'saveVidalAPIData' => [ 'type' => 'CC', // Handler Category 'handler' => 'App\Controllers\VidalApiController', diff --git a/app/Controllers/TestingController.php b/app/Controllers/TestingController.php index 9bef4a08..eecbfb45 100644 --- a/app/Controllers/TestingController.php +++ b/app/Controllers/TestingController.php @@ -1410,7 +1410,7 @@ class TestingController extends BaseController ], 200); } - /** + /** * Test Wellness SSO token generation for Medi Assist (MediBuddy). * * This uses the token-based authentication details shared by Medi Assist: @@ -1719,36 +1719,18 @@ class TestingController extends BaseController { helper('api'); - $url = 'https://devapigw.vidalhealthtpa.com/partner-integration/enrollment/enrollment-info'; + $url = 'https://devapigw.vidalhealthtpa.com/partner-integration/enrollment/info'; $subscriptionKey = getenv('VIDAL_API_SUBSCRIPTION_KEY'); if (empty($subscriptionKey)) { return $this->response->setStatusCode(500)->setJSON([ - 'error' => 'Missing VIDAL_SUBSCRIPTION_KEY/VIDAL_API_SUBSCRIPTION_KEY in env', + 'error' => 'Missing VIDAL_API_SUBSCRIPTION_KEY in env', ]); } - // Allow overriding payload via query/post/json; fall back to existing defaults. - $jsonPayload = $this->request->getJSON(true); - - $policyNo = (string) ( - ($this->request->getGet('policyNo') ?? '') - ?: ($this->request->getPost('policyNo') ?? '') - ?: ($jsonPayload['policyNo'] ?? '') - ?: '000/VZXSY' - ); - - $startIndex = (int) ( - ($this->request->getGet('startIndex') ?? null) - ?? ($this->request->getPost('startIndex') ?? null) - ?? ($jsonPayload['startIndex'] ?? 1) - ); - - $endIndex = (int) ( - ($this->request->getGet('endIndex') ?? null) - ?? ($this->request->getPost('endIndex') ?? null) - ?? ($jsonPayload['endIndex'] ?? 5) - ); + $policyNo = '000/VZXSY'; + $startIndex = 1; + $endIndex = 5; $body = [ 'policyNo' => $policyNo, @@ -1758,12 +1740,12 @@ class TestingController extends BaseController $headers = [ 'Content-Type: application/json', - 'Ocp-Apim-Subscription-Key: ' . $subscriptionKey, + 'ocp-apim-subscription-key: ' . $subscriptionKey, ]; $method = "POST"; - $rawResponse = call_third_party_api($url, $method, $headers, json_encode($body)); + $rawResponse = call_third_party_api($url, $method, $headers, $body); return $this->response->setStatusCode(200)->setJSON([ 'request' => [ diff --git a/app/Controllers/TicketController.php b/app/Controllers/TicketController.php index 49d4e615..b22e604c 100644 --- a/app/Controllers/TicketController.php +++ b/app/Controllers/TicketController.php @@ -3223,6 +3223,42 @@ class TicketController extends BaseController return $date && $date->format($format) === $value; } + /** + * Claim upload URL row: allow http(s) with path, query, port; bare host with TLD; localhost; IPv4/IPv6. + * Replaces the old strict regex that rejected ?query= and long TLDs. + */ + private function isClaimUploadUrl(string $s): bool + { + $v = trim($s); + if ($v === '' || strlen($v) > 2048) { + return false; + } + if (! preg_match('#^https?://#i', $v)) { + $v = 'https://' . $v; + } + $parts = parse_url($v); + if ($parts === false || empty($parts['host'])) { + return false; + } + $scheme = strtolower($parts['scheme'] ?? ''); + if ($scheme !== 'http' && $scheme !== 'https') { + return false; + } + $host = strtolower($parts['host']); + if ($host === 'localhost') { + return true; + } + $hostForIp = $host; + if (strlen($host) > 2 && $host[0] === '[' && substr($host, -1) === ']') { + $hostForIp = substr($host, 1, -1); + } + if (filter_var($hostForIp, FILTER_VALIDATE_IP)) { + return true; + } + + return strpos($host, '.') !== false; + } + public function upload_url() { @@ -3249,10 +3285,9 @@ class TicketController extends BaseController ], 'url.*' => [ 'label' => 'URL', - 'rules' => 'if_exist|required|regex_match[/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/]', + 'rules' => 'if_exist|required', 'errors' => [ - 'required' => 'URL is required.', - 'regex_match' => 'The URL format is invalid. Example: www.google.com or https://google.com' + 'required' => 'URL is required.', ] ], ]; @@ -3266,6 +3301,22 @@ class TicketController extends BaseController ]); } + if (! empty($data['url']) && is_array($data['url'])) { + foreach ($data['url'] as $idx => $singleUrl) { + $singleUrl = (string) $singleUrl; + if (trim($singleUrl) !== '' && ! $this->isClaimUploadUrl($singleUrl)) { + return $this->response->setStatusCode(400)->setJSON([ + 'status' => false, + 'message' => 'Input validation failed', + 'code' => 400, + 'errors' => [ + 'url.' . $idx => 'The URL format is invalid. Use https://example.com/path?x=1 or example.com', + ], + ]); + } + } + } + $get_file_data = $this->request->getFiles('file_upload') ?? []; $ticket_id = $data['ticket_id_url']; @@ -3840,7 +3891,7 @@ class TicketController extends BaseController ]); } - // YOUR REQUIRED REGEX RULE + // Same charset as claim upload `docs_name.*` / client `ticketdocname` if (!preg_match('/^[a-zA-Z0-9_\- ]+$/', $doc['document_name'])) { return $this->response->setStatusCode(400)->setJSON([ 'status' => false, @@ -3848,7 +3899,7 @@ class TicketController extends BaseController 'message' => 'Input validation failed', 'errors' => [ 'required_docs' => - "Document name '{$doc['document_name']}' can only contain letters, numbers, hyphens and underscores" + "Document Name can only contain letters, numbers, hyphens, and underscores (row " . ($index + 1) . ")" ] ]); } diff --git a/app/Controllers/VoloApiController.php b/app/Controllers/VoloApiController.php index 16d5f65b..79320a2b 100644 --- a/app/Controllers/VoloApiController.php +++ b/app/Controllers/VoloApiController.php @@ -533,6 +533,12 @@ class VoloApiController extends BaseController $dobYmd = $this->normalizeVoloDobToYmd($dobRaw); } + $dojRaw = $row['DOJ'] ?? $row['doj'] ?? null; + $dojYmd = null; + if ($dojRaw !== null && $dojRaw !== '') { + $dojYmd = $this->normalizeVoloDobToYmd($dojRaw); + } + $rel = trim((string) ($row['relation'] ?? '')); $mappedRows[] = [ 'file_id' => $file_id, @@ -544,6 +550,8 @@ class VoloApiController extends BaseController 'self' => in_array(strtoupper($rel), ['EMPLOYEE', 'SELF'], true) ? 1 : 0, 'tpa_id' => trim((string) ($row['memberId'] ?? '')), 'age' => isset($row['age']) && is_numeric($row['age']) ? (int) $row['age'] : null, + 'si' => $row['sumInsured'] ?? null, + 'doj' => $dojYmd, 'is_active' => 1, 'created_by' => $file_info[0]['created_by'] ?? null, ]; diff --git a/app/Models/EmployeePolicyModel.php b/app/Models/EmployeePolicyModel.php index 70e71f6f..dac8f8d6 100755 --- a/app/Models/EmployeePolicyModel.php +++ b/app/Models/EmployeePolicyModel.php @@ -572,8 +572,12 @@ class EmployeePolicyModel extends Model employee_polices.tpa_id, employees.relationship_code as emp_relationship_code, employees.relationship as emp_relationship, + employees.email_corporate as emp_email_c, 'C' as event_type_data, + employee_polices.date_coverage, + employee_polices.basic_cover_si, + CASE WHEN emp_endorsement.field_name = 'dob' THEN DATE_FORMAT(emp_endorsement.old_value, '%d-%b-%Y') @@ -705,6 +709,7 @@ class EmployeePolicyModel extends Model employee_polices.premium AS old_si_premium, employee_polices.rata_premimum AS old_rata_premium, employee_polices.age_band, + employee_polices.date_coverage, sidata.new_basic_cover_si, sidata.new_si_premium, sidata.old_si_premium, diff --git a/app/Views/claim_files_upload.php b/app/Views/claim_files_upload.php index 9132e7e5..4a86c1bd 100644 --- a/app/Views/claim_files_upload.php +++ b/app/Views/claim_files_upload.php @@ -27,9 +27,11 @@ - +