<?php
chdir(__DIR__);
require_once 'vendor/autoload.php';

$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
    ]
]);

$methodId = '1dd098fa-5d63-4c8d-88b7-3c27ffbbb6ae';

try {
    $response = $client->get("payment-methods/$methodId");
    $method = json_decode($response->getBody(), true);
    echo "Method ID: $methodId\n";
    echo "Name: " . $method['name'] . "\n";
} catch (\Exception $e) {
    echo "ERROR: " . $e->getMessage() . "\n";
}
