mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-19 04:24:12 +00:00
32 lines
1006 B
PHP
32 lines
1006 B
PHP
<?php
|
|
|
|
namespace App\Classes\Modules\Unity\Services;
|
|
|
|
use Config;
|
|
use Illuminate\Support\Facades\Http;
|
|
use App\Classes\Modules\Unity\Services\GetAccessToken;
|
|
|
|
class CreatesContractEntity
|
|
{
|
|
private $getAccessToken;
|
|
|
|
private $createContractEntityEndpoint;
|
|
|
|
private $contract_hash_id;
|
|
|
|
public function __construct(GetAccessToken $getAccessToken)
|
|
{
|
|
$this->createContractEntityEndpoint = Config::get('unity.url').Config::get('unity.endpoint.create_contract_entity');
|
|
$this->getAccessToken = $getAccessToken;
|
|
$this->contract_hash_id = Config::get('unity.contract_template_hash_id');
|
|
}
|
|
|
|
public function execute(string $new_contract_id, string $entity_hash_ids){
|
|
|
|
$accesToken=$this->getAccessToken->execute();
|
|
$response = Http::withToken($accesToken)->post($this->createContractEntityEndpoint,['contract_id'=>[$new_contract_id],'entity_id'=>$entity_hash_ids])->object();
|
|
return (isset($response->data)) ? $response->data : null;
|
|
|
|
}
|
|
}
|