FleetCart/Modules/Coupon/Checkers/MaximumSpend.php

19 lines
378 B
PHP
Raw Normal View History

2023-06-11 12:14:03 +00:00
<?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);
}
}