<?php
require_once __DIR__ . '/vendor/autoload.php';
$config = json_decode(file_get_contents(__DIR__ . '/data/config.json'), true);
$ucrmOptions = [
    'base_uri' => 'https://localhost/crm/api/v1.0/',
    'verify' => false,
    'headers' => [
        'X-Auth-App-Key' => $config['apitoken'],
        'Content-Type' => 'application/json'
    ]
];
$ucrmClient = new \GuzzleHttp\Client($ucrmOptions);

try {
    $res = $ucrmClient->patch('payments/1030', [
        'json' => ['methodId' => 'b01c0b35-b42c-48d9-9ad9-ea6591adfbbb']
    ]);
    echo "Success: " . $res->getStatusCode() . "\n";
} catch (\Throwable $e) {
    echo "Error: " . $e->getMessage() . "\n";
}
