feat: add multi-city representation support and domain context resolution

- Created migration to add representation_cities table and domain, is_global fields to representations.
- Implemented SiteContextController to resolve domain to site context (city | representation | unknown).
- Developed DomainContext and DomainContextResolver services for domain mapping.
- Added tests for DomainContextResolver and commission logic based on domain ownership.
This commit is contained in:
hamed
2026-07-09 07:26:58 +03:30
parent 59559e2e31
commit 0750bc9812
56 changed files with 4297 additions and 1600 deletions
+8 -3
View File
@@ -52,12 +52,17 @@ class CommissionService
);
}
/** پورسانت ارتقاء اشتراک: درصد سراسری = upgrade_commission_percent. */
public function processSubscription(Payment $payment, ?int $representationId, ?int $doctorId, ?int $clinicId): void
/**
* پورسانت ارتقاء اشتراک: درصد سراسری = upgrade_commission_percent.
* گاردِ دامنه (مثل نوبت): مالک پزشک/کلینیک و نماینده‌ی دامنه‌ی خرید باید یکی باشند.
*/
public function processSubscription(Payment $payment, ?int $ownerRepId, ?int $bookingRepId, ?int $doctorId, ?int $clinicId): void
{
if ($this->configRepo->get('upgrade_commission_enabled') !== '1') return;
$rep = $this->resolveRep($representationId);
if ($ownerRepId === null || $bookingRepId === null || $ownerRepId !== $bookingRepId) return;
$rep = $this->resolveRep($ownerRepId);
if ($rep === null) return;
$this->settle(