siip-whatsapp-notifications.../find_attribute_id.php
2026-02-11 11:28:12 -06:00

34 lines
973 B
PHP
Executable File

<?php
chdir(__DIR__);
require_once 'vendor/autoload.php';
use Ubnt\UcrmPluginSdk\Service\UcrmApi;
use Ubnt\UcrmPluginSdk\Service\PluginConfigManager;
$ucrmConfig = json_decode(file_get_contents('ucrm.json'), true);
$ucrmUrl = $ucrmConfig['ucrmLocalUrl'] ?? 'http://localhost';
$appKey = $ucrmConfig['pluginAppKey'];
$client = new \GuzzleHttp\Client([
'base_uri' => rtrim($ucrmUrl, '/') . '/api/v1.0/',
'verify' => false,
'headers' => [
'X-Auth-App-Key' => $appKey
]
]);
try {
$response = $client->get('custom-attributes');
$attributes = json_decode($response->getBody(), true);
foreach ($attributes as $attr) {
if ($attr['key'] === 'tipoPagoStripe') {
echo "FOUND: ID=" . $attr['id'] . " Name='" . $attr['name'] . "' Type=" . $attr['attributeType'] . "\n";
exit(0);
}
}
echo "NOT FOUND: tipoPagoStripe\n";
} catch (\Exception $e) {
echo "ERROR: " . $e->getMessage() . "\n";
}