Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Commit 0122685

Browse files
committed
Fixes to billing routes
1 parent d15015e commit 0122685

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/ShopifyApp/Traits/BillingControllerTrait.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ trait BillingControllerTrait
2121
/**
2222
* Redirects to billing screen for Shopify.
2323
*
24-
* @param \OhMyBrew\ShopifyApp\Models\Plan|null $plan The plan.
24+
* @param \OhMyBrew\ShopifyApp\Models\Plan $plan The plan.
2525
*
2626
* @return \Illuminate\View\View
2727
*/
28-
public function index(Plan $plan = null)
28+
public function index(Plan $plan)
2929
{
3030
// If the plan is null, get a plan
31-
if (is_null($plan)) {
31+
if (is_null($plan) || ($plan && !$plan->exists)) {
3232
$plan = Plan::where('on_install', true)->first();
3333
}
3434

src/ShopifyApp/resources/routes.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
use OhMyBrew\ShopifyApp\Models\Plan;
4-
53
/*
64
|--------------------------------------------------------------------------
75
| Web Routes

tests/Controllers/BillingControllerTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class BillingControllerTest extends TestCase
1616
public function setUp()
1717
{
1818
parent::setUp();
19-
19+
;$this->withoutExceptionHandling();
2020
// Stub in our API class
2121
Config::set('shopify-app.api_class', new ApiStub());
2222

@@ -36,6 +36,9 @@ public function testSendsShopToBillingScreen()
3636
$shop = factory(Shop::class)->create();
3737
Session::put('shopify_domain', $shop->shopify_domain);
3838

39+
// Create a on-install plan
40+
factory(Plan::class)->states('type_recurring', 'installable')->create();
41+
3942
// Run the call
4043
$response = $this->get('/billing');
4144
$response->assertViewHas(

0 commit comments

Comments
 (0)