mirror of
https://gitlab.com/omair-personal/izyim.git
synced 2026-08-19 04:14:05 +00:00
38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\ControllersLogic\FreightForwarder;
|
|
|
|
use App\Classes\Modules\ControllerLogic\Exceptions\InternalServerErrorException;
|
|
use App\Classes\Modules\FreightForwarder\DataTransferObjects\CustomerRelationObject;
|
|
use App\Classes\Modules\FreightForwarder\Services\UpdatesCustomerRelation;
|
|
use App\Classes\ValueObjects\Constants\HttpStatus;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Request;
|
|
|
|
class UpdateCustomerRelationLogic
|
|
{
|
|
/** @var UpdatesCustomerRelation */
|
|
private $updatesCustomerRelation;
|
|
|
|
/**
|
|
* UpdateCustomerRelationLogic constructor.
|
|
* @param UpdatesCustomerRelation $updatesCustomerRelation
|
|
*/
|
|
public function __construct(UpdatesCustomerRelation $updatesCustomerRelation)
|
|
{
|
|
$this->updatesCustomerRelation = $updatesCustomerRelation;
|
|
}
|
|
|
|
public function execute(Request $request){
|
|
|
|
try{
|
|
|
|
$object = new CustomerRelationObject($request->input('forwarder_id'), $request->input('company_id'), $request->input('customer_rate'), $request->input('wave'));
|
|
return $this->updatesCustomerRelation->execute($object);
|
|
return new JsonResponse([], HttpStatus::REQUEST_ACCEPTED);
|
|
|
|
}catch(\Exception $exception){
|
|
throw new InternalServerErrorException("Failed to update Customer Relation because{$exception->getMessage()}");
|
|
}
|
|
}
|
|
} |