Update response palyoad while fetch insurance networks
This commit is contained in:
parent
8efab64fd0
commit
c4b833a59f
|
@ -61,7 +61,7 @@ class InsuranceController extends Controller
|
|||
* name="user_id",
|
||||
* description="ID de l'utilisateur",
|
||||
* in="query",
|
||||
* required=true,
|
||||
* required=false,
|
||||
* @OA\Schema(
|
||||
* type="integer",
|
||||
* )
|
||||
|
@ -96,18 +96,38 @@ class InsuranceController extends Controller
|
|||
} else {
|
||||
$country = CountriesCurrency::findOrFail($request->input('country_id'));
|
||||
|
||||
$insurances = DB::select("SELECT n.id , n.name , nhc.age_limit_of_insured_and_spouse, nhc.age_limit_of_child_beneficiary, nhc.max_number_of_beneficiaries, nhc.id as nhc_id
|
||||
$insurances = DB::select("SELECT n.id , n.name , nhc.age_limit_of_insured_and_spouse, nhc.age_limit_of_child_beneficiary, nhc.max_number_of_beneficiaries, nhc.family_coverage_sharing, nhc.id as nhc_id
|
||||
FROM networks n JOIN configWallet cw ON cw.id_network = n.id JOIN nh_networks_configs nhc
|
||||
ON nhc.network_id = n.id WHERE n.country_id = :countryId AND cw.type = 'ilink_sante' AND n.status = 1", ['countryId' => $request->input('country_id')]);
|
||||
|
||||
foreach ($insurances as $insurance) {
|
||||
$months_prices = DB::select("SELECT id, number_of_months , min_amount FROM nh_months_prices_grid WHERE nh_network_config_id = :nhc_id",
|
||||
$months_prices = DB::select("SELECT number_of_months , min_amount , max_insurance_coverage_amount, waiting_period_days, payment_period , number_of_fractions FROM nh_months_prices_grid WHERE nh_network_config_id = :nhc_id",
|
||||
['nhc_id' => $insurance->nhc_id]);
|
||||
|
||||
$years_prices = DB::select("SELECT min_age , max_age , markup_percentage FROM nh_years_prices_grid WHERE nh_network_config_id = :nhc_id",
|
||||
['nhc_id' => $insurance->nhc_id]);
|
||||
|
||||
foreach ($months_prices as $mp) {
|
||||
foreach ($years_prices as $cp) {
|
||||
$cp->amount = $this->toMoneyWithCurrencyCode(round((100 + $cp->markup_percentage) * $mp->min_amount / 100), $country->currency_code ?? 'XAF');
|
||||
}
|
||||
|
||||
$mp->min_amount = $this->toMoneyWithCurrencyCode($mp->min_amount, $country->currency_code ?? 'XAF');
|
||||
$mp->max_insurance_coverage_amount = $this->toMoneyWithCurrencyCode($mp->max_insurance_coverage_amount, $country->currency_code ?? 'XAF');
|
||||
$mp->payment_period = trans('states.' . $mp->payment_period);
|
||||
|
||||
|
||||
$mp->child_prices = $years_prices;
|
||||
}
|
||||
|
||||
foreach ($months_prices as $mp) {
|
||||
foreach ($mp->child_prices as $cp) {
|
||||
unset($cp->markup_percentage);
|
||||
}
|
||||
}
|
||||
|
||||
$insurance->months_prices = $months_prices;
|
||||
|
||||
unset($insurance->nhc_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,6 @@ return [
|
|||
"PARTIALLY_PAID" => "PARTIELLEMENT PAYÉE",
|
||||
"SUSPENDED" => "SUSPENDUE",
|
||||
"ONE_TIME" => "UNE SEULE FOIS",
|
||||
"DAILY" => "JOURNELLEMENT",
|
||||
"MONTHLY" => "MENSUELLEMENT"
|
||||
"DAILY" => "JOURNALIER",
|
||||
"MONTHLY" => "MENSUEL"
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue