Implement WHMCS Addon Dashboard with API for stats and integrate billing provider logic
Some checks failed
CI / Node — lint, typecheck, test, build (push) Failing after 10s
CI / Go — node-agent tests (push) Failing after 8s
CI / Go — edge-gateway build (push) Successful in 17s

This commit is contained in:
smueller
2026-06-26 15:11:29 +02:00
parent 15cf302afc
commit 4b20efe4bc
30 changed files with 1414 additions and 16 deletions

View File

@@ -0,0 +1,42 @@
<?php
if (!defined('WHMCS')) {
die('This file cannot be accessed directly');
}
use WHMCS\Database\Capsule;
/**
* Copy this file to WHMCS includes/hooks/hexagamecloud.php
*/
add_hook('DailyCronJob', 1, function () {
$rows = Capsule::table('tbladdonmodules')
->where('module', 'hexagamecloud')
->pluck('value', 'setting');
$apiUrl = trim((string) ($rows['api_url'] ?? ''));
$integrationId = trim((string) ($rows['integration_id'] ?? ''));
$apiSecret = trim((string) ($rows['api_secret'] ?? ''));
if ($apiUrl === '' || $integrationId === '' || $apiSecret === '') {
return;
}
require_once ROOTDIR . '/modules/addons/hexagamecloud/lib/ApiClient.php';
require_once ROOTDIR . '/modules/addons/hexagamecloud/lib/ModuleStorage.php';
require_once ROOTDIR . '/modules/addons/hexagamecloud/lib/EventPoller.php';
try {
$client = new HexaGameCloudAddonApiClient($apiUrl, $integrationId, $apiSecret);
$storage = new HexaGameCloudModuleStorage();
$limit = (int) ($rows['event_poll_limit'] ?? 50);
$poller = new HexaGameCloudEventPoller($client, $storage, max(1, min($limit, 100)));
$poller->pollAndAcknowledge();
if (!empty($rows['auto_reconcile'])) {
$client->reconcileAll(['dryRun' => true]);
}
} catch (Throwable $exception) {
logActivity('HexaGameCloud cron poll failed: ' . $exception->getMessage());
}
});