Enhance API with OIDC support, including login and callback endpoints. Update environment variables for OIDC configuration in .env.example. Add new features to the catalog service for listing software families, Minecraft versions, and deployment regions. Implement server management actions such as kill, delete, and update in the servers module. Integrate feature flags for maintenance mode in server operations. Update pnpm-lock.yaml with new dependencies and versions.
This commit is contained in:
30
integrations/whmcs/tests/Contract/README.md
Normal file
30
integrations/whmcs/tests/Contract/README.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Contract tests
|
||||
|
||||
Contract tests validate WHMCS module requests and responses against the GameCloud integration API (`/api/v1/integrations/whmcs/*`).
|
||||
|
||||
## Scope
|
||||
|
||||
- Request signing headers (`X-HGC-Integration-ID`, `X-HGC-Signature`, `X-HGC-Idempotency-Key`, …)
|
||||
- Canonical HMAC signature base string
|
||||
- JSON request/response shapes from `packages/contracts/src/whmcs.ts`
|
||||
- Idempotent lifecycle operations (`provision`, `suspend`, `renew`, `change-package`)
|
||||
|
||||
## Running
|
||||
|
||||
Contract tests require a reachable GameCloud API or a recorded mock server. They are not executed in CI by default.
|
||||
|
||||
```bash
|
||||
# From integrations/whmcs after installing dev dependencies:
|
||||
composer install
|
||||
./vendor/bin/phpunit --testsuite Contract
|
||||
```
|
||||
|
||||
## Fixtures
|
||||
|
||||
Sample WHMCS `$params` payloads and signed API examples will live under `tests/Fixtures/` as the contract suite grows.
|
||||
|
||||
## Related
|
||||
|
||||
- OpenAPI / Zod contracts: `packages/contracts/src/whmcs.ts`
|
||||
- Server module client: `modules/servers/hexagamecloud/lib/ApiClient.php`
|
||||
- Addon module client: `modules/addons/hexagamecloud/lib/ApiClient.php`
|
||||
53
integrations/whmcs/tests/Unit/IdempotencyTest.php
Normal file
53
integrations/whmcs/tests/Unit/IdempotencyTest.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
require_once dirname(__DIR__, 2) . '/modules/servers/hexagamecloud/lib/Idempotency.php';
|
||||
|
||||
final class IdempotencyTest extends TestCase
|
||||
{
|
||||
public function testServiceOperationKeyUsesReferenceWhenProvided(): void
|
||||
{
|
||||
$key = HexaGameCloudIdempotency::serviceOperationKey('renew', '12345', 'invoice-99');
|
||||
|
||||
$this->assertSame('service:renew:12345:invoice-99', $key);
|
||||
}
|
||||
|
||||
public function testServiceOperationKeyFallsBackToDateSuffix(): void
|
||||
{
|
||||
$key = HexaGameCloudIdempotency::serviceOperationKey('suspend', '42', null);
|
||||
|
||||
$this->assertStringStartsWith('service:suspend:42:', $key);
|
||||
$this->assertMatchesRegularExpression('/^service:suspend:42:\d{4}-\d{2}-\d{2}$/', $key);
|
||||
}
|
||||
|
||||
public function testRenewKeyPrefersInvoiceId(): void
|
||||
{
|
||||
$key = HexaGameCloudIdempotency::renewKey('9001', [
|
||||
'invoiceid' => '7788',
|
||||
'renewalid' => '5555',
|
||||
]);
|
||||
|
||||
$this->assertSame('service:renew:9001:7788', $key);
|
||||
}
|
||||
|
||||
public function testRenewKeyUsesRenewalIdWhenInvoiceMissing(): void
|
||||
{
|
||||
$key = HexaGameCloudIdempotency::renewKey('9001', [
|
||||
'renewalid' => '5555',
|
||||
]);
|
||||
|
||||
$this->assertSame('service:renew:9001:5555', $key);
|
||||
}
|
||||
|
||||
public function testRenewKeyUsesModelInvoiceId(): void
|
||||
{
|
||||
$key = HexaGameCloudIdempotency::renewKey('9001', [
|
||||
'model' => ['invoiceid' => '6611'],
|
||||
]);
|
||||
|
||||
$this->assertSame('service:renew:9001:6611', $key);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user