mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-23 14:34:19 +00:00
Orders APIs WIP
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Processors;
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\OrderObject;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
|
||||
use App\Classes\Modules\Orders\Services\Steps\CompletesOrderStep;
|
||||
use App\Classes\ValueObjects\Constants\HttpStatus;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
abstract class AbstractStepProcessor
|
||||
{
|
||||
|
||||
abstract function validator(): bool;
|
||||
|
||||
abstract function execute(): JsonResponse;
|
||||
|
||||
/**
|
||||
* @param int $orderId
|
||||
* @param StepObject $step
|
||||
* @return JsonResponse
|
||||
* @throws InternalServerErrorException
|
||||
*/
|
||||
public function handler(int $orderId, StepObject $step) {
|
||||
try {
|
||||
|
||||
if(!$this->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()}");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Processors;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
|
||||
use App\Classes\Modules\Orders\Services\Steps\GenerateOrderSteps;
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class ConfirmsOrder extends AbstractStepProcessor
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
const STEP_REFERENCE = OrderSteps::ORDER_PROCESSING_STEP;
|
||||
|
||||
/** @var int */
|
||||
private $orderId;
|
||||
|
||||
/** @var StepObject */
|
||||
private $step;
|
||||
|
||||
/**
|
||||
* WarehousePackOrder constructor.
|
||||
* @param int $orderId
|
||||
* @param string $completeDate
|
||||
*/
|
||||
public function __construct(int $orderId, string $completeDate = null)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Processors;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
use App\Models\DeliveryArrangement;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class DeliverOrder extends AbstractStepProcessor
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
const STEP_REFERENCE = OrderSteps::ORDER_DELIVERY_STEP;
|
||||
|
||||
/** @var int */
|
||||
private $orderId;
|
||||
|
||||
/** @var StepObject */
|
||||
private $step;
|
||||
|
||||
/**
|
||||
* WarehousePackOrder constructor.
|
||||
* @param int $orderId
|
||||
* @param string $completeDate
|
||||
*/
|
||||
public function __construct(int $orderId, string $completeDate = null)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Processors;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
use App\Models\ShippingArrangement;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class ShipOrder extends AbstractStepProcessor
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
const STEP_REFERENCE = OrderSteps::ORDER_SHIPPING_STEP;
|
||||
|
||||
/** @var int */
|
||||
private $orderId;
|
||||
|
||||
/** @var StepObject */
|
||||
private $step;
|
||||
|
||||
/**
|
||||
* WarehousePackOrder constructor.
|
||||
* @param int $orderId
|
||||
* @param string $completeDate
|
||||
*/
|
||||
public function __construct(int $orderId, string $completeDate = null)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Processors;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class WarehouseArrivalOrder extends AbstractStepProcessor
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
const STEP_REFERENCE = OrderSteps::ORDER_WAREHOUSE_ARRIVAL_STEP;
|
||||
|
||||
/** @var int */
|
||||
private $orderId;
|
||||
|
||||
/** @var StepObject */
|
||||
private $step;
|
||||
|
||||
/**
|
||||
* WarehousePackOrder constructor.
|
||||
* @param int $orderId
|
||||
* @param string $completeDate
|
||||
*/
|
||||
public function __construct(int $orderId, string $completeDate = null)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Processors;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
use App\Models\PackingList;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class WarehousePackOrder extends AbstractStepProcessor
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
const STEP_REFERENCE = OrderSteps::ORDER_WAREHOUSE_PACKING_STEP;
|
||||
|
||||
/** @var int */
|
||||
private $orderId;
|
||||
|
||||
/** @var StepObject */
|
||||
private $step;
|
||||
|
||||
/**
|
||||
* WarehousePackOrder constructor.
|
||||
* @param int $orderId
|
||||
* @param string $completeDate
|
||||
*/
|
||||
public function __construct(int $orderId, string $completeDate = null)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Processors;
|
||||
|
||||
|
||||
use App\Classes\Excel\Import\OrdersExport;
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
use App\Models\Order;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class WarehouseReceivesOrder extends AbstractStepProcessor
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
const STEP_REFERENCE = OrderSteps::ORDER_WAREHOUSE_RECEIVING_STEP;
|
||||
|
||||
/** @var int */
|
||||
private $orderId;
|
||||
|
||||
/** @var StepObject */
|
||||
private $step;
|
||||
|
||||
/**
|
||||
* WarehousePackOrder constructor.
|
||||
* @param int $orderId
|
||||
* @param string $completeDate
|
||||
*/
|
||||
public function __construct(int $orderId, string $completeDate = null)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\Processors;
|
||||
|
||||
|
||||
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
||||
use App\Classes\Modules\Orders\DataTransferObjects\StepObject;
|
||||
use App\Classes\ValueObjects\Constants\OrderSteps;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class WarehouseUnpackingOrder extends AbstractStepProcessor
|
||||
{
|
||||
|
||||
/** @var string */
|
||||
const STEP_REFERENCE = OrderSteps::ORDER_WAREHOUSE_UNPACKING_STEP;
|
||||
|
||||
/** @var int */
|
||||
private $orderId;
|
||||
|
||||
/** @var StepObject */
|
||||
private $step;
|
||||
|
||||
/**
|
||||
* WarehousePackOrder constructor.
|
||||
* @param int $orderId
|
||||
* @param string $completeDate
|
||||
*/
|
||||
public function __construct(int $orderId, string $completeDate = null)
|
||||
{
|
||||
$this->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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateOrderLogic extends AbstractControllerLogic
|
||||
{
|
||||
|
||||
private $createOrderProcessor;
|
||||
|
||||
private $createOrderStepsProcessor;
|
||||
|
||||
public function __construct(CreateOrderProcessor $createOrderProcessor, CreateOrderStepsProcessor $createOrderStepsProcessor)
|
||||
{
|
||||
$this->createOrderProcessor = $createOrderProcessor;
|
||||
$this->createOrderStepsProcessor = $createOrderStepsProcessor;
|
||||
}
|
||||
|
||||
protected function notification():array {
|
||||
return [
|
||||
'title' => 'Created Order',
|
||||
'message' => 'You have successfully created a new Order'
|
||||
];
|
||||
}
|
||||
|
||||
public function logic(Request $request) {
|
||||
$this->createOrderProcessor->execute($request);
|
||||
|
||||
$this->createOrderStepsProcessor->execute($order_id, $request);
|
||||
|
||||
//return resources JSON
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\Modules\Orders\ControllersLogic;
|
||||
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateOrderProcessor
|
||||
{
|
||||
private $canCreateOrder;
|
||||
|
||||
private $createsOrder;
|
||||
|
||||
public function __construct(CanCreateOrder $canCreateOrder, CreatesOrder $createsOrder)
|
||||
{
|
||||
$this->canCreateOrder = $canCreateOrder;
|
||||
$this->createsOrder = $createsOrder;
|
||||
}
|
||||
|
||||
public function execute(Request $request) {
|
||||
|
||||
//Data object
|
||||
|
||||
|
||||
$this->createOrderProcessor->execute($request);
|
||||
|
||||
|
||||
//return resources JSON
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
namespace App\Classes\ValueObjects\Constants;
|
||||
|
||||
|
||||
use App\Classes\Modules\Orders\Processors\ConfirmsOrder;
|
||||
use App\Classes\Modules\Orders\Processors\DeliverOrder;
|
||||
use App\Classes\Modules\Orders\Processors\ShipOrder;
|
||||
use App\Classes\Modules\Orders\Processors\WarehouseArrivalOrder;
|
||||
use App\Classes\Modules\Orders\Processors\WarehousePackOrder;
|
||||
use App\Classes\Modules\Orders\Processors\WarehouseReceivesOrder;
|
||||
use App\Classes\Modules\Orders\Processors\WarehouseUnpackingOrder;
|
||||
|
||||
class OrderSteps
|
||||
{
|
||||
|
||||
public const COMPANY_PROCESSING_CATEGORY = 'processing';
|
||||
public const COMPANY_SHIPPING_CATEGORY = 'shipping';
|
||||
public const COMPANY_RECEIVING_CATEGORY = 'receiving';
|
||||
public const COMPANY_COMPLETE_CATEGORY = 'complete';
|
||||
public const COMPANY_CANCEL_CATEGORY = 'cancel';
|
||||
|
||||
public const ORDER_PROCESSING_STEP = 'PS_PROCESSING';
|
||||
public const ORDER_SHIPPING_STEP = 'PS_SHIPPING';
|
||||
public const ORDER_DELIVERY_STEP = 'PS_DELIVERY';
|
||||
|
||||
public const ORDER_MODULE_WAREHOUSE = 'WAREHOUSE';
|
||||
public const ORDER_WAREHOUSE_RECEIVING_STEP = 'MS_WAREHOUSE_RECEIVING';
|
||||
public const ORDER_WAREHOUSE_PACKING_STEP = 'MS_WAREHOUSE_PACKING';
|
||||
public const ORDER_WAREHOUSE_ARRIVAL_STEP = 'MS_WAREHOUSE_ARRIVAL';
|
||||
public const ORDER_WAREHOUSE_UNPACKING_STEP = 'MS_WAREHOUSE_UNPACKING';
|
||||
|
||||
public const ORDER_MODULE_NO_WAREHOUSE = 'NO_WAREHOUSE';
|
||||
public const ORDER_NO_WAREHOUSE_PENDING_SUPPLIER = 'MS_NO_WAREHOUSE_PENDING_SUPPLIER';
|
||||
|
||||
|
||||
public const ORDER_PRIMARY_STEPS = [
|
||||
OrderSteps::ORDER_PROCESSING_STEP => [
|
||||
'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,
|
||||
];
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Accounts;
|
||||
|
||||
use App\Classes\Modules\ControllersLogic\Orders\CreateOrderLogic;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CreateOrderController
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param CreateOrderLogic $logic
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function create(Request $request, CreateOrderLogic $createOrderLogic): JsonResponse
|
||||
{
|
||||
return $createOrderLogic->execute($request);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -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';
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['prefix' => 'order', 'as' => 'order.', 'namespace' => 'Orders'], function () {
|
||||
Route::get('/{id}/show', 'FetchCompanyController@fetch')->name('show');
|
||||
Route::get('/list', 'ListCompaniesController@list')->name('list');
|
||||
Route::post('/create', 'CreateCompanyController@create')->name('create');
|
||||
Route::put('/update/{id}', 'UpdateCompanyController@update')->name('update');
|
||||
Route::delete('/delete/{id}', 'DeleteCompanyController@destroy')->name('delete');
|
||||
|
||||
|
||||
Route::group(['prefix' => '{id}/step', 'as' => 'step.'], function () {});
|
||||
|
||||
Route::group(['prefix' => '{id}/role', 'as' => 'role.'], function () {});
|
||||
});
|
||||
Reference in New Issue
Block a user