Files
shopit-back/app/Domains/Ticket/Exceptions/TicketGenerationException.php

42 lines
1.3 KiB
PHP

<?php
namespace App\Domains\Ticket\Exceptions;
use App\Domains\Catalog\Models\CatalogItem;
use App\Domains\Purchase\Models\Purchase;
use App\Domains\Purchase\Models\PurchaseItem;
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.");
}
public static function purchaseWithoutUser(Purchase $purchase): self
{
return new self("La compra {$purchase->id} no tiene un usuario asociado.");
}
public static function catalogItemNotFound(PurchaseItem $purchaseItem): self
{
return new self("No se encontró el producto de la línea de compra {$purchaseItem->id}.");
}
}