Add integrations health monitoring
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-01-02 18:35:12 +01:00
parent 9057a4cd15
commit fc3e6715db
21 changed files with 715 additions and 13 deletions

View File

@@ -3,6 +3,7 @@
namespace Tests\Feature;
use App\Models\CheckoutSession;
use App\Models\IntegrationWebhookEvent;
use App\Models\Package;
use App\Models\PackagePurchase;
use App\Models\Tenant;
@@ -25,6 +26,7 @@ class PaddleWebhookControllerTest extends TestCase
[$tenant, $package, $session] = $this->prepareSession();
$payload = [
'event_id' => 'evt_123',
'event_type' => 'transaction.completed',
'data' => [
'id' => 'txn_123',
@@ -56,6 +58,13 @@ class PaddleWebhookControllerTest extends TestCase
$response->assertOk()->assertJson(['status' => 'processed']);
$this->assertDatabaseHas('integration_webhook_events', [
'provider' => 'paddle',
'event_id' => 'evt_123',
'event_type' => 'transaction.completed',
'status' => IntegrationWebhookEvent::STATUS_PROCESSED,
]);
$session->refresh();
$this->assertEquals(CheckoutSession::STATUS_COMPLETED, $session->status);

View File

@@ -3,6 +3,7 @@
namespace Tests\Feature;
use App\Jobs\ProcessRevenueCatWebhook;
use App\Models\IntegrationWebhookEvent;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Bus;
use Tests\TestCase;
@@ -17,6 +18,7 @@ class RevenueCatWebhookTest extends TestCase
$payload = [
'event' => [
'type' => 'INITIAL_PURCHASE',
'app_user_id' => 'tenant-123',
'product_id' => 'pro_month',
],
@@ -28,12 +30,20 @@ class RevenueCatWebhookTest extends TestCase
Bus::fake();
$response = $this->postJson('/api/v1/webhooks/revenuecat', $payload, [
'X-Event-Id' => 'evt_123',
'X-Signature' => $signature,
]);
$response->assertStatus(202)
->assertJson(['status' => 'accepted']);
$this->assertDatabaseHas('integration_webhook_events', [
'provider' => 'revenuecat',
'event_id' => 'evt_123',
'event_type' => 'INITIAL_PURCHASE',
'status' => IntegrationWebhookEvent::STATUS_RECEIVED,
]);
Bus::assertDispatched(ProcessRevenueCatWebhook::class);
}
@@ -53,6 +63,8 @@ class RevenueCatWebhookTest extends TestCase
->assertJsonPath('error.code', 'signature_invalid')
->assertJsonPath('error.title', 'Invalid Signature');
$this->assertDatabaseCount('integration_webhook_events', 0);
Bus::assertNotDispatched(ProcessRevenueCatWebhook::class);
}
}

View File

@@ -43,6 +43,7 @@ class SuperAdminNavigationGroupsTest extends TestCase
\App\Filament\SuperAdmin\Pages\WatermarkSettingsPage::class => 'admin.nav.branding',
\App\Filament\SuperAdmin\Pages\DokployDeployments::class => 'admin.nav.infrastructure',
\App\Filament\SuperAdmin\Pages\OpsHealthDashboard::class => 'admin.nav.infrastructure',
\App\Filament\SuperAdmin\Pages\IntegrationsHealthDashboard::class => 'admin.nav.infrastructure',
];
foreach ($expectations as $resourceClass => $key) {
@@ -57,6 +58,7 @@ class SuperAdminNavigationGroupsTest extends TestCase
\App\Filament\Clusters\DailyOps\Resources\TenantPaddleHealths\TenantPaddleHealthResource::class => DailyOpsCluster::class,
\App\Filament\Resources\TenantFeedbackResource::class => DailyOpsCluster::class,
\App\Filament\SuperAdmin\Pages\OpsHealthDashboard::class => DailyOpsCluster::class,
\App\Filament\SuperAdmin\Pages\IntegrationsHealthDashboard::class => DailyOpsCluster::class,
\App\Filament\Resources\TaskResource::class => WeeklyOpsCluster::class,
\App\Filament\Resources\EmotionResource::class => WeeklyOpsCluster::class,
\App\Filament\Resources\EventTypeResource::class => WeeklyOpsCluster::class,