mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-27 08:24:39 +00:00
Assign contract obligations at Unity
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?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();
|
||||
|
||||
dd($response);
|
||||
return (isset($response->data)) ? $response->data : null;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user