From 7492a77084b29a0536ae27f2996c775d41dede75 Mon Sep 17 00:00:00 2001 From: Miguel Vargas Date: Thu, 26 Oct 2023 18:58:03 -0500 Subject: [PATCH] refactor: remove metric utility --- plugin/src/Telemetry/PluginVersion.php | 88 -------------------------- 1 file changed, 88 deletions(-) delete mode 100644 plugin/src/Telemetry/PluginVersion.php diff --git a/plugin/src/Telemetry/PluginVersion.php b/plugin/src/Telemetry/PluginVersion.php deleted file mode 100644 index 73f9a982..00000000 --- a/plugin/src/Telemetry/PluginVersion.php +++ /dev/null @@ -1,88 +0,0 @@ -client = new \SoapClient($this->soapUri); - } catch (\Exception $exception) { - } - } - - public function registerVersion($commerceCode, $pluginVersion, $ecommerceVersion, $ecommerceId, $environment, $product) - { - $log = new LogHandler(); - $log->logInfo('AQUI SE GUARDO ALGO DE INFORMACION'); - - $this->sendMetrics($commerceCode, $pluginVersion, $ecommerceVersion, $ecommerceId, $environment, $product); // Metricas TBK - - if ($this->client === null) { - return null; - } - - try { - return $this->client->version_register($commerceCode, $pluginVersion, $ecommerceVersion, $ecommerceId, $environment, $product); - } catch (\Exception $e) { - // Si la conexión falla, simplemente no hacer nada. - } - - return null; - } - - public function sendMetrics($commerceCode, $pluginVersion, $ecommerceVersion, $ecommerceId, $environment, $product) - { - try { - - $log = new LogHandler(); - - $log->logInfo(':: Metrics'); - $log->logInfo($commerceCode); - - $webpayPayload = [ - 'ecommerceId' => $ecommerceId, - 'plugin' => 'WooCommerce', - 'environment' => $environment, - 'product' => $product, - 'pluginVersion' => $pluginVersion, - 'commerceCode' => $commerceCode, - 'phpVersion' => phpversion(), - 'ecommerceVersion' => $ecommerceVersion - ]; - - $client = new Client(); - - $client->request('POST', 'https://tbk-app-y8unz.ondigitalocean.app/records/newRecord', ['form_params' => $webpayPayload]); - - $log->logInfo(':: Saved'); - } catch (\Exception $e) { - $log->logError($e->getMessage()); - } - } -}