Add 3-tier plans, Paystack prepaid Pro, and Enterprise contact-sales card.
Deploy Ladill Frontdesk / deploy (push) Successful in 2m46s

Sidebar settings and upgrade share one footer with consistent spacing.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-30 01:55:38 +00:00
co-authored by Cursor
parent 1f6df54d8c
commit 5be14d0982
9 changed files with 419 additions and 73 deletions
+83 -4
View File
@@ -53,14 +53,17 @@ class FrontdeskProTest extends TestCase
]);
}
public function test_pro_page_renders_for_free_organization(): void
public function test_pro_page_renders_three_tier_pricing(): void
{
$this->actingAs($this->owner)
->get(route('frontdesk.pro.index'))
->assertOk()
->assertSee('Ladill Frontdesk Pro')
->assertSee('Choose your Frontdesk plan')
->assertSee('GHS 79')
->assertSee('Upgrade to Pro');
->assertSee('Custom')
->assertSee('Upgrade to Pro')
->assertSee('Enterprise')
->assertSee('Contact sales');
}
public function test_sidebar_shows_upgrade_to_pro_on_dashboard(): void
@@ -83,7 +86,48 @@ class FrontdeskProTest extends TestCase
->assertRedirect(route('frontdesk.pro.index'))
->assertSessionHas('success');
$this->assertSame('pro', $this->organization->fresh()->settings['plan']);
$settings = $this->organization->fresh()->settings;
$this->assertSame('pro', $settings['plan']);
$this->assertSame('wallet_monthly', $settings['billing_method']);
}
public function test_subscribe_prepaid_redirects_to_paystack(): void
{
Http::fake([
'billing.test/plan-checkout' => Http::response([
'checkout_url' => 'https://checkout.paystack.com/test',
'reference' => 'ref-123',
]),
]);
$this->actingAs($this->owner)
->post(route('frontdesk.pro.subscribe-prepaid'), [
'plan' => 'pro',
'months' => 12,
])
->assertRedirect('https://checkout.paystack.com/test');
}
public function test_paystack_callback_activates_prepaid_pro(): void
{
Http::fake([
'billing.test/plan-checkout/verify' => Http::response([
'paid' => true,
'plan' => 'pro',
'months' => 12,
'metadata' => ['organization_id' => $this->organization->id],
]),
]);
$this->actingAs($this->owner)
->get(route('frontdesk.pro.paystack.callback', ['reference' => 'ref-123']))
->assertRedirect(route('frontdesk.pro.index'))
->assertSessionHas('success');
$settings = $this->organization->fresh()->settings;
$this->assertSame('pro', $settings['plan']);
$this->assertFalse($settings['auto_renew']);
$this->assertSame('paystack_prepaid', $settings['billing_method']);
}
public function test_pro_renew_extends_subscription_when_wallet_charges(): void
@@ -108,6 +152,25 @@ class FrontdeskProTest extends TestCase
$this->assertTrue(now()->parse($settings['plan_expires_at'])->isFuture());
}
public function test_prepaid_pro_skipped_by_renewal_command(): void
{
$this->organization->update([
'settings' => [
'onboarded' => true,
'plan' => 'pro',
'auto_renew' => false,
'billing_method' => 'paystack_prepaid',
'plan_expires_at' => now()->subDay()->toIso8601String(),
],
]);
Http::fake();
$this->artisan('frontdesk:pro-renew')->assertSuccessful();
Http::assertNothingSent();
}
public function test_pro_sidebar_shows_active_label_after_upgrade(): void
{
$this->organization->update([
@@ -123,4 +186,20 @@ class FrontdeskProTest extends TestCase
->assertSee('Frontdesk Pro')
->assertDontSee('Upgrade to Pro');
}
public function test_enterprise_sidebar_shows_enterprise_label(): void
{
$this->organization->update([
'settings' => array_merge($this->organization->settings ?? [], [
'plan' => 'enterprise',
'plan_expires_at' => now()->addYear()->toIso8601String(),
]),
]);
$this->actingAs($this->owner)
->get(route('frontdesk.dashboard'))
->assertOk()
->assertSee('Frontdesk Enterprise')
->assertDontSee('Upgrade to Pro');
}
}