mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-26 07:54:18 +00:00
Created contract at Unity
This commit is contained in:
@@ -4,18 +4,18 @@ namespace App\Classes\Modules\Unity\Processors;
|
||||
|
||||
use Config;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Classes\Modules\Unity\Services\GetContractObligations;
|
||||
use App\Classes\Modules\Unity\Services\CreatesContract;
|
||||
|
||||
class CreateContractProcessor
|
||||
{
|
||||
private $getContractObligations;
|
||||
private $createsContract;
|
||||
|
||||
public function __construct(GetContractObligations $getContractObligations)
|
||||
public function __construct(CreatesContract $createsContract)
|
||||
{
|
||||
$this->getContractObligations = $getContractObligations;
|
||||
$this->createsContract = $createsContract;
|
||||
}
|
||||
|
||||
public function execute(){
|
||||
return $this->getContractObligations->execute();
|
||||
return $this->createsContract->execute();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 CreatesContract
|
||||
{
|
||||
private $getAccessToken;
|
||||
|
||||
private $createEntityEndpoint;
|
||||
|
||||
private $contract_hash_id;
|
||||
|
||||
public function __construct(GetAccessToken $getAccessToken)
|
||||
{
|
||||
$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');
|
||||
}
|
||||
|
||||
public function execute(){
|
||||
|
||||
$accesToken=$this->getAccessToken->execute();
|
||||
|
||||
$response = Http::withToken($accesToken)->post($this->createEntityEndpoint,['contract_template_id'=>[$this->contract_hash_id]])->object();
|
||||
|
||||
return (isset($response->data)) ? $response->data : null;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user