feat(ticket): implement ticket generation service, model, and exception handling with tests

This commit is contained in:
2026-07-21 11:20:52 -03:00
parent c3f54c79cb
commit a928a2e848
6 changed files with 526 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Domains\Ticket\Exceptions;
use App\Domains\Catalog\Models\CatalogItem;
use RuntimeException;
class TicketGenerationException extends RuntimeException
{
public static function invalidQuantity(): self
{
return new self('La cantidad de tickets a generar debe ser mayor a cero.');
}
public static function emptyBundle(CatalogItem $bundle): self
{
return new self("El bundle {$bundle->id} no tiene componentes.");
}
public static function ticketsDisabled(CatalogItem $catalogItem): self
{
return new self("El producto {$catalogItem->id} no tiene tickets habilitados.");
}
public static function maximumUseDateReached(CatalogItem $catalogItem): self
{
return new self("El producto {$catalogItem->id} alcanzó su fecha máxima de uso.");
}
}