Add integrations health monitoring
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user