feat(claims): enrich claims with insurance details and item specifics

This commit is contained in:
hamed
2026-06-24 04:48:11 +03:30
parent 27840da78d
commit c189daa860
8 changed files with 188 additions and 11 deletions
+3 -2
View File
@@ -52,14 +52,15 @@ class InvoiceService
// خدمات
foreach ($session->getServices() as $sessionService) {
$item = $sessionService->getServiceItem();
$qty = max(1, $sessionService->getQuantity());
$unitPrice = $this->tariffService->resolvePrice($item);
$total = new Money($unitPrice);
$total = new Money($unitPrice * $qty);
$baseRule = $this->tenantInsuranceService->coverageRuleForService($entityType, $entityId, $baseId, $item->getId());
$suppRule = $this->tenantInsuranceService->coverageRuleForService($entityType, $entityId, $suppId, $item->getId());
$breakdown = $this->calculator->calculateItem($total, $baseRule, $suppRule);
$invoice->addItem(new InvoiceItem($invoice, $item->getName(), $unitPrice, 1, $breakdown, $item->getId()));
$invoice->addItem(new InvoiceItem($invoice, $item->getName(), $unitPrice, $qty, $breakdown, $item->getId()));
}
$invoice->recalculateTotals();