setsOrderWarehouse = $setsOrderWarehouse; $this->updatesStepCompleteDate = $updatesStepCompleteDate; $this->updatesTrackingNumber = $updatesTrackingNumber; } /** * @param string $orderId * @param Request $request * @return JsonResponse * @throws InternalServerErrorException */ public function execute(string $orderId, Request $request){ try{ $stepObject = new StepObject(OrderSteps::ORDER_WAREHOUSE_RECEIVING_STEP, $request->input('complete_date')); $this->setsOrderWarehouse->execute($orderId, $request->input('warehouse_id'), 0); $this->setsOrderWarehouse->execute($orderId, $request->input('warehouse_id'), 2); $this->updatesStepCompleteDate->execute($orderId, $stepObject); $trackingNumberObject = new TrackingNumberObject(0, $request->input('tracking_number')); $this->updatesTrackingNumber->execute($orderId, $trackingNumberObject); return new JsonResponse([], HttpStatus::RESOURCE_CREATED); }catch(\Exception $exception) { throw new InternalServerErrorException("Failed to update order's receive note because {$exception->getMessage()}"); } } }