mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
33 lines
948 B
PHP
33 lines
948 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Unity\Services;
|
|
|
|
use Config;
|
|
use Illuminate\Support\Facades\Http;
|
|
use App\Classes\Modules\Unity\Services\GetAccessToken;
|
|
|
|
class UpdatesContractEntity
|
|
{
|
|
private $getAccessToken;
|
|
|
|
private $assignEntityEndpoint;
|
|
|
|
public function __construct(GetAccessToken $getAccessToken)
|
|
{
|
|
$this->assignEntityEndpoint = Config::get('unity.url').Config::get('unity.endpoint.assign_entity');
|
|
$this->getAccessToken = $getAccessToken;
|
|
}
|
|
|
|
public function execute(string $obligation_hash_id, array $entity_hash_id){
|
|
|
|
$accessToken=$this->getAccessToken->execute();
|
|
|
|
$this->assignEntityEndpoint = str_replace('{hash}',$obligation_hash_id,$this->assignEntityEndpoint);
|
|
|
|
$response = Http::withToken($accessToken)->put( $this->assignEntityEndpoint,['contract_entity_id'=>$entity_hash_id])->object();
|
|
|
|
return (isset($response->data)) ? $response->data : null;
|
|
|
|
}
|
|
}
|