authService->getCustomerAsMandatory(); $basket = $this->basketService->getBasket(); return new InitializeOrderTunnelInput( basket: $basket, shopperId: $customer->getId(), ); } public function authorize(): bool { return $this->authService->check(); } #[\Override] protected function prepareForValidation(): void { $this->merge([ 'basketTotal' => $this->basketService ->getBasket() ->totalTaxIncluded() ->getAmount(), ]); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(): array { return [ 'basketTotal' => [ function (string $_, mixed $__, \Closure $fail) { try { $basket = $this->basketService->getBasket(); $this->orderTunnelService->assertBasketAmountWithinLimit($basket); } catch (OrderLimitExceededException) { $fail(trans('You have reached the maximum order limit for this basket.')); } }, ], ]; } }