Tighten Pro alert caps and move custom badges to Enterprise.
Deploy Ladill Frontdesk / deploy (push) Has been cancelled

Pro includes 5,000 email and 5,000 SMS host alerts per month with hard
monthly caps; Enterprise is unlimited. Custom badge templates are
Enterprise-only, and plan benefit copy matches the new limits.
This commit is contained in:
isaacclad
2026-07-16 08:37:06 +00:00
parent 4ce45f4989
commit b6f229ab9a
12 changed files with 298 additions and 29 deletions
@@ -242,7 +242,7 @@ class FrontdeskNotificationBillingTest extends TestCase
->assertSee('Upgrade to Pro');
}
public function test_pro_plan_emails_record_usage_without_wallet_debit(): void
public function test_pro_plan_emails_within_allowance_skip_wallet_debit(): void
{
Http::fake([
'billing.test/can-afford*' => Http::response(['affordable' => true]),
@@ -260,7 +260,7 @@ class FrontdeskNotificationBillingTest extends TestCase
NotificationUsage::create([
'organization_id' => $this->organization->id,
'period' => now()->format('Y-m'),
'email_count' => 10_000,
'email_count' => 4_999,
]);
$host = Host::create([
@@ -284,10 +284,96 @@ class FrontdeskNotificationBillingTest extends TestCase
Http::assertNotSent(fn ($request) => str_contains($request->url(), '/debit'));
$usage = NotificationUsage::where('organization_id', $this->organization->id)->first();
$this->assertSame(10_001, $usage->email_count);
$this->assertSame(5_000, $usage->email_count);
$this->assertSame(0, $usage->email_charged_minor);
}
public function test_pro_plan_stops_email_after_monthly_allowance(): void
{
Http::fake([
'billing.test/can-afford*' => Http::response(['affordable' => true]),
'billing.test/debit' => Http::response(['ok' => true]),
'*/api/smtp/send' => Http::response(['success' => true]),
]);
$this->organization->update([
'settings' => array_merge($this->organization->settings ?? [], [
'plan' => 'pro',
'plan_expires_at' => now()->addMonth()->toIso8601String(),
]),
]);
NotificationUsage::create([
'organization_id' => $this->organization->id,
'period' => now()->format('Y-m'),
'email_count' => 5_000,
]);
$host = Host::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'name' => 'Capped Host',
'email' => 'capped@example.com',
'is_available' => true,
]);
$this->actingAs($this->owner)
->post(route('frontdesk.visits.store'), [
'full_name' => 'Capped Guest',
'host_id' => $host->id,
'visitor_type' => 'visitor',
'policies_accepted' => '1',
])
->assertRedirect();
Http::assertNotSent(fn ($request) => str_contains($request->url(), '/api/smtp/send'));
$usage = NotificationUsage::where('organization_id', $this->organization->id)->first();
$this->assertSame(5_000, $usage->email_count);
}
public function test_enterprise_plan_emails_are_unlimited(): void
{
Http::fake([
'billing.test/can-afford*' => Http::response(['affordable' => true]),
'billing.test/debit' => Http::response(['ok' => true]),
'*/api/smtp/send' => Http::response(['success' => true]),
]);
$this->organization->update([
'settings' => array_merge($this->organization->settings ?? [], [
'plan' => 'enterprise',
'plan_expires_at' => now()->addMonth()->toIso8601String(),
]),
]);
NotificationUsage::create([
'organization_id' => $this->organization->id,
'period' => now()->format('Y-m'),
'email_count' => 50_000,
]);
$host = Host::create([
'owner_ref' => $this->owner->public_id,
'organization_id' => $this->organization->id,
'name' => 'Ent Host',
'email' => 'ent@example.com',
'is_available' => true,
]);
$this->actingAs($this->owner)
->post(route('frontdesk.visits.store'), [
'full_name' => 'Ent Guest',
'host_id' => $host->id,
'visitor_type' => 'visitor',
'policies_accepted' => '1',
])
->assertRedirect();
Http::assertSent(fn ($request) => str_contains($request->url(), '/api/smtp/send'));
Http::assertNotSent(fn ($request) => str_contains($request->url(), '/debit'));
}
public function test_linked_user_still_gets_in_app_notification(): void
{
Notification::fake();