*/ final readonly class GetOrderConfirmationQuery implements Query { public function __construct( private OrderTunnelService $orderTunnelService, private ShopRepository $shopRepository, ) { } /** * @param \App\Queries\Orders\GetOrderConfirmationQueryInput $input */ #[\Override] public function __invoke(QueryInput $input): GetOrderConfirmationQueryOutput { Assert::isInstanceOf($input, GetOrderConfirmationQueryInput::class); $builder = $this->orderTunnelService->getBuilderCompletedOrFail(); $basket = $builder->getBasket(); $shop = $this->shopRepository->find($builder->getShopId()); if (! $shop) { throw new NotFoundHttpException('Shop not found'); } $shopDto = ShopDto::fromDomain($shop); return new GetOrderConfirmationQueryOutput( step: OrderTunnelStep::CONFIRMATION, basket: $basket, builder: $builder, shop: $shopDto, ); } }