feat(ticket): implement validity time management for tickets and catalog items
- Added ValidityTime model and migration to manage ticket validity periods. - Updated TicketGeneratorService to resolve and assign validity times to tickets. - Refactored ticket generation logic to remove legacy date fields and use validity time. - Introduced timezone support for tenants to handle service dates correctly. - Updated migrations to remove deprecated columns and add foreign keys for validity times. - Modified seeders and tests to accommodate new validity time structure. - Enhanced tests to validate ticket generation and validity time behavior.
This commit is contained in:
@@ -95,22 +95,8 @@ class FiestaFutbolInfantilProductSeederTest extends TestCase
|
||||
->map(fn ($variant) => $variant->eventDate->date->format('Y-m-d'))
|
||||
->all()
|
||||
);
|
||||
$this->assertSame(
|
||||
[
|
||||
['2026-10-09 00:00:00', '2026-10-09 23:59:59'],
|
||||
['2026-10-10 00:00:00', '2026-10-10 23:59:59'],
|
||||
['2026-10-11 00:00:00', '2026-10-11 23:59:59'],
|
||||
['2026-10-12 00:00:00', '2026-10-12 23:59:59'],
|
||||
],
|
||||
$generalAdmission->variants
|
||||
->sortBy(fn ($variant) => $variant->eventDate->date)
|
||||
->map(fn ($variant): array => [
|
||||
$variant->getMinimumUseDate()->format('Y-m-d H:i:s'),
|
||||
$variant->getMaximumUseDate()->format('Y-m-d H:i:s'),
|
||||
])
|
||||
->values()
|
||||
->all()
|
||||
);
|
||||
$this->assertSame('2026-10-09 00:00:00', $generalAdmission->validityTime->fixed_starts_at->format('Y-m-d H:i:s'));
|
||||
$this->assertSame('2026-10-12 23:59:59', $generalAdmission->validityTime->fixed_expires_at->format('Y-m-d H:i:s'));
|
||||
|
||||
$standardItems = CatalogItem::query()
|
||||
->where('tenant_code', $tenant->codigo)
|
||||
@@ -122,11 +108,11 @@ class FiestaFutbolInfantilProductSeederTest extends TestCase
|
||||
$this->assertSame($event->id, $standardItem->event_id);
|
||||
$this->assertSame(
|
||||
'2026-10-09 00:00:00',
|
||||
$standardItem->minimum_use_date->format('Y-m-d H:i:s'),
|
||||
$standardItem->validityTime->fixed_starts_at->format('Y-m-d H:i:s'),
|
||||
);
|
||||
$this->assertSame(
|
||||
'2026-10-12 23:59:59',
|
||||
$standardItem->maximum_use_date->format('Y-m-d H:i:s'),
|
||||
$standardItem->validityTime->fixed_expires_at->format('Y-m-d H:i:s'),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user