refactor(pricing): make the service the only price source
Price lists, annual tariffs and per-branch price overrides each answered
"what does this service cost?" differently, so a single date could carry
several answers and nobody could say which one was right. Price now lives
only on ServiceItem.price_rials, edited from the services page.
- drop PriceList/PriceListItem, their repositories and the seven
/api/v1/price-list(s) endpoints; PricingController keeps only quote and
the appointment price snapshot
- drop Tariff, TariffRepository, TariffService and the two
/service-items/{uuid}/tariffs endpoints; creating or repricing a service
no longer upserts a current-year tariff
- drop price_rials from ServiceBranchOverride; the entity stays for its
duration columns, which DurationCalculator and ServiceSelectionValidator
still read
- InvoiceService reads the item price directly
- PricingEngine collapses to a single source; breakdown.sources always
reports service_item, keeping the response contract intact
- remove the price-lists admin page, its route and settings-menu entry, the
tariff modal and the service detail tariffs tab; useAppointmentInvoice
moves to its own hook file
Migration drops price_lists, price_list_items, service_tariffs and the
override price column.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -255,7 +255,8 @@ class ServiceSelectionTest extends ApiTestCase
|
||||
self::assertStringContainsString('حلقه', $body['errors'][0]['message']);
|
||||
}
|
||||
|
||||
public function testBranchOverrideChangesPriceAndDuration(): void
|
||||
/** شعبه فقط مدت را عوض میکند؛ قیمت همیشه از خودِ سرویس است. */
|
||||
public function testBranchOverrideChangesDurationButNotPrice(): void
|
||||
{
|
||||
[$user, , $section, $address] = $this->clinicWithSection();
|
||||
$face = $this->item($section, 'صورت', 15, 8, 500_000);
|
||||
@@ -263,7 +264,6 @@ class ServiceSelectionTest extends ApiTestCase
|
||||
$this->authJson('PUT', "/api/v1/service-item/{$face->getUuid()}/branch-overrides", $user, [
|
||||
'overrides' => [[
|
||||
'address_uuid' => $address->getUuid(),
|
||||
'price_rials' => 900_000,
|
||||
'solo_duration_minutes' => 25,
|
||||
]],
|
||||
]);
|
||||
@@ -274,7 +274,7 @@ class ServiceSelectionTest extends ApiTestCase
|
||||
self::assertSame(15, $plain['data']['total_duration_minutes']);
|
||||
|
||||
$atBranch = $this->validate($user, [$face->getUuid()], ['branch_uuid' => $address->getUuid()]);
|
||||
self::assertSame(900_000, $atBranch['data']['total_price_rials']);
|
||||
self::assertSame(500_000, $atBranch['data']['total_price_rials'], 'قیمت شعبهای وجود ندارد');
|
||||
self::assertSame(25, $atBranch['data']['total_duration_minutes']);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user