Merge branch 'main' of bitbucket.org:jubilian/nhance_partner_be

This commit is contained in:
Gowtham M 2025-12-17 14:53:06 +05:30
commit 6253e420a0

View File

@ -538,14 +538,24 @@ class PolicyController extends ResourceController
$data = $readDoc['data'];
$vehicleType = $data['vehicle']['vehicle_type'] ?? null;
$fuelType = $data['vehicle']['fuel_type'] ?? null;
if($vehicleType !== null)
{
$vehicleType = $this->resolveVehicleTypeTier1($vehicleType);
$vehicleType = $this->postProcessGeminiData($vehicleType,$this->tier1VehicleTypeMap);
}
else
{
$vehicleType = 'UN_IDEN_DOC';
}
if($fuelType !== null)
{
$fuelType = $this->postProcessGeminiData($fuelType,$this->fuelType);
}
else
{
$fuelType = 'UN_IDEN_DOC';
}
//update data in to policy table
$policyData['policy_number'] = $data['policy']['policy_number'] ?? null;
$policyData['issued_date'] = $data['policy']['issue_date'] ?? null;
@ -562,7 +572,7 @@ class PolicyController extends ResourceController
$policyData['rto_state_code'] = $data['vehicle']['rto_state_code'] ?? null;
$policyData['rto_city_code'] = $data['vehicle']['rto_city_code'] ?? null;
$policyData['weight'] = $data['vehicle']['weight'] ?? null;
$policyData['fuel_type'] = $data['vehicle']['fuel_type'] ?? null;
$policyData['fuel_type'] = $fuelType;
$policyData['date_of_registration'] = $data['vehicle']['date_of_registration'] ?? null;
$policyData['year_of_manufacture'] = $data['vehicle']['year_of_manufacture'] ?? null;
$policyData['engine_no'] = $data['vehicle']['engine_no'] ?? null;
@ -1022,13 +1032,13 @@ class PolicyController extends ResourceController
}
}
public function resolveVehicleTypeTier1(string $incoming)
public function postProcessGeminiData(string $incoming, array $masterArray): string
{
$value = strtolower(trim($incoming));
$value = preg_replace('/\s+/', ' ', $value); // normalize spaces
return $this->phraseMap[$value] ?? 'UN_IDEN_TYPE';
return $masterArray[$value] ?? 'UN_IDEN_TYPE';
}
public function calculateCommissionRequest()