mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-09-01 02:44:13 +00:00
Orders APIs WIP
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user