feat(insurance): add insurance coverage flag to selected services and update coverage logic
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Insurance\Service;
|
||||
|
||||
use App\ClinicService\Repository\ServiceItemRepository;
|
||||
use App\Insurance\Entity\TenantInsurance;
|
||||
use App\Insurance\Repository\InsuranceRepository;
|
||||
use App\Insurance\Repository\TenantInsuranceRepository;
|
||||
@@ -16,6 +17,7 @@ class TenantInsuranceService
|
||||
private readonly TenantInsuranceRepository $repo,
|
||||
private readonly InsuranceRepository $insuranceRepo,
|
||||
private readonly TenantServiceCoverageRepository $coverageRepo,
|
||||
private readonly ServiceItemRepository $serviceItemRepo,
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -101,6 +103,12 @@ class TenantInsuranceService
|
||||
return CoverageRule::notCovered();
|
||||
}
|
||||
|
||||
// پرچم سرویس gate نهایی است: اگر «این خدمت شامل بیمه میشود» غیرفعال باشد، هیچ پوششی محاسبه نمیشود.
|
||||
$service = $this->serviceItemRepo->find($serviceItemId);
|
||||
if ($service === null || !$service->isInsuranceCovered()) {
|
||||
return CoverageRule::notCovered();
|
||||
}
|
||||
|
||||
$contract = $this->repo->findActiveContract($entityType, $entityId, $insuranceId);
|
||||
if ($contract === null) {
|
||||
return CoverageRule::notCovered();
|
||||
|
||||
Reference in New Issue
Block a user