diff --git a/app/DataMapper/Analytics/LegalEntityCreated.php b/app/DataMapper/Analytics/LegalEntityCreated.php new file mode 100644 index 000000000000..781a3b45e1a3 --- /dev/null +++ b/app/DataMapper/Analytics/LegalEntityCreated.php @@ -0,0 +1,83 @@ +string_metric7 = $string_metric7; + $this->string_metric8 = $string_metric8; + } +} diff --git a/app/Services/EDocument/Gateway/Storecove/Storecove.php b/app/Services/EDocument/Gateway/Storecove/Storecove.php index ef7bf4de2279..0c35dacf55ec 100644 --- a/app/Services/EDocument/Gateway/Storecove/Storecove.php +++ b/app/Services/EDocument/Gateway/Storecove/Storecove.php @@ -11,11 +11,13 @@ namespace App\Services\EDocument\Gateway\Storecove; +use App\DataMapper\Analytics\LegalEntityCreated; use App\Models\Company; use Illuminate\Support\Facades\Http; use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ServerException; use Illuminate\Http\Client\RequestException; +use Turbo124\Beacon\Facades\LightLogs; enum HttpVerb: string { @@ -240,6 +242,8 @@ class Storecove public function getLegalEntity($id) { + // $uri = "legal_entities"; + $uri = "legal_entities/{$id}"; $r = $this->httpClient($uri, (HttpVerb::GET)->value, []); @@ -297,7 +301,11 @@ class Storecove $r = $this->httpClient($uri, (HttpVerb::POST)->value, $data); if($r->successful()) { - return $r->json(); + $data = $r->json(); + + LightLogs::create(new LegalEntityCreated($data['id'], $legal_entity_id))->batch(); + + return $data; } return $r; @@ -347,10 +355,7 @@ class Storecove nlog("Server error: " . $e->getMessage()); nlog("Response body: " . $e->getResponse()->getBody()->getContents()); } catch (RequestException $e) { - nlog("Request error: " . $e->getMessage()); - if ($e->hasResponse()) { - nlog("Response body: " . $e->getResponse()->getBody()->getContents()); - } + nlog("Request error: {$e->getCode()}: " . $e->getMessage()); } return $r;