mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 20:44:03 +00:00
59 lines
1.3 KiB
PHP
59 lines
1.3 KiB
PHP
<?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);
|
|
}
|
|
|
|
|
|
} |