20 lines
538 B
PHP
20 lines
538 B
PHP
<?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
|
||
|
|
{
|
||
|
|
public function __construct(public readonly string $code)
|
||
|
|
{
|
||
|
|
parent::__construct("The coupon code \"{$code}\" is not valid.");
|
||
|
|
}
|
||
|
|
}
|