updatesShippingArrangement = $updatesShippingArrangement; $this->updatesSchedule = $updatesSchedule; } /** * @param String $orderId * @param Request $request * @return JsonResponse * @throws InternalServerErrorException */ public function execute(String $orderId, Request $request){ try { $shippingArrangementObject = new ShippingArrangementObject($request->input('container_no'), $request->input('seal_no')); $arrangementId = $this->updatesShippingArrangement->execute($orderId, $shippingArrangementObject); $scheduleObject = new ScheduleObject($request->input('schedule')['ETA'], $request->input('schedule')['ETD'], 0, $request->input('schedule')['remark']); $this->updatesSchedule->execute($arrangementId, $scheduleObject); return new JsonResponse(null, HttpStatus::RESOURCE_CREATED); } catch (\Exception $exception){ throw new InternalServerErrorException("Failed to update order's shipping arrangement because {$exception->getMessage()}"); } } }