mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-29 01:14:14 +00:00
YD curl request
This commit is contained in:
@@ -4,28 +4,37 @@ namespace App\Classes\Modules\Unity\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Classes\Modules\Unity\Services\GetAccessToken;
|
||||
|
||||
class CreatesContract
|
||||
{
|
||||
/** @var GetAccessToken */
|
||||
private $getAccessToken;
|
||||
|
||||
private $createEntityEndpoint;
|
||||
/** @var string */
|
||||
private $createContract;
|
||||
|
||||
/** @var string */
|
||||
private $contract_hash_id;
|
||||
|
||||
public function __construct(GetAccessToken $getAccessToken)
|
||||
/**
|
||||
* CreatesContract constructor.
|
||||
* @param GetAccessToken $getAccessToken
|
||||
* @param string $createContract
|
||||
* @param string $contract_hash_id
|
||||
*/
|
||||
public function __construct(GetAccessToken $getAccessToken, string $createContract, string $contract_hash_id)
|
||||
{
|
||||
$this->createEntityEndpoint = Config::get('unity.url').Config::get('unity.endpoint.create_contract');
|
||||
$this->getAccessToken = $getAccessToken;
|
||||
$this->contract_hash_id = Config::get('unity.contract_template_hash_id');
|
||||
$this->createContract = $createContract;
|
||||
$this->contract_hash_id = $contract_hash_id;
|
||||
}
|
||||
|
||||
|
||||
public function execute(){
|
||||
|
||||
$accessToken=$this->getAccessToken->execute();
|
||||
|
||||
$response = Http::withToken($accessToken)->post($this->createEntityEndpoint,['contract_template_id'=>[$this->contract_hash_id]])->object();
|
||||
$response = Http::withToken($accessToken)->post($this->createContract,['contract_template_id'=>[$this->contract_hash_id]])->object();
|
||||
dd($response);
|
||||
return $response->data;
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Classes\Modules\Unity\Services;
|
||||
|
||||
use Config;
|
||||
use Cache;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
|
||||
class GetAccessToken
|
||||
|
||||
Reference in New Issue
Block a user