SetsOrderWarehouse = $SetsOrderWarehouse; $this->UpdatesStepCompleteDate = $UpdatesStepCompleteDate; $this->UpdatesReceiveNote = $UpdatesReceiveNote; } public function execute(string $orderId, Request $request){ try{ $orderObject = new OrderObject($orderId, null, $request->input('warehouse_id')); $stepObject = new StepObject(Constants::ORDER_WAREHOUSE_RECEIVING_STEP, $request->input('complete_date')); $receiveNoteObject = new ReceiveNoteObject($request->input('tracking_no')); $this->SetsOrderWarehouse->execute($orderObject); $this->UpdatesReceiveNote->execute($orderObject, $receiveNoteObject); $this->UpdatesStepCompleteDate->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()}"); } } }