FleetCart/Modules/Coupon/Checkers/MaximumSpend.php
2023-06-11 13:14:03 +01:00

19 lines
378 B
PHP

<?php
namespace Modules\Coupon\Checkers;
use Closure;
use Modules\Coupon\Exceptions\MaximumSpendException;
class MaximumSpend
{
public function handle($coupon, Closure $next)
{
if ($coupon->spentMoreThanMaximumAmount()) {
throw new MaximumSpendException($coupon->maximum_spend);
}
return $next($coupon);
}
}