Match Care/Frontdesk: branches stepper next to billing period, live totals, and checkout charges for the selected seat count.
This commit is contained in:
@@ -54,6 +54,8 @@ class QmsProTest extends TestCase
|
||||
->assertSee('GHS '.$proPerBranch)
|
||||
->assertSee('GHS '.$enterprisePerBranch)
|
||||
->assertSee('/branch/mo')
|
||||
->assertSee('Branches')
|
||||
->assertSee('Minimum is your current active branch count')
|
||||
->assertSee('Upgrade to Pro')
|
||||
->assertSee('Enterprise');
|
||||
}
|
||||
@@ -109,7 +111,7 @@ class QmsProTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('qms.pro.subscribe'))
|
||||
->post(route('qms.pro.subscribe'), ['branches' => 1])
|
||||
->assertRedirect(route('qms.pro.index'))
|
||||
->assertSessionHas('success');
|
||||
|
||||
@@ -118,6 +120,26 @@ class QmsProTest extends TestCase
|
||||
$this->assertSame(1, $settings['pro_billed_branches']);
|
||||
}
|
||||
|
||||
public function test_subscribe_pro_uses_selected_branch_count(): void
|
||||
{
|
||||
Http::fake([
|
||||
'billing.test/can-afford*' => Http::response(['affordable' => true]),
|
||||
'billing.test/debit' => function ($request) {
|
||||
$expected = 3 * (int) config('qms.plans.pro.price_minor_per_branch');
|
||||
$this->assertSame($expected, (int) $request['amount_minor']);
|
||||
|
||||
return Http::response(['ok' => true]);
|
||||
},
|
||||
]);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('qms.pro.subscribe'), ['branches' => 3])
|
||||
->assertRedirect(route('qms.pro.index'))
|
||||
->assertSessionHas('success');
|
||||
|
||||
$this->assertSame(3, $this->organization->fresh()->settings['pro_billed_branches']);
|
||||
}
|
||||
|
||||
public function test_subscribe_enterprise_requires_multiple_branches(): void
|
||||
{
|
||||
Http::fake([
|
||||
@@ -126,7 +148,7 @@ class QmsProTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('qms.pro.subscribe-enterprise'))
|
||||
->post(route('qms.pro.subscribe-enterprise'), ['branches' => 1])
|
||||
->assertRedirect(route('qms.pro.index'))
|
||||
->assertSessionHas('error');
|
||||
|
||||
@@ -138,7 +160,7 @@ class QmsProTest extends TestCase
|
||||
]);
|
||||
|
||||
$this->actingAs($this->owner)
|
||||
->post(route('qms.pro.subscribe-enterprise'))
|
||||
->post(route('qms.pro.subscribe-enterprise'), ['branches' => 2])
|
||||
->assertRedirect(route('qms.pro.index'))
|
||||
->assertSessionHas('success');
|
||||
|
||||
@@ -259,6 +281,7 @@ class QmsProTest extends TestCase
|
||||
->post(route('qms.pro.subscribe-prepaid'), [
|
||||
'plan' => 'pro',
|
||||
'months' => 12,
|
||||
'branches' => 1,
|
||||
])
|
||||
->assertRedirect('https://checkout.paystack.test/pay');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user