mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-31 10:24:07 +00:00
WIP - Order steps & remaining APIs
This commit is contained in:
+6
-20
@@ -6,7 +6,6 @@ namespace App\Classes\Modules\ContainerPackingLists\ControllersLogic;
|
||||
use App\Classes\General\Abstracts\AbstractControllerLogic;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\UpdatesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\FetchesContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\Services\FetchesDistrict;
|
||||
use App\Classes\Modules\ContainerPackingLists\Standards\Rules\CanUpdateContainerPackingList;
|
||||
use App\Classes\Modules\ContainerPackingLists\DataTransferObjects\ContainerPackingListObject;
|
||||
use App\Http\Resources\ContainerPackingListResource;
|
||||
@@ -36,22 +35,17 @@ class UpdateContainerPackingListLogic extends AbstractControllerLogic
|
||||
/** @var FetchesContainerPackingList */
|
||||
private $fetchesContainerPackingList;
|
||||
|
||||
/** @var FetchesDistrict */
|
||||
private $fetchesDistrict;
|
||||
|
||||
/**
|
||||
* UpdateContainerPackingListLogic constructor.
|
||||
* @param CanUpdateContainerPackingList $canUpdateContainerPackingList
|
||||
* @param UpdatesContainerPackingList $updatesContainerPackingList
|
||||
* @param FetchesContainerPackingList $fetchesContainerPackingList
|
||||
* @param FetchesDistrict $fetchesDistrict
|
||||
*/
|
||||
public function __construct(CanUpdateContainerPackingList $canUpdateContainerPackingList, UpdatesContainerPackingList $updatesContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList, FetchesDistrict $fetchesDistrict)
|
||||
public function __construct(CanUpdateContainerPackingList $canUpdateContainerPackingList, UpdatesContainerPackingList $updatesContainerPackingList, FetchesContainerPackingList $fetchesContainerPackingList)
|
||||
{
|
||||
$this->canUpdateContainerPackingList = $canUpdateContainerPackingList;
|
||||
$this->updatesContainerPackingList = $updatesContainerPackingList;
|
||||
$this->fetchesContainerPackingList = $fetchesContainerPackingList;
|
||||
$this->fetchesDistrict = $fetchesDistrict;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,24 +56,16 @@ class UpdateContainerPackingListLogic extends AbstractControllerLogic
|
||||
*/
|
||||
public function logic(Request $request) : JsonResponse
|
||||
{
|
||||
try {
|
||||
|
||||
$district = $this->fetchesDistrict->execute(['id' => $request->input('district_id')]);
|
||||
$object = new ContainerPackingListObject($request->input('street_one'), $request->input('street_two'), $district->country_id, $district->state_id, $district->id, $request->input('post_code'));
|
||||
//$object = new ContainerPackingListObject($request->input('company_id'), $request->input('street_one'), $request->input('street_two'), $request->input('city'), $request->input('state'), $request->input('post_code'), $request->input('country'), $request->input('default'), $request->input('billing'));
|
||||
$container = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]);
|
||||
|
||||
$this->canUpdateContainerPackingList->passes($object);
|
||||
$object = new ContainerPackingListObject( $container->packing_list_id , $request->input('container_reference'), $request->input('container_type'), $request->input('seal_reference'));
|
||||
|
||||
$query = $this->fetchesContainerPackingList->execute(['id' => $request->route('id')]);
|
||||
$this->canUpdateContainerPackingList->passes($object);
|
||||
|
||||
$query = $this->updatesContainerPackingList->execute($query, $object);
|
||||
$query = $this->updatesContainerPackingList->execute($container, $object);
|
||||
|
||||
return $this->resourceResponse(new ContainerPackingListResource($query));
|
||||
|
||||
|
||||
} catch (\Exception $exception){
|
||||
throw new ErrorException($exception->getMessage(), $exception->getCode());
|
||||
}
|
||||
return $this->resourceResponse(new ContainerPackingListResource($query));
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user