repository = $repository; $this->SetsOrderWarehouse = $SetsOrderWarehouse; $this->UpdatesOrderReceiveNoteDate = $UpdatesOrderReceiveNoteDate; $this->CreatesReceiveNote = $CreatesReceiveNote; } public function execute(string $orderId, Request $request){ try{ $orderObject = new OrderObject($orderId, null, $request->input('warehouse_id')); $this->SetsOrderWarehouse->execute($orderObject); $receiveNoteObject = new ReceiveNoteObject($request->input('tracking_no')); $this->CreatesReceiveNote->execute($orderObject, $receiveNoteObject); $repository = $this->repository->findOrFail($orderId); $stepObject = new StepObject($repository->current_step, $request->input('complete_date')); return $this->UpdatesOrderReceiveNoteDate->execute($orderId, $stepObject); return new JsonResponse([], HttpStatus::RESOURCE_CREATED); }catch(\Exception $exception) { throw new InternalServerErrorException("Failed to update order's packing list because {$exception->getMessage()}"); } } }