2026-08-28 13:14:47 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Modules\Core\Cart\Exceptions;
|
|
|
|
|
|
|
|
|
|
use RuntimeException;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Thrown by CartService::applyCoupon() when the given code doesn't match any
|
|
|
|
|
* currently-active, non-exhausted Discount — Lunar's own
|
|
|
|
|
* Discounts::validateCoupon() only returns a bool, it has no matching
|
|
|
|
|
* exception type of its own to reuse here.
|
|
|
|
|
*/
|
|
|
|
|
class InvalidCouponException extends RuntimeException
|
|
|
|
|
{
|
2026-08-31 13:16:13 +03:00
|
|
|
public function __construct(public readonly string $couponCode)
|
2026-08-28 13:14:47 +03:00
|
|
|
{
|
2026-08-31 13:16:13 +03:00
|
|
|
parent::__construct("The coupon code \"{$couponCode}\" is not valid.");
|
2026-08-28 13:14:47 +03:00
|
|
|
}
|
|
|
|
|
}
|