feat: implement AI styling foundation and billing scope rework
This commit is contained in:
@@ -48,5 +48,43 @@ class EventAddonsSummaryTest extends TenantTestCase
|
||||
$response->assertOk();
|
||||
$response->assertJsonPath('data.addons.0.key', 'extra_guests_100');
|
||||
$response->assertJsonPath('data.addons.0.extra_guests', 100);
|
||||
$response->assertJsonPath('data.capabilities.ai_styling', false);
|
||||
}
|
||||
|
||||
public function test_event_resource_reports_ai_styling_capability_when_addon_is_completed(): void
|
||||
{
|
||||
$package = Package::factory()->endcustomer()->create([
|
||||
'features' => ['basic_uploads'],
|
||||
]);
|
||||
|
||||
$event = Event::factory()->for($this->tenant)->create([
|
||||
'status' => 'published',
|
||||
]);
|
||||
|
||||
$eventPackage = EventPackage::create([
|
||||
'event_id' => $event->id,
|
||||
'package_id' => $package->id,
|
||||
'purchased_price' => $package->price,
|
||||
'purchased_at' => now(),
|
||||
'used_photos' => 0,
|
||||
'used_guests' => 0,
|
||||
'gallery_expires_at' => now()->addDays(30),
|
||||
]);
|
||||
|
||||
EventPackageAddon::create([
|
||||
'event_package_id' => $eventPackage->id,
|
||||
'event_id' => $event->id,
|
||||
'tenant_id' => $this->tenant->id,
|
||||
'addon_key' => 'ai_styling_unlock',
|
||||
'quantity' => 1,
|
||||
'status' => 'completed',
|
||||
'purchased_at' => now(),
|
||||
]);
|
||||
|
||||
$response = $this->authenticatedRequest('GET', "/api/v1/tenant/events/{$event->slug}");
|
||||
|
||||
$response->assertOk();
|
||||
$response->assertJsonPath('data.capabilities.ai_styling', true);
|
||||
$response->assertJsonPath('data.capabilities.ai_styling_granted_by', 'addon');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user