fix(purchase): unify expired checkout errors
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
use App\Domains\Auth\Exceptions\AccountLockedException;
|
||||
use App\Domains\Purchase\Exceptions\InsufficientStockException;
|
||||
use App\Domains\Purchase\Exceptions\PurchaseExpiredException;
|
||||
use App\Domains\Purchase\Exceptions\PurchaseLimitExceededException;
|
||||
use App\Domains\Ticket\Exceptions\TicketNotAvailableException;
|
||||
use App\Http\Middleware\EnsureAdminAppTenant;
|
||||
@@ -102,6 +103,16 @@ return Application::configure(basePath: dirname(__DIR__))
|
||||
'maximum_addable_quantity' => $exception->maximumAddableQuantity,
|
||||
], 422);
|
||||
});
|
||||
$exceptions->render(function (PurchaseExpiredException $exception, Request $request) {
|
||||
if (! $request->is('api/*')) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return response()->json([
|
||||
'code' => 'purchase.expired',
|
||||
'message' => $exception->getMessage(),
|
||||
], 422);
|
||||
});
|
||||
$exceptions->render(function (ModelNotFoundException $exception, Request $request) {
|
||||
if (! $request->is('api/*')) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user