1<?php
2
3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0.
4// See the LICENCE file in the repository root for full licence text.
5
6namespace App\Traits;
7
8use App\Models\Store\Order;
9use Session;
10
11trait CheckoutErrorSettable
12{
13 public function setAndRedirectCheckoutError(?Order $order, $message = '', $errors = [])
14 {
15 Session::flash('checkout.error.message', $message);
16 Session::flash('checkout.error.errors', $errors);
17
18 // TODO: what to do if order is null?
19 return ujs_redirect(route('store.checkout.show', $order), 422);
20 }
21}