mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-19 12:34:03 +00:00
39 lines
1.5 KiB
PHP
39 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\ControllersLogic\FreightForwarder;
|
|
|
|
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
|
use App\Classes\Modules\FreightForwarder\DataTransferObjects\FreightForwarderObject;
|
|
use App\Classes\Modules\FreightForwarder\Services\UpdatesFreightForwarder;
|
|
use App\Classes\ValueObjects\Constants\HttpStatus;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class UpdateFreightForwarderLogic
|
|
{
|
|
/** @var UpdatesFreightForwarder */
|
|
private $updatesFreightForwarder;
|
|
|
|
/**
|
|
* UpdateFreightForwarderLogic constructor.
|
|
* @param UpdatesFreightForwarder $updatesFreightForwarder
|
|
*/
|
|
public function __construct(UpdatesFreightForwarder $updatesFreightForwarder)
|
|
{
|
|
$this->updatesFreightForwarder = $updatesFreightForwarder;
|
|
}
|
|
|
|
|
|
public function execute(String $forwarderId, Request $request){
|
|
|
|
try{
|
|
$object = new FreightForwarderObject(null, null, null, null, null, null,null, null, $request->input('shipping_rate'), $request->input('overdue_days'), $request->input('markup_percentage'), $request->input('minimum_cbm'));
|
|
return $this->updatesFreightForwarder->execute($forwarderId, $object);
|
|
return new JsonResponse([],HttpStatus::REQUEST_ACCEPTED);
|
|
|
|
}catch(\Exception $exception){
|
|
|
|
throw new InternalServerErrorException("Failed to update Freight Forwarder because{$exception->getMessage()}");
|
|
}
|
|
}
|
|
} |