diff --git a/app/Classes/Modules/OrderSteps/ControllersLogic/CompletesOrderStepLogic.php b/app/Classes/Modules/OrderSteps/ControllersLogic/CompletesOrderStepLogic.php new file mode 100644 index 00000000..d890dd5a --- /dev/null +++ b/app/Classes/Modules/OrderSteps/ControllersLogic/CompletesOrderStepLogic.php @@ -0,0 +1,45 @@ +canCreateOrder = $canCreateOrder; + $this->createsOrder = $createsOrder; + } + + protected function notification():array { + return [ + 'title' => 'Created Order', + 'message' => 'You have successfully created a new Order' + ]; + } + + public function logic(Request $request) : JsonResponse { + $order_object = new OrderObject($request->get('company_module_id'), '', '', OrderType::SHARED_CONTAINER, OrderStatus::PROCESSING, OrderSteps::PROCESSING); + + $this->canCreateOrder->passes($order_object); + + $order = $this->createsOrder->execute($order_object); + + return $this->resourceResponse(new OrderResource($order)); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/DataTransferObjects/OrderStepsObject.php b/app/Classes/Modules/OrderSteps/DataTransferObjects/OrderStepsObject.php new file mode 100644 index 00000000..4ec1fd41 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/DataTransferObjects/OrderStepsObject.php @@ -0,0 +1,86 @@ +order_id = $order_id; + $this->appointee_id = $appointee_id; + $this->reference = $reference; + $this->primary = $primary; + + $this->sequence = $sequence; + $this->status = $status; + $this->contract_status = $contract_status; + $this->completed_date = $completed_date; + + $this->id = $id; + } + + public function getOrderId(): int + { + return $this->order_id; + } + + public function getAppointeeId(): int + { + return $this->appointee_id; + } + public function getReference(): string + { + return $this->reference; + } + public function getPrimary(): bool + { + return $this->primary; + } + + public function getSequence(): float + { + return $this->sequence; + } + + public function getStatus(): int + { + return $this->status; + } + + public function getContractStatus(): int + { + return $this->contract_status; + } + + public function getCompletedDate(): Carbon + { + return $this->completed_date ? Carbon::parse($this->completed_date) : Carbon::now(); + } + + public function getId(): int + { + return $this->id; + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Processors/CreateOrderStepsProcessor.php b/app/Classes/Modules/OrderSteps/Processors/CreateOrderStepsProcessor.php new file mode 100644 index 00000000..2f39e830 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/CreateOrderStepsProcessor.php @@ -0,0 +1,47 @@ +canCreateOrderStep = $canCreateOrderStep; + $this->createsOrderSteps = $createsOrderSteps; + $this->fetchesOrder = $fetchesOrder; + $this->fetchesOrderSteps = $fetchesOrderSteps; + } + + public function execute(Model $order, string $currentStep){ + + $order_steps_object = new OrderStepsObject($order->id, $order->company_module_id, $currentStep, true, 0, OrderStatus::PROCESSING, 0, null); + + $this->canCreateOrderStep->passes($order_steps_object); + + return $this->createsOrderSteps->execute($order_steps_object); + + } +} diff --git a/app/Classes/Modules/OrderSteps/Processors/GenerateOrderStepsProcessor.php b/app/Classes/Modules/OrderSteps/Processors/GenerateOrderStepsProcessor.php new file mode 100644 index 00000000..97789148 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/GenerateOrderStepsProcessor.php @@ -0,0 +1,69 @@ +updatesOrderCurrentStep = $updatesOrderCurrentStep; + $this->unityConfig = Config::get('unity'); + $this->createsManyOrderStep = $createsManyOrderStep; + $this->updateOrderStepProcessors = $updateOrderStepProcessors; + $this->getContractObligationsProcessor = $getContractObligationsProcessor; + } + + public function execute(Order $order){ + + $obligations = $this->getContractObligationsProcessor->execute(); + + foreach($obligations as $step){ + $orderSteps[] = new OrderStepsObject( + $order->id, + 1, + $step->name, + true, + $step->sequence, + 0, + 0, + null + ); + } + + $this->createsManyOrderStep->execute($order, $orderSteps); + + $this->updatesOrderCurrentStep->execute($order->id, OrderSteps::PACKING); + + $this->updateOrderStepProcessors->execute(OrderSteps::PROCESSING); + + } +} diff --git a/app/Classes/Modules/OrderSteps/Processors/Steps/AbstractStepProcessor.php b/app/Classes/Modules/OrderSteps/Processors/Steps/AbstractStepProcessor.php new file mode 100644 index 00000000..e96065b5 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/Steps/AbstractStepProcessor.php @@ -0,0 +1,46 @@ +validator()){ + return new JsonResponse(['message' => 'Updating step validation has failed due to missing requirements'], HttpStatus::VALIDATION_FAILED); + } + + (new CompletesOrderStep())->execute($orderId, $step); + + /** notification */ + + + return new JsonResponse(null, HttpStatus::REQUEST_ACCEPTED); + + } catch (\Exception $exception){ + + throw new InternalServerErrorException("Failed to update order step because {$exception->getMessage()}"); + + } + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Processors/Steps/ConfirmsOrder.php b/app/Classes/Modules/OrderSteps/Processors/Steps/ConfirmsOrder.php new file mode 100644 index 00000000..0355e269 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/Steps/ConfirmsOrder.php @@ -0,0 +1,56 @@ +orderId = $orderId; + $this->step = new StepObject(self::STEP_REFERENCE, $completeDate); + + } + + /** + * @return bool + */ + public function validator(): bool { + return true; + } + + + /** + * @return JsonResponse + * @throws InternalServerErrorException + * @throws \App\Classes\Modules\Accounts\Exceptions\CannotCreateOrderStepsException + */ + public function execute(): JsonResponse { + + (new generateOrderSteps())->execute($this->orderId); + + return $this->handler($this->orderId, $this->step); + } + +} diff --git a/app/Classes/Modules/OrderSteps/Processors/Steps/DeliverOrder.php b/app/Classes/Modules/OrderSteps/Processors/Steps/DeliverOrder.php new file mode 100644 index 00000000..1e5a9738 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/Steps/DeliverOrder.php @@ -0,0 +1,56 @@ +orderId = $orderId; + $this->step = new StepObject(self::STEP_REFERENCE, $completeDate); + + } + + /** + * @return bool + */ + public function validator(): bool { + if(!DeliveryArrangement::where('order_id', $this->orderId)->exists()) { + return false; + } + + return true; + } + + + /** + * @return JsonResponse + * @throws InternalServerErrorException + */ + public function execute(): JsonResponse { + return $this->handler($this->orderId, $this->step); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Processors/Steps/ShipOrder.php b/app/Classes/Modules/OrderSteps/Processors/Steps/ShipOrder.php new file mode 100644 index 00000000..85bba60f --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/Steps/ShipOrder.php @@ -0,0 +1,59 @@ +orderId = $orderId; + $this->step = new StepObject(self::STEP_REFERENCE, $completeDate); + + } + + + /** + * @return bool + */ + public function validator(): bool { + + if(!ShippingArrangement::where('order_id', $this->orderId)->exists()) { + return false; + } + + return true; + } + + + /** + * @return JsonResponse + * @throws InternalServerErrorException + */ + public function execute(): JsonResponse { + return $this->handler($this->orderId, $this->step); + } + + +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Processors/Steps/WarehouseArrivalOrder.php b/app/Classes/Modules/OrderSteps/Processors/Steps/WarehouseArrivalOrder.php new file mode 100644 index 00000000..e7376c18 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/Steps/WarehouseArrivalOrder.php @@ -0,0 +1,52 @@ +orderId = $orderId; + $this->step = new StepObject(self::STEP_REFERENCE, $completeDate); + + } + + /** + * @return bool + */ + public function validator(): bool { + return true; + } + + + /** + * @return JsonResponse + * @throws InternalServerErrorException + */ + public function execute(): JsonResponse { + return $this->handler($this->orderId, $this->step); + } + + +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Processors/Steps/WarehousePackOrder.php b/app/Classes/Modules/OrderSteps/Processors/Steps/WarehousePackOrder.php new file mode 100644 index 00000000..eab2db4b --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/Steps/WarehousePackOrder.php @@ -0,0 +1,60 @@ +orderId = $orderId; + $this->step = new StepObject(self::STEP_REFERENCE, $completeDate); + + } + + /** + * @return bool + */ + public function validator(): bool { + + $packingList = PackingList::where('order_id', $this->orderId)->first(); + + if(!$packingList->confirmed) { + return false; + } + + return true; + } + + + /** + * @return JsonResponse + * @throws InternalServerErrorException + */ + public function execute(): JsonResponse { + + return $this->handler($this->orderId, $this->step); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Processors/Steps/WarehouseReceivesOrder.php b/app/Classes/Modules/OrderSteps/Processors/Steps/WarehouseReceivesOrder.php new file mode 100644 index 00000000..f032429c --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/Steps/WarehouseReceivesOrder.php @@ -0,0 +1,65 @@ +orderId = $orderId; + $this->step = new StepObject(self::STEP_REFERENCE, $completeDate); + + } + + /** + * @return bool + */ + public function validator(): bool { + return true; + } + + + /** + * @return JsonResponse + * @throws InternalServerErrorException + */ + public function execute(): JsonResponse { + Mail::send('emails.received_orders_email', [], function ($message) { + $message->from('noreply@izyin.com', 'IZYIM'); + $message->to('uldvstar@gmail.com', 'Omair Saleh')->subject('Received orders report '.now()->format('dd/mm/YY')); + $message->attach( + Excel::download(Order::find($this->orderId), + 'report_'.now()->format('dd_mm_YY').'.xlsx') + ->getFile(), ['as' => 'report_'.now()->format('dd/mm/YY').'.xlsx']); + + }); + + return $this->handler($this->orderId, $this->step); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Processors/Steps/WarehouseUnpackingOrder.php b/app/Classes/Modules/OrderSteps/Processors/Steps/WarehouseUnpackingOrder.php new file mode 100644 index 00000000..352d2235 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/Steps/WarehouseUnpackingOrder.php @@ -0,0 +1,51 @@ +orderId = $orderId; + $this->step = new StepObject(self::STEP_REFERENCE, $completeDate); + + } + + /** + * @return bool + */ + public function validator(): bool { + return true; + } + + + /** + * @return JsonResponse + * @throws InternalServerErrorException + */ + public function execute(): JsonResponse { + return $this->handler($this->orderId, $this->step); + } + +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Processors/UpdateOrderStepsProcessor.php b/app/Classes/Modules/OrderSteps/Processors/UpdateOrderStepsProcessor.php new file mode 100644 index 00000000..40903d5d --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Processors/UpdateOrderStepsProcessor.php @@ -0,0 +1,43 @@ +canUpdateOrderStep = $canUpdateOrderStep; + $this->updatesOrderSteps = $updatesOrderSteps; + $this->fetchesOrderSteps = $fetchesOrderSteps; + } + + public function execute(string $currentStep){ + + $orderStepsObject = new OrderStepsObject(0,0,$currentStep, 0, 0, 1, 1, null); + + $this->canUpdateOrderStep->passes($orderStepsObject); + + $orderSteps = $this->fetchesOrderSteps->execute(['reference'=>$currentStep]); + + $this->updatesOrderSteps->execute($orderSteps, $orderStepsObject); + + } +} diff --git a/app/Classes/Modules/OrderSteps/Services/CreatesManyOrderSteps.php b/app/Classes/Modules/OrderSteps/Services/CreatesManyOrderSteps.php new file mode 100644 index 00000000..7771692d --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Services/CreatesManyOrderSteps.php @@ -0,0 +1,30 @@ + $step->getOrderId(), + 'appointee_id' => $step->getAppointeeId(), + 'reference' => $step->getReference(), + 'primary' => $step->getPrimary(), + 'sequence' => $step->getSequence(), + 'status' => 0, + 'contract_status' => 0 + ]; + } + $order->orderSteps()->createMany($orderStepsModel); + + } +} diff --git a/app/Classes/Modules/OrderSteps/Services/CreatesOrderSteps.php b/app/Classes/Modules/OrderSteps/Services/CreatesOrderSteps.php new file mode 100644 index 00000000..5f9443fc --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Services/CreatesOrderSteps.php @@ -0,0 +1,29 @@ +order_id = $orderSteps->getOrderId(); + $orderStepsModel->appointee_id = $orderSteps->getAppointeeId(); + $orderStepsModel->reference = $orderSteps->getReference(); + $orderStepsModel->primary = $orderSteps->getPrimary(); + $orderStepsModel->sequence = $orderSteps->getSequence(); + $orderStepsModel->status = 0; + $orderStepsModel->contract_status = 0; + $orderStepsModel->complete_date = null; + + return $this->handler($orderStepsModel); + + } +} diff --git a/app/Classes/Modules/OrderSteps/Services/FetchesOrderSteps.php b/app/Classes/Modules/OrderSteps/Services/FetchesOrderSteps.php new file mode 100644 index 00000000..77559b14 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Services/FetchesOrderSteps.php @@ -0,0 +1,32 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Services/ListsOrderSteps.php b/app/Classes/Modules/OrderSteps/Services/ListsOrderSteps.php new file mode 100644 index 00000000..e4aa2d87 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Services/ListsOrderSteps.php @@ -0,0 +1,33 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Services/UpdatesOrderSteps.php b/app/Classes/Modules/OrderSteps/Services/UpdatesOrderSteps.php new file mode 100644 index 00000000..9966e9d9 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Services/UpdatesOrderSteps.php @@ -0,0 +1,21 @@ +status = $object->getStatus(); + $model->contract_status = $object->getContractStatus(); + $model->complete_date = $object->getCompletedDate(); + + return $this->handler($model); + + } +} diff --git a/app/Classes/Modules/OrderSteps/Standards/Rules/CanCreateOrderStep.php b/app/Classes/Modules/OrderSteps/Standards/Rules/CanCreateOrderStep.php new file mode 100644 index 00000000..65bec43a --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Standards/Rules/CanCreateOrderStep.php @@ -0,0 +1,41 @@ +orderValidation = $orderValidation; + } + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + } + + protected function validators($object): bool + { + return $this->orderValidation->validate($object); + } + + /** + * @param CompanyObject $object + * @return bool + */ + protected function criteria($object): bool + { + //Verify account? + //Contract created on Unity + return true; + } +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Standards/Rules/CanUpdateOrderStep.php b/app/Classes/Modules/OrderSteps/Standards/Rules/CanUpdateOrderStep.php new file mode 100644 index 00000000..0ac8488f --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Standards/Rules/CanUpdateOrderStep.php @@ -0,0 +1,39 @@ +orderValidation = $orderValidation; + } + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + } + + protected function validators($object): bool + { + return $this->orderValidation->validate($object); + } + + /** + * @param CompanyObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } +} \ No newline at end of file diff --git a/app/Classes/Modules/OrderSteps/Standards/Validators/CreateOrderStepValidation.php b/app/Classes/Modules/OrderSteps/Standards/Validators/CreateOrderStepValidation.php new file mode 100644 index 00000000..4721a459 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Standards/Validators/CreateOrderStepValidation.php @@ -0,0 +1,41 @@ + 'required' + ]; + } + } + + /** + * @return array + */ + protected function messages(): array + { + return []; + } +} diff --git a/app/Classes/Modules/OrderSteps/Standards/Validators/UpdateOrderStepValidation.php b/app/Classes/Modules/OrderSteps/Standards/Validators/UpdateOrderStepValidation.php new file mode 100644 index 00000000..8e5ac322 --- /dev/null +++ b/app/Classes/Modules/OrderSteps/Standards/Validators/UpdateOrderStepValidation.php @@ -0,0 +1,37 @@ + $object->getId(), + ]; + } + + /** + * @param string $type + * @return array + */ + protected function rules(?string $type = 'POST'): array + { + return []; + } + + /** + * @return array + */ + protected function messages(): array + { + return []; + } +} diff --git a/app/Classes/Modules/Orders/ControllersLogic/ConfirmOrderLogic.php b/app/Classes/Modules/Orders/ControllersLogic/ConfirmOrderLogic.php new file mode 100644 index 00000000..28acd2d3 --- /dev/null +++ b/app/Classes/Modules/Orders/ControllersLogic/ConfirmOrderLogic.php @@ -0,0 +1,51 @@ +canConfirmOrder = $canConfirmOrder; + $this->generateOrderStepsProcessor = $generateOrderStepsProcessor; + $this->fetchesOrder = $fetchesOrder; + } + + protected function notification():array { + return [ + 'title' => 'Confirm Order', + 'message' => 'Order confirmed' + ]; + } + + public function logic(Request $request) : JsonResponse { + + $order_object = new OrderObject(0,'','',0,0, '',$request->get('id')); + + $this->canConfirmOrder->passes($order_object); + + $order = $this->fetchesOrder->execute(['id'=>$order_object->getId()]); + + $this->generateOrderStepsProcessor->execute($order); + + return $this->resourceResponse(new OrderResource($order)); + } +} diff --git a/app/Classes/Modules/Orders/ControllersLogic/CreateOrderLogic.php b/app/Classes/Modules/Orders/ControllersLogic/CreateOrderLogic.php new file mode 100644 index 00000000..cd8d43c9 --- /dev/null +++ b/app/Classes/Modules/Orders/ControllersLogic/CreateOrderLogic.php @@ -0,0 +1,46 @@ +createOrderProcessor = $createsOrderProcessor; + } + + protected function notification():array { + return [ + 'title' => 'Created Order', + 'message' => 'You have successfully created a new Order' + ]; + } + + public function logic(Request $request) : JsonResponse { + + $order = $this->createOrderProcessor->execute($request); + + //$order_object = new OrderObject($request->get('company_module_id'), '', '', OrderType::SHARED_CONTAINER, OrderStatus::PROCESSING, OrderSteps::PROCESSING); + + //$this->canCreateOrder->passes($order_object); + + //$order = $this->createsOrder->execute($order_object); + + return $this->resourceResponse(new OrderResource($order)); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Orders/DataTransferObjects/OrderObject.php b/app/Classes/Modules/Orders/DataTransferObjects/OrderObject.php new file mode 100644 index 00000000..21b5f733 --- /dev/null +++ b/app/Classes/Modules/Orders/DataTransferObjects/OrderObject.php @@ -0,0 +1,74 @@ +company_module_id = $company_module_id; + $this->reference = $reference; + $this->reference_contract = $reference_contract; + $this->type = $type; + $this->status = $status; + $this->current_step = $current_step; + $this->id = $id; + } + + public function getId(): int + { + return $this->id; + } + + public function getCompanyModuleId(): int + { + return $this->company_module_id; + } + + public function getReference(): string + { + return $this->reference; + } + + public function getReferenceContract(): string + { + return $this->reference_contract; + } + + public function getType(): int + { + return $this->type; + } + + public function getStatus(): int + { + return $this->status; + } + + public function getCurrentStep(): string + { + return $this->current_step; + } + + public function setCurrentStep(string $step) + { + $this->current_step = $step; + } +} diff --git a/app/Classes/Modules/Orders/Processors/ConfirmOrderProcessor.php b/app/Classes/Modules/Orders/Processors/ConfirmOrderProcessor.php new file mode 100644 index 00000000..74b50ed9 --- /dev/null +++ b/app/Classes/Modules/Orders/Processors/ConfirmOrderProcessor.php @@ -0,0 +1,53 @@ +canUpdateCurrentStep = $canUpdateCurrentStep; + $this->updatesCurrentStep = $updatesCurrentStep; + $this->fetchesOrder = $fetchesOrder; + $this->fetchesOrderSteps = $fetchesOrderSteps; + $this->updateOrderStepProcessors = $updateOrderStepProcessors; + } + + public function execute(int $orderId, string $currentStep){ + + $order_object = new OrderObject(0, '', '', 0, 0, $currentStep, $orderId); + + $this->canUpdateCurrentStep->passes($order_object); + + $order = $this->fetchesOrder->execute(['id'=>$order_object->getId()]); + + $order_steps = $this->fetchesOrderSteps->execute(['order_id'=>$order_object->getId(), 'status'=> OrderStatus::PROCESSING, 'order_by' => 'sequence', 'per_page' => 1]); + + $order_object->setCurrentStep($currentStep); + + $order = $this->updatesCurrentStep->execute($order, $order_object); + + $this->updateOrderStepProcessors->execute($currentStep); + + } +} diff --git a/app/Classes/Modules/Orders/Processors/CreateOrderProcessor.php b/app/Classes/Modules/Orders/Processors/CreateOrderProcessor.php new file mode 100644 index 00000000..4b2708da --- /dev/null +++ b/app/Classes/Modules/Orders/Processors/CreateOrderProcessor.php @@ -0,0 +1,42 @@ +canCreateOrder = $canCreateOrder; + $this->createsOrder = $createsOrder; + $this->createOrderStepsProcessor = $createOrderStepsProcessor; + } + + public function execute(Request $request){ + + $order_object = new OrderObject($request->get('company_module_id'), $request->get('reference'), '', OrderType::SHARED_CONTAINER, OrderStatus::PROCESSING, OrderSteps::PROCESSING); + + $this->canCreateOrder->passes($order_object); + + $order = $this->createsOrder->execute($order_object); + + //Add processing to order step + $this->createOrderStepsProcessor->execute($order, OrderSteps::PROCESSING); + + return $order; + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Orders/Processors/UpdatesOrderCurrentStepProcessor.php b/app/Classes/Modules/Orders/Processors/UpdatesOrderCurrentStepProcessor.php new file mode 100644 index 00000000..8a5005e3 --- /dev/null +++ b/app/Classes/Modules/Orders/Processors/UpdatesOrderCurrentStepProcessor.php @@ -0,0 +1,48 @@ +canUpdateCurrentStep = $canUpdateCurrentStep; + $this->updatesCurrentStep = $updatesCurrentStep; + $this->fetchesOrder = $fetchesOrder; + $this->fetchesOrderSteps = $fetchesOrderSteps; + } + + public function execute(int $orderId, string $currentStep){ + + $order_object = new OrderObject(0, '', '', 0, 0, $currentStep, $orderId); + + $this->canUpdateCurrentStep->passes($order_object); + + $order = $this->fetchesOrder->execute(['id'=>$order_object->getId()]); + + $order_steps = $this->fetchesOrderSteps->execute(['order_id'=>$order_object->getId(), 'status'=> OrderStatus::PROCESSING, 'order_by' => 'sequence', 'per_page' => 1]); + + $order_object->setCurrentStep($currentStep); + + $order = $this->updatesCurrentStep->execute($order, $order_object); + + } +} diff --git a/app/Classes/Modules/Orders/Services/CreatesOrder.php b/app/Classes/Modules/Orders/Services/CreatesOrder.php new file mode 100644 index 00000000..6354c479 --- /dev/null +++ b/app/Classes/Modules/Orders/Services/CreatesOrder.php @@ -0,0 +1,29 @@ +company_module_id = $object->getCompanyModuleId(); + $model->reference = $object->getReference(); + $model->reference_contract = $object->getReferenceContract(); + $model->type = $object->getType(); + $model->status = $object->getStatus(); + $model->current_step = $object->getCurrentStep(); + + return $this->handler($model); + } +} diff --git a/app/Classes/Modules/Orders/Services/FetchesOrder.php b/app/Classes/Modules/Orders/Services/FetchesOrder.php new file mode 100644 index 00000000..f353e3a9 --- /dev/null +++ b/app/Classes/Modules/Orders/Services/FetchesOrder.php @@ -0,0 +1,32 @@ +repository = $repository; + } + + + /** + * @return Builder + */ + public function getRepository(): Builder + { + return $this->repository->newQuery(); + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Orders/Services/UpdatesCurrentStep.php b/app/Classes/Modules/Orders/Services/UpdatesCurrentStep.php new file mode 100644 index 00000000..0da528b9 --- /dev/null +++ b/app/Classes/Modules/Orders/Services/UpdatesCurrentStep.php @@ -0,0 +1,19 @@ +current_step = $object->getCurrentStep(); + + return $this->handler($model); + + } +} diff --git a/app/Classes/Modules/Orders/Standards/Rules/CanConfirmOrder.php b/app/Classes/Modules/Orders/Standards/Rules/CanConfirmOrder.php new file mode 100644 index 00000000..20e5faf7 --- /dev/null +++ b/app/Classes/Modules/Orders/Standards/Rules/CanConfirmOrder.php @@ -0,0 +1,39 @@ +confirmOrderValidation = $confirmOrderValidation; + } + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + } + + protected function validators($object): bool + { + return $this->confirmOrderValidation->validate($object); + } + + /** + * @param CompanyObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } +} diff --git a/app/Classes/Modules/Orders/Standards/Rules/CanCreateOrder.php b/app/Classes/Modules/Orders/Standards/Rules/CanCreateOrder.php new file mode 100644 index 00000000..c0fee466 --- /dev/null +++ b/app/Classes/Modules/Orders/Standards/Rules/CanCreateOrder.php @@ -0,0 +1,41 @@ +orderValidation = $orderValidation; + } + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + } + + protected function validators($object): bool + { + return $this->orderValidation->validate($object); + } + + /** + * @param CompanyObject $object + * @return bool + */ + protected function criteria($object): bool + { + //Verify account? + //Contract created on Unity + return true; + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Orders/Standards/Rules/CanUpdateCurrentStep.php b/app/Classes/Modules/Orders/Standards/Rules/CanUpdateCurrentStep.php new file mode 100644 index 00000000..d32abe8a --- /dev/null +++ b/app/Classes/Modules/Orders/Standards/Rules/CanUpdateCurrentStep.php @@ -0,0 +1,39 @@ +orderValidation = $orderValidation; + } + + /** + * @return bool + */ + protected function authorized(): bool + { + // TODO Set Authorization rules + return true; + } + + protected function validators($object): bool + { + return $this->orderValidation->validate($object); + } + + /** + * @param CompanyObject $object + * @return bool + */ + protected function criteria($object): bool + { + return true; + } +} \ No newline at end of file diff --git a/app/Classes/Modules/Orders/Standards/Validators/ConfirmOrderValidation.php b/app/Classes/Modules/Orders/Standards/Validators/ConfirmOrderValidation.php new file mode 100644 index 00000000..21c22e1b --- /dev/null +++ b/app/Classes/Modules/Orders/Standards/Validators/ConfirmOrderValidation.php @@ -0,0 +1,40 @@ + $object->getId(), + ]; + } + + /** + * @param string $type + * @return array + */ + protected function rules(?string $type = 'POST'): array + { + + return [ + 'id' => 'required|exists:orders,id' + ]; + } + + /** + * @return array + */ + protected function messages(): array + { + return []; + } +} diff --git a/app/Classes/Modules/Orders/Standards/Validators/OrderValidation.php b/app/Classes/Modules/Orders/Standards/Validators/OrderValidation.php new file mode 100644 index 00000000..bba459d6 --- /dev/null +++ b/app/Classes/Modules/Orders/Standards/Validators/OrderValidation.php @@ -0,0 +1,49 @@ + $object->getCompanyModuleId(), + 'reference' => $object->getReference(), + 'reference_contract' => $object->getReferenceContract(), + ]; + } + + /** + * @param string $type + * @return array + */ + protected function rules(?string $type = 'POST'): array + { + if ($type == 'POST') { + return [ + 'company_module_id' => 'required', + 'reference' => '', + 'reference_contract' => '' + ]; + } elseif ($type == 'PUT') { + return [ + 'id' => 'required' + ]; + } + } + + /** + * @return array + */ + protected function messages(): array + { + return []; + } +} diff --git a/app/Classes/Modules/Orders/Standards/Validators/UpdateCurrentStepValidation.php b/app/Classes/Modules/Orders/Standards/Validators/UpdateCurrentStepValidation.php new file mode 100644 index 00000000..037bdd52 --- /dev/null +++ b/app/Classes/Modules/Orders/Standards/Validators/UpdateCurrentStepValidation.php @@ -0,0 +1,41 @@ + $object->getId(), + 'current_step' => $object->getCurrentStep(), + ]; + } + + /** + * @param string $type + * @return array + */ + protected function rules(?string $type = 'POST'): array + { + return [ + 'id'=> 'required|numeric', + 'current_step'=> 'required', + ]; + } + + /** + * @return array + */ + protected function messages(): array + { + return []; + } +} diff --git a/app/Classes/Modules/Unity/Processors/GetContractObligationsProcessor.php b/app/Classes/Modules/Unity/Processors/GetContractObligationsProcessor.php new file mode 100644 index 00000000..337b3d7e --- /dev/null +++ b/app/Classes/Modules/Unity/Processors/GetContractObligationsProcessor.php @@ -0,0 +1,24 @@ +unityConfig = Config::get('unity'); + $this->getContractObligations = $getContractObligations; + } + + public function execute(){ + return $this->getContractObligations->execute(); + } +} diff --git a/app/Classes/Modules/Unity/Services/GetAccessToken.php b/app/Classes/Modules/Unity/Services/GetAccessToken.php new file mode 100644 index 00000000..353389ed --- /dev/null +++ b/app/Classes/Modules/Unity/Services/GetAccessToken.php @@ -0,0 +1,37 @@ +unityConfig = Config::get('unity'); + } + + public function execute(){ + + //TODO: Cache access token base on expiry for login version + + $accesToken=''; + if($this->unityConfig['default_auth']=='login'){ + $loginDetails = $this->unityConfig['auth']['login']; + $response = Http::post($this->unityConfig['url'].$loginDetails['endpoint'], [ + 'email' => $loginDetails['username'], + 'password' => $loginDetails['password'], + ])->object(); + $accesToken = $response->access_token; + }else{ + $accesToken = $this->unityConfig['auth']['api_key']['key']; + } + + //TODO: Throw error if access token not available + + return $accesToken; + } +} diff --git a/app/Classes/Modules/Unity/Services/GetContractObligations.php b/app/Classes/Modules/Unity/Services/GetContractObligations.php new file mode 100644 index 00000000..480fee3f --- /dev/null +++ b/app/Classes/Modules/Unity/Services/GetContractObligations.php @@ -0,0 +1,31 @@ +unityConfig = Config::get('unity'); + $this->getAccessToken = $getAccessToken; + } + + public function execute(){ + + $accesToken=$this->getAccessToken->execute(); + + $response = Http::withToken($accesToken)->get($this->unityConfig['url'].$this->unityConfig['steps_endpoint'])->object(); + $orderSteps = []; + + return (isset($response->data)) ? $response->data : []; + + } +} diff --git a/app/Classes/ValueObjects/Constants/OrderEntity.php b/app/Classes/ValueObjects/Constants/OrderEntity.php new file mode 100644 index 00000000..6151e4ff --- /dev/null +++ b/app/Classes/ValueObjects/Constants/OrderEntity.php @@ -0,0 +1,15 @@ + [ + 'initial_name' => 'processing order', + 'final_name' => 'order confirmed', + 'description' => 'Order created and pending confirmation', + 'sequence' => 0 + ] + ]; + + public const ORDER_PRIMARY_MODULAR_STEPS = [ + OrderSteps::ORDER_SHIPPING_STEP => [ + 'initial_name' => 'shipping', + 'final_name' => 'shipped out', + 'description' => 'Order is Loaded to Container, waiting for Shipment', + 'sequence' => 1 + ], + OrderSteps::ORDER_DELIVERY_STEP => [ + 'initial_name' => 'delivery', + 'final_name' => 'Received', + 'description' => 'Order out for delivery soon', + 'sequence' => 2 + ], + ]; + + public const ORDER_MODULAR_STEPS = [ + OrderSteps::ORDER_MODULE_WAREHOUSE => [ + 'china_warehouse' => [ + 'previous' => OrderSteps::ORDER_PROCESSING_STEP, + 'next' => OrderSteps::ORDER_SHIPPING_STEP, + 'steps' => [ + OrderSteps::ORDER_WAREHOUSE_RECEIVING_STEP => [ + 'initial_name' => 'pending supplier', + 'final_name' => 'arrived at warehouse', + 'description' => 'Waiting for supplier to deliver order to warehouse' + ], + OrderSteps::ORDER_WAREHOUSE_PACKING_STEP => [ + 'initial_name' => 'packing', + 'final_name' => 'packed', + 'description' => 'Packing order into shipping container' + ] + ] + ], + 'malaysia_warehouse' => [ + 'previous' => OrderSteps::ORDER_SHIPPING_STEP, + 'next' => OrderSteps::ORDER_DELIVERY_STEP, + 'steps' => [ + OrderSteps::ORDER_WAREHOUSE_ARRIVAL_STEP => [ + 'initial_name' => 'pending arrival', + 'final_name' => 'arrived at warehouse', + 'description' => 'Waiting for order\'s arrival & custom clearance' + ], + OrderSteps::ORDER_WAREHOUSE_UNPACKING_STEP => [ + 'initial_name' => 'unpacking', + 'final_name' => 'unpacked', + 'description' => 'Unpacking order from shipping container' + ] + ] + ] + ], + OrderSteps::ORDER_MODULE_NO_WAREHOUSE => [ + 'pending_arrival' => [ + 'previous' => OrderSteps::ORDER_PROCESSING_STEP, + 'next' => OrderSteps::ORDER_SHIPPING_STEP, + 'steps' => [ + OrderSteps::ORDER_NO_WAREHOUSE_PENDING_SUPPLIER => [ + 'initial_name' => 'pending supplier', + 'final_name' => 'supplier packed order', + 'description' => 'Waiting for supplier to pack order for shipping' + ] + ] + ] + + ], + ]; + + public const COMPANY_ORDER_PROCESSING = [ + OrderSteps::ORDER_PROCESSING_STEP, + OrderSteps::ORDER_NO_WAREHOUSE_PENDING_SUPPLIER, + OrderSteps::ORDER_WAREHOUSE_RECEIVING_STEP + ]; + + public const COMPANY_ORDER_SHIPPING = [ + OrderSteps::ORDER_WAREHOUSE_PACKING_STEP, + OrderSteps::ORDER_SHIPPING_STEP + ]; + + public const COMPANY_ORDER_RECEIVING = [ + OrderSteps::ORDER_WAREHOUSE_ARRIVAL_STEP, + OrderSteps::ORDER_WAREHOUSE_UNPACKING_STEP, + OrderSteps::ORDER_DELIVERY_STEP + + ]; + + public const WAREHOUSE_RECEIVING_CATEGORY = 'receiving'; + public const WAREHOUSE_SHIPPING_CATEGORY = 'shipping'; + public const WAREHOUSE_COMPLETE_CATEGORY = 'complete'; + public const WAREHOUSE_CANCEL_CATEGORY = 'cancel'; + + public const WAREHOUSE_ORDER_RECEIVING = [ + OrderSteps::ORDER_WAREHOUSE_RECEIVING_STEP + ]; + + public const WAREHOUSE_ORDER_SHIPPING = [ + OrderSteps::ORDER_WAREHOUSE_PACKING_STEP, + OrderSteps::ORDER_SHIPPING_STEP, + ]; + + public const WAREHOUSE_ORDER_COMPLETE = [ + OrderSteps::ORDER_WAREHOUSE_ARRIVAL_STEP, + OrderSteps::ORDER_WAREHOUSE_UNPACKING_STEP, + OrderSteps::ORDER_DELIVERY_STEP + ]; + + public const STEP_PROCESSOR = [ + OrderSteps::ORDER_PROCESSING_STEP => ConfirmsOrder::class, + OrderSteps::ORDER_WAREHOUSE_RECEIVING_STEP => WarehouseReceivesOrder::class, + OrderSteps::ORDER_WAREHOUSE_PACKING_STEP => WarehousePackOrder::class, + OrderSteps::ORDER_SHIPPING_STEP => ShipOrder::class, + OrderSteps::ORDER_WAREHOUSE_ARRIVAL_STEP => WarehouseArrivalOrder::class, + OrderSteps::ORDER_WAREHOUSE_UNPACKING_STEP => WarehouseUnpackingOrder::class, + OrderSteps::ORDER_DELIVERY_STEP => DeliverOrder::class, + ]; +*/ +} diff --git a/app/Classes/ValueObjects/Constants/OrderType.php b/app/Classes/ValueObjects/Constants/OrderType.php new file mode 100644 index 00000000..ca203697 --- /dev/null +++ b/app/Classes/ValueObjects/Constants/OrderType.php @@ -0,0 +1,11 @@ +[], + OrderSteps::PACKING=>[], + OrderSteps::SHIPPING=>[ + OrderSteps::WAREHOUSE_ARRIVAL=>[], + OrderSteps::WAREHOUSE_LOAD_CONTAINER=>[] + ], + OrderSteps::DELIVERY=>[ + OrderSteps::WAREHOUSE_RECEIVING=>[], + OrderSteps::WAREHOUSE_UNLOAD_CONTAINER=>[] + ], + ]; +} \ No newline at end of file diff --git a/app/Classes/ValueObjects/Constants/UnityStatus.php b/app/Classes/ValueObjects/Constants/UnityStatus.php new file mode 100644 index 00000000..78956432 --- /dev/null +++ b/app/Classes/ValueObjects/Constants/UnityStatus.php @@ -0,0 +1,13 @@ +execute($request); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Orders/ConfirmOrderController.php b/app/Http/Controllers/Orders/ConfirmOrderController.php new file mode 100644 index 00000000..cc6542ff --- /dev/null +++ b/app/Http/Controllers/Orders/ConfirmOrderController.php @@ -0,0 +1,21 @@ +merge(['id' => $id]); + return $logic->execute($request); + } +} diff --git a/app/Http/Controllers/Orders/CreateOrderController.php b/app/Http/Controllers/Orders/CreateOrderController.php new file mode 100644 index 00000000..1e3b7dcc --- /dev/null +++ b/app/Http/Controllers/Orders/CreateOrderController.php @@ -0,0 +1,20 @@ +execute($request); + } +} \ No newline at end of file diff --git a/app/Http/Resources/OrderResource.php b/app/Http/Resources/OrderResource.php new file mode 100644 index 00000000..a04a44db --- /dev/null +++ b/app/Http/Resources/OrderResource.php @@ -0,0 +1,33 @@ + $this->id, + 'reference' => $this->reference, + 'reference_contract' => (int) $this->type, + 'type' => (int) $this->type, + 'status' => (int) $this->status, + 'current_step' => $this->current_step, + 'company' => new CompanyResource(Company::where('id',$this->companyModule()->first()->company_id)->first()), + 'order_steps' => OrderStepsResource::collection($this->orderSteps()->get()), + ]; + } +} diff --git a/app/Http/Resources/OrderStepsResource.php b/app/Http/Resources/OrderStepsResource.php new file mode 100644 index 00000000..4b696acf --- /dev/null +++ b/app/Http/Resources/OrderStepsResource.php @@ -0,0 +1,36 @@ + $this->id, + 'order_id' => $this->order_id, + 'appointee_id' => $this->appointee_id, + 'reference' => $this->reference, + 'primary' => (int) $this->primary, + 'sequence' => (double) $this->sequence, + 'status' =>(int) $this->status, + 'contract_status' =>(int) $this->contract_status, + 'complete_date' => $this->complete_date, + ]; + } +} diff --git a/app/Models/Order.php b/app/Models/Order.php new file mode 100644 index 00000000..d0b2c451 --- /dev/null +++ b/app/Models/Order.php @@ -0,0 +1,30 @@ +belongsTo(CompanyModule::class, 'company_module_id', 'id'); + } + + public function orderSteps() + { + return $this->hasMany(OrderStep::class, 'order_id'); + } + +} diff --git a/app/Models/OrderRole.php b/app/Models/OrderRole.php new file mode 100644 index 00000000..9c5c155f --- /dev/null +++ b/app/Models/OrderRole.php @@ -0,0 +1,11 @@ + env('UNITY_API_URL', 'https://dev.unity.izyim.com/user-backsys/api/'), + + 'auth' => [ + + 'api_key' => [ + 'key' => env('UNITY_API_KEY', ''), + ], + + 'login' => [ + 'username' => env('UNITY_LOGIN_USERNAME','one@izyim.com'), + 'password' => env('UNITY_LOGIN_PASSWORD','pass123'), + 'endpoint' => env('UNITY_LOGIN_ENDPOINT','login') + ], + + ], + + 'steps_endpoint' => env('UNITY_LOGIN_ENDPOINT','contract-template-obligation/list'), + + 'default_auth' => env('UNITY_AUTH','login'), + + 'on_error_email' => env('UNITY_ON_ERROR_EMAIL','dev@shipping.com,dev@unity.com'), + + 'contract_template_id' => env('UNITY_CONTRACT_TEMPLATE_ID', 102), + + 'contract_template_cache' => env('UNITY_CONTRACT_TEMPLATE_CACHE','60'), + + 'entity' => [ + 'xxx' => App\Classes\ValueObjects\Constants\OrderEntity::SUPPLIER, + 'zzz' => App\Classes\ValueObjects\Constants\OrderEntity::WAREHOUSE_YIWU, + 'vvv' => App\Classes\ValueObjects\Constants\OrderEntity::WAREHOUSE_GUANG_ZHOU, + 'wwww' => App\Classes\ValueObjects\Constants\OrderEntity::SUPPLIER, + ], + + 'step_processor' => [ + App\Classes\ValueObjects\Constants\OrderSteps::PACKING => App\Classes\Modules\OrderSteps\Processors\Steps\Packing::class, + ], + +]; diff --git a/database/migrations/2021_07_07_174510_create_orders_table.php b/database/migrations/2021_07_07_174510_create_orders_table.php new file mode 100644 index 00000000..8ea309dc --- /dev/null +++ b/database/migrations/2021_07_07_174510_create_orders_table.php @@ -0,0 +1,40 @@ +id(); + $table->bigInteger('company_module_id')->unsigned()->index()->comment('Entity responsible to create this order'); + $table->string('reference')->comment('Reference no for user '); + $table->string('reference_contract')->comment('Reference no from Unity platform'); + $table->integer('type')->default(0)->comment('Order packages can be shipped in shared or dedicated container'); + $table->integer('status')->default(0)->comment('Status of this order, e.g. processing, shipping etc.'); + $table->string('current_step')->nullable(false)->comment('Current steps is quick reference for order steps'); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('company_module_id')->references('id')->on('company_modules'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('orders'); + } +} diff --git a/database/migrations/2021_07_07_174624_create_order_steps_table.php b/database/migrations/2021_07_07_174624_create_order_steps_table.php new file mode 100644 index 00000000..d848984a --- /dev/null +++ b/database/migrations/2021_07_07_174624_create_order_steps_table.php @@ -0,0 +1,43 @@ +id(); + $table->bigInteger('order_id')->unsigned()->index(); + $table->bigInteger('appointee_id')->unsigned()->index()->comment(''); + $table->string('reference')->comment('Reference no for user '); + $table->integer('primary')->default(0); + $table->decimal('sequence', 4, 2); + $table->integer('status')->default(0)->comment('Status of this order, e.g. processing, shipping etc.'); + $table->integer('contract_status')->default(0)->comment('Status of this order, e.g. processing, shipping etc.'); + $table->date('complete_date')->nullable(); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('appointee_id')->references('id')->on('company_modules'); + $table->foreign('order_id')->references('id')->on('orders'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('order_steps'); + } +} diff --git a/database/migrations/2021_07_07_174640_create_order_roles_table.php b/database/migrations/2021_07_07_174640_create_order_roles_table.php new file mode 100644 index 00000000..2dc2eb8c --- /dev/null +++ b/database/migrations/2021_07_07_174640_create_order_roles_table.php @@ -0,0 +1,38 @@ +id(); + $table->bigInteger('order_id')->unsigned()->index()->comment('Order id'); + $table->bigInteger('company_module_id')->unsigned()->index()->comment('Entity plays a role in this order, e.g. Freight Forwarder'); + $table->integer('role')->default(0)->comment('Describe role participate in processing order'); + $table->softDeletes(); + $table->timestamps(); + + $table->foreign('company_module_id')->references('id')->on('company_modules'); + $table->foreign('order_id')->references('id')->on('orders'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('order_roles'); + } +} diff --git a/resources/views/swagger/json.blade.php b/resources/views/swagger/json.blade.php index c2e3b0aa..36b0abd8 100644 --- a/resources/views/swagger/json.blade.php +++ b/resources/views/swagger/json.blade.php @@ -1 +1,944 @@ -{"swagger":"2.0","info":{"description":"Shipping Portal to manage parcel","version":"1.0.0","title":"Shipping Portal"},"host":"{{request()->getHttpHost()}}","basePath":"/api/v1","tags":[{"name":"Account","description":"Endpoints related to user module, e.g. login, register."},{"name":"Address","description":"Endpoints related to address module, e.g. create, district."},{"name":"Company","description":"Endpoints related to company module."},{"name":"Flow - Registration","description":"Endpoints related to registration flow."}],"schemes":["http","https"],"paths":{"/address/create":{"post":{"tags":["Address"],"produces":["application/json"],"operationId":"createAddress","summary":"Create address","description":"","parameters":[{"name":"district_id","in":"query","description":"District id","required":true,"type":"integer"},{"name":"street_one","in":"query","description":"Address line 1","required":true,"type":"string"},{"name":"street_two","in":"query","description":"Address line 2","required":true,"type":"string"},{"name":"post_code","in":"query","description":"Postcode of the address","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"}},"schema":{"type":"string"}},"422":{"description":"Invalid input supplied"}}}},"/address/delete/{id}":{"delete":{"tags":["Address"],"produces":["application/json"],"operationId":"deleteAddress","summary":"Delete address","description":"","parameters":[{"name":"id","in":"path","description":"District id","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"}},"schema":{"type":"string"}},"422":{"description":"Invalid input supplied"}}}},"/address/district/list":{"get":{"tags":["Address"],"produces":["application/json"],"operationId":"listDistrictAddress","summary":"List districts","description":"","parameters":[{"name":"filter","in":"query","description":"Filters","required":false,"type":"array","items":{"type":"string"}}],"responses":{"200":{"description":"successful operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"}},"schema":{"type":"string"}},"422":{"description":"Invalid input supplied"}}}},"/address/list":{"get":{"tags":["Address"],"produces":["application/json"],"operationId":"listAddress","summary":"List addresses of logged in user","description":"","parameters":[{"name":"filter","in":"query","description":"Filters","required":false,"type":"array","items":{"type":"string"}}],"responses":{"200":{"description":"successful operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"}},"schema":{"type":"string"}},"422":{"description":"Invalid input supplied"}}}},"/address/{id}/show":{"get":{"tags":["Address"],"produces":["application/json"],"operationId":"showAddress","summary":"List addresses of logged in user","description":"","parameters":[{"name":"id","in":"path","description":"Address id","required":true,"type":"integer"}],"responses":{"200":{"description":"successful operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"}},"schema":{"type":"string"}},"422":{"description":"Invalid input supplied"}}}},"/address/{id}/default":{"put":{"tags":["Address"],"produces":["application/json"],"operationId":"setDefaultAddress","summary":"Set default address","description":"","parameters":[{"name":"id","in":"path","description":"Address id","required":true,"type":"integer"},{"name":"district_id","in":"query","description":"District id","required":true,"type":"integer"},{"name":"street_one","in":"query","description":"Address line 1","required":true,"type":"string"},{"name":"street_two","in":"query","description":"Address line 2","required":true,"type":"string"},{"name":"post_code","in":"query","description":"Postcode of the address","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"}},"schema":{"type":"string"}},"422":{"description":"Invalid input supplied"}}}},"/address/update/{id}":{"put":{"tags":["Address"],"produces":["application/json"],"operationId":"setDefaultAddress","summary":"Set default address","description":"","parameters":[{"name":"id","in":"path","description":"Address id","required":true,"type":"integer"}],"responses":{"200":{"description":"successful operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"}},"schema":{"type":"string"}},"422":{"description":"Invalid input supplied"}}}},"/account/authentication/login/check_email":{"post":{"tags":["Account","Flow - Registration"],"summary":"Check if email registered","description":"","operationId":"userList","produces":["application/json","application/xml"],"parameters":[{"name":"email","in":"query","description":"email","required":true,"type":"string"}],"responses":{"default":{"description":"successful operation"}}}},"/account/registration/registration":{"post":{"tags":["Account","Flow - Registration"],"produces":["application/json"],"summary":"Register user into the system","description":"","parameters":[{"name":"name","in":"query","description":"The name of user","required":true,"type":"string"},{"name":"email","in":"query","description":"The email for login","required":true,"type":"string","format":"email"},{"name":"password","in":"query","description":"The password for login","required":true,"type":"string","format":"password"},{"name":"password_confirmation","in":"query","description":"The confirmation password for login","required":true,"type":"string","format":"password"},{"name":"type","in":"query","description":"Company Type - PERSONAL_BUSINESS:0 , COMPANY_BUSINESS:1","required":true,"type":"integer"},{"name":"phone","in":"query","description":"Contact phone number","required":true,"type":"string"},{"name":"contact_email","in":"query","description":"Contact email","required":true,"type":"string"},{"name":"company_name","in":"query","description":"The company name - if not defined , name of user will save as the company name","required":false,"type":"string"},{"name":"business_type","in":"query","description":"Business Type - FREIGHT_FORWARDER:1, IMPORTER:2, CURRENCY_VENDOR:3, WAREHOUSE:4","required":false,"default":2,"type":"integer"},{"name":"wechat_id","in":"query","description":"Contact Wechat id","required":false,"type":"string"},{"name":"files[0]","in":"query","description":"File need to convert to base64 example : 'data:application/pdf;base64,{Base64}';","required":true,"type":"string"},{"name":"identification_no","in":"query","description":"Personal identification no or company registration no","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"}},"schema":{"type":"string"}},"400":{"description":"Invalid username/password supplied"}}}},"/account/authentication/login/attempt":{"post":{"tags":["Account"],"produces":["application/json"],"summary":"Logs user into the system","operationId":"aaa","description":"","parameters":[{"name":"email","in":"query","description":"The user name for login","required":true,"type":"string"},{"name":"password","in":"query","description":"The password for login in clear text","required":true,"type":"string"}],"responses":{"200":{"description":"successful operation","headers":{"X-Expires-After":{"type":"string","format":"date-time","description":"date in UTC when token expires"},"X-Rate-Limit":{"type":"integer","format":"int32","description":"calls per hour allowed by the user"}},"schema":{"type":"string"}},"400":{"description":"Invalid username/password supplied"}}}},"/account/authentication/logout":{"get":{"tags":["Account"],"summary":"Logs out current logged in user session","description":"","operationId":"logoutUser","produces":["application/json","application/xml"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}},"/account/user/list":{"get":{"tags":["Account"],"summary":"Logs out current logged in user session","description":"","operationId":"userList","produces":["application/json","application/xml"],"parameters":[],"responses":{"default":{"description":"successful operation"}}}},"/company/list":{"get":{"tags":["Company"],"summary":"List of Companies","description":"example filters={\"WithCompanyModuleType\":4,\"order_by\":{\"column\":\"id\",\"DESC\":true}} | to get list of company with company_module.Type(business type) = 4(Warehouse)","operationId":"companyList","produces":["application/json","application/xml"],"parameters":[{"name":"filters","in":"query","description":"Eloquent Filter","required":false,"type":"array","items":{"type":"string"}}],"responses":{"default":{"description":"successful operation"}}}},"/company/create":{"post":{"tags":["Company"],"summary":"Create company","description":"","operationId":"companyCreate","produces":["application/json","application/xml"],"parameters":[{"name":"type","in":"query","description":"Company Type - PERSONAL_BUSINESS:0 , COMPANY_BUSINESS:1","required":true,"type":"integer","enum":[0,1]},{"name":"business_type","in":"query","description":"Business Type - FREIGHT_FORWARDER:1, IMPORTER:2, CURRENCY_VENDOR:3, WAREHOUSE:4","required":true,"type":"integer","enum":[1,2,3,4]},{"name":"name","in":"query","description":"Fill in name if type = 0","required":false,"type":"string"},{"name":"name","in":"query","description":"Fill in name if type = 0","required":false,"type":"string"},{"name":"company_name","in":"query","description":"Fill in company_name if type = 1","required":false,"type":"string"}],"responses":{"default":{"description":"successful operation"}}}}},"securityDefinitions":{"Authorization":{"type":"apiKey","name":"api_key","in":"header"},"petstore_auth":{"type":"oauth2","authorizationUrl":"https://petstore.swagger.io/oauth/authorize","flow":"implicit","scopes":{"read:pets":"read your pets","write:pets":"modify pets in your account"}}},"definitions":{"ApiResponse":{"type":"object","properties":{"code":{"type":"integer","format":"int32"},"title":{"type":"string"},"message":{"type":"string"},"payload":{"type":"object"}}}}} \ No newline at end of file +{ +"swagger": "2.0", +"info": { +"description": "Shipping Portal to manage parcel", +"version": "1.0.0", +"title": "Shipping Portal" +}, +"host": "{{request()->getHttpHost()}}", +"basePath": "/api/v1", +"tags": [ +{ +"name": "Account", +"description": "Endpoints related to user module, e.g. login, register." +}, +{ +"name": "Address", +"description": "Endpoints related to address module, e.g. create, district." +}, +{ +"name": "Company", +"description": "Endpoints related to company module." +}, +{ +"name": "Order", +"description": "Endpoints related to order module." +}, +{ +"name": "Flow - Registration", +"description": "Endpoints related to registration flow." +} +], +"schemes": [ +"http", +"https" +], +"paths": { +"/order/create": { +"post": { +"tags": [ +"Order" +], +"produces": [ +"application/json" +], +"operationId": "createOrder", +"summary": "Create order", +"description": "", +"parameters": [ +{ +"name": "company_module_id", +"in": "query", +"description": "Company Module ID", +"required": true, +"type": "integer" +}, +{ +"name": "reference", +"in": "query", +"description": "Internal reference id", +"required": true, +"type": "string" +}, +{ +"name": "reference_contract", +"in": "query", +"description": "Unity contract reference id", +"required": true, +"type": "string" +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"422": { +"description": "Invalid input supplied" +} +} +} +}, +"/order/confirm/{id}": { +"put": { +"tags": [ +"Order" +], +"produces": [ +"application/json" +], +"operationId": "confirmOrder", +"summary": "Admin confirms order", +"description": "", +"parameters": [ +{ +"name": "id", +"in": "path", +"description": "Order ID", +"required": true, +"type": "integer" +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"422": { +"description": "Invalid input supplied" +} +} +} +}, +"/order/{id}/step/completes": { +"post": { +"tags": [ +"Order" +], +"produces": [ +"application/json" +], +"operationId": "createOrder", +"summary": "Completes order step", +"description": "", +"parameters": [ +{ +"name": "id", +"in": "path", +"description": "Order Id", +"required": true, +"type": "integer" +}, +{ +"name": "reference", +"in": "query", +"description": "Order step reference", +"required": true, +"type": "string" +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"422": { +"description": "Invalid input supplied" +} +} +} +}, +"/address/create": { +"post": { +"tags": [ +"Address" +], +"produces": [ +"application/json" +], +"operationId": "createAddress", +"summary": "Create address", +"description": "", +"parameters": [ +{ +"name": "district_id", +"in": "query", +"description": "District id", +"required": true, +"type": "integer" +}, +{ +"name": "street_one", +"in": "query", +"description": "Address line 1", +"required": true, +"type": "string" +}, +{ +"name": "street_two", +"in": "query", +"description": "Address line 2", +"required": true, +"type": "string" +}, +{ +"name": "post_code", +"in": "query", +"description": "Postcode of the address", +"required": true, +"type": "string" +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"422": { +"description": "Invalid input supplied" +} +} +} +}, +"/address/delete/{id}": { +"delete": { +"tags": [ +"Address" +], +"produces": [ +"application/json" +], +"operationId": "deleteAddress", +"summary": "Delete address", +"description": "", +"parameters": [ +{ +"name": "id", +"in": "path", +"description": "District id", +"required": true, +"type": "string" +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"422": { +"description": "Invalid input supplied" +} +} +} +}, +"/address/district/list": { +"get": { +"tags": [ +"Address" +], +"produces": [ +"application/json" +], +"operationId": "listDistrictAddress", +"summary": "List districts", +"description": "", +"parameters": [ +{ +"name": "filter", +"in": "query", +"description": "Filters", +"required": false, +"type": "array", +"items": { +"type": "string" +} +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"422": { +"description": "Invalid input supplied" +} +} +} +}, +"/address/list": { +"get": { +"tags": [ +"Address" +], +"produces": [ +"application/json" +], +"operationId": "listAddress", +"summary": "List addresses of logged in user", +"description": "", +"parameters": [ +{ +"name": "filter", +"in": "query", +"description": "Filters", +"required": false, +"type": "array", +"items": { +"type": "string" +} +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"422": { +"description": "Invalid input supplied" +} +} +} +}, +"/address/{id}/show": { +"get": { +"tags": [ +"Address" +], +"produces": [ +"application/json" +], +"operationId": "showAddress", +"summary": "List addresses of logged in user", +"description": "", +"parameters": [ +{ +"name": "id", +"in": "path", +"description": "Address id", +"required": true, +"type": "integer" +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"422": { +"description": "Invalid input supplied" +} +} +} +}, +"/address/{id}/default": { +"put": { +"tags": [ +"Address" +], +"produces": [ +"application/json" +], +"operationId": "setDefaultAddress", +"summary": "Set default address", +"description": "", +"parameters": [ +{ +"name": "id", +"in": "path", +"description": "Address id", +"required": true, +"type": "integer" +}, +{ +"name": "district_id", +"in": "query", +"description": "District id", +"required": true, +"type": "integer" +}, +{ +"name": "street_one", +"in": "query", +"description": "Address line 1", +"required": true, +"type": "string" +}, +{ +"name": "street_two", +"in": "query", +"description": "Address line 2", +"required": true, +"type": "string" +}, +{ +"name": "post_code", +"in": "query", +"description": "Postcode of the address", +"required": true, +"type": "string" +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"422": { +"description": "Invalid input supplied" +} +} +} +}, +"/address/update/{id}": { +"put": { +"tags": [ +"Address" +], +"produces": [ +"application/json" +], +"operationId": "setDefaultAddress", +"summary": "Set default address", +"description": "", +"parameters": [ +{ +"name": "id", +"in": "path", +"description": "Address id", +"required": true, +"type": "integer" +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"422": { +"description": "Invalid input supplied" +} +} +} +}, +"/account/authentication/login/check_email": { +"post": { +"tags": [ +"Account", +"Flow - Registration" +], +"summary": "Check if email registered", +"description": "", +"operationId": "userList", +"produces": [ +"application/json", +"application/xml" +], +"parameters": [ +{ +"name": "email", +"in": "query", +"description": "email", +"required": true, +"type": "string" +} +], +"responses": { +"default": { +"description": "successful operation" +} +} +} +}, +"/account/registration/registration": { +"post": { +"tags": [ +"Account", +"Flow - Registration" +], +"produces": [ +"application/json" +], +"summary": "Register user into the system", +"description": "", +"parameters": [ +{ +"name": "name", +"in": "query", +"description": "The name of user", +"required": true, +"type": "string" +}, +{ +"name": "email", +"in": "query", +"description": "The email for login", +"required": true, +"type": "string", +"format": "email" +}, +{ +"name": "password", +"in": "query", +"description": "The password for login", +"required": true, +"type": "string", +"format": "password" +}, +{ +"name": "password_confirmation", +"in": "query", +"description": "The confirmation password for login", +"required": true, +"type": "string", +"format": "password" +}, +{ +"name": "type", +"in": "query", +"description": "Company Type - PERSONAL_BUSINESS:0 , COMPANY_BUSINESS:1", +"required": true, +"type": "integer" +}, +{ +"name": "phone", +"in": "query", +"description": "Contact phone number", +"required": true, +"type": "string" +}, +{ +"name": "contact_email", +"in": "query", +"description": "Contact email", +"required": true, +"type": "string" +}, +{ +"name": "company_name", +"in": "query", +"description": "The company name - if not defined , name of user will save as the company name", +"required": false, +"type": "string" +}, +{ +"name": "business_type", +"in": "query", +"description": "Business Type - FREIGHT_FORWARDER:1, IMPORTER:2, CURRENCY_VENDOR:3, WAREHOUSE:4", +"required": false, +"default": 2, +"type": "integer" +}, +{ +"name": "wechat_id", +"in": "query", +"description": "Contact Wechat id", +"required": false, +"type": "string" +}, +{ +"name": "files[0]", +"in": "query", +"description": "File need to convert to base64 example : 'data:application/pdf;base64,{Base64}';", +"required": true, +"type": "string" +}, +{ +"name": "identification_no", +"in": "query", +"description": "Personal identification no or company registration no", +"required": true, +"type": "string" +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"400": { +"description": "Invalid username/password supplied" +} +} +} +}, +"/account/authentication/login/attempt": { +"post": { +"tags": [ +"Account" +], +"produces": [ +"application/json" +], +"summary": "Logs user into the system", +"operationId": "aaa", +"description": "", +"parameters": [ +{ +"name": "email", +"in": "query", +"description": "The user name for login", +"required": true, +"type": "string" +}, +{ +"name": "password", +"in": "query", +"description": "The password for login in clear text", +"required": true, +"type": "string" +} +], +"responses": { +"200": { +"description": "successful operation", +"headers": { +"X-Expires-After": { +"type": "string", +"format": "date-time", +"description": "date in UTC when token expires" +}, +"X-Rate-Limit": { +"type": "integer", +"format": "int32", +"description": "calls per hour allowed by the user" +} +}, +"schema": { +"type": "string" +} +}, +"400": { +"description": "Invalid username/password supplied" +} +} +} +}, +"/account/authentication/logout": { +"get": { +"tags": [ +"Account" +], +"summary": "Logs out current logged in user session", +"description": "", +"operationId": "logoutUser", +"produces": [ +"application/json", +"application/xml" +], +"parameters": [], +"responses": { +"default": { +"description": "successful operation" +} +} +} +}, +"/account/user/list": { +"get": { +"tags": [ +"Account" +], +"summary": "Logs out current logged in user session", +"description": "", +"operationId": "userList", +"produces": [ +"application/json", +"application/xml" +], +"parameters": [], +"responses": { +"default": { +"description": "successful operation" +} +} +} +}, +"/company/list": { +"get": { +"tags": [ +"Company" +], +"summary": "List of Companies", +"description": "example filters={\"WithCompanyModuleType\":4,\"order_by\":{\"column\":\"id\",\"DESC\":true}} | to get list of company with company_module.Type(business type) = 4(Warehouse)", +"operationId": "companyList", +"produces": [ +"application/json", +"application/xml" +], +"parameters": [ +{ +"name": "filters", +"in": "query", +"description": "Eloquent Filter", +"required": false, +"type": "array", +"items": { +"type": "string" +} +} +], +"responses": { +"default": { +"description": "successful operation" +} +} +} +}, +"/company/create": { +"post": { +"tags": [ +"Company" +], +"summary": "Create company", +"description": "", +"operationId": "companyCreate", +"produces": [ +"application/json", +"application/xml" +], +"parameters": [ +{ +"name": "type", +"in": "query", +"description": "Company Type - PERSONAL_BUSINESS:0 , COMPANY_BUSINESS:1", +"required": true, +"type": "integer", +"enum": [ +0, +1 +] +}, +{ +"name": "business_type", +"in": "query", +"description": "Business Type - FREIGHT_FORWARDER:1, IMPORTER:2, CURRENCY_VENDOR:3, WAREHOUSE:4", +"required": true, +"type": "integer", +"enum": [ +1, +2, +3, +4 +] +}, +{ +"name": "name", +"in": "query", +"description": "Fill in name if type = 0", +"required": false, +"type": "string" +}, +{ +"name": "name", +"in": "query", +"description": "Fill in name if type = 0", +"required": false, +"type": "string" +}, +{ +"name": "company_name", +"in": "query", +"description": "Fill in company_name if type = 1", +"required": false, +"type": "string" +} +], +"responses": { +"default": { +"description": "successful operation" +} +} +} +} +}, +"securityDefinitions": { +"Authorization": { +"type": "apiKey", +"name": "api_key", +"in": "header" +}, +"petstore_auth": { +"type": "oauth2", +"authorizationUrl": "https://petstore.swagger.io/oauth/authorize", +"flow": "implicit", +"scopes": { +"read:pets": "read your pets", +"write:pets": "modify pets in your account" +} +} +}, +"definitions": { +"ApiResponse": { +"type": "object", +"properties": { +"code": { +"type": "integer", +"format": "int32" +}, +"title": { +"type": "string" +}, +"message": { +"type": "string" +}, +"payload": { +"type": "object" +} +} +} +} +} diff --git a/routes/api.php b/routes/api.php index 351c0f24..cf91126b 100644 --- a/routes/api.php +++ b/routes/api.php @@ -40,8 +40,8 @@ Route::group(['middleware' => 'api', 'prefix' => 'v1', 'as' => 'api.'], function // // require __DIR__ . '/bank.php'; // -// require __DIR__ . '/booking.php'; -// + require __DIR__ . '/order.php'; + require __DIR__ . '/currency.php'; require __DIR__ . '/address.php'; diff --git a/routes/order.php b/routes/order.php new file mode 100644 index 00000000..738d8a21 --- /dev/null +++ b/routes/order.php @@ -0,0 +1,21 @@ + 'order', 'as' => 'order.', 'namespace' => 'Orders'], function () { + #Route::get('/{id}/show', 'FetchOrderController@fetch')->name('show'); + #Route::get('/list', 'ListOrdersController@list')->name('list'); + Route::post('/create', 'CreateOrderController@create')->name('create'); + Route::put('/confirm/{id}', 'ConfirmOrderController@confirm')->name('confirm'); + #Route::put('/update/{id}', 'UpdateOrderController@update')->name('update'); + #Route::delete('/delete/{id}', 'DeleteOrderController@destroy')->name('delete'); + + + Route::group(['prefix' => '{id}/step', 'as' => 'step.'], function () { + + Route::post('/complete', 'CompletesOrderStepsController@complete')->name('create'); + + }); + + Route::group(['prefix' => '{id}/role', 'as' => 'role.'], function () {}); +}); \ No newline at end of file