Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ShopifyApp/Jobs/AppUninstalledJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Config;
use OhMyBrew\ShopifyApp\Models\Charge;
use OhMyBrew\ShopifyApp\Models\Shop;
use Illuminate\Support\Facades\Config;

/**
* Webhook job responsible for handling when the app is uninstalled.
Expand Down
2 changes: 1 addition & 1 deletion src/ShopifyApp/Middleware/AuthShop.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
use Closure;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Config;
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;

/**
Expand Down
4 changes: 1 addition & 3 deletions src/ShopifyApp/Models/Charge.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@
namespace OhMyBrew\ShopifyApp\Models;

use Exception;
use Illuminate\Support\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Models\Plan;
use Illuminate\Support\Carbon;

/**
* Responsible for reprecenting a charge record.
Expand Down
1 change: 0 additions & 1 deletion src/ShopifyApp/Models/Plan.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace OhMyBrew\ShopifyApp\Models;

use Illuminate\Database\Eloquent\Model;
use OhMyBrew\ShopifyApp\Models\Charge;

/**
* Responsible for reprecenting a plan record.
Expand Down
6 changes: 2 additions & 4 deletions src/ShopifyApp/Requests/AuthShop.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

namespace OhMyBrew\ShopifyApp\Requests;

use Illuminate\Support\Collection;
use Illuminate\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;
use Illuminate\Validation\Validator;
use OhMyBrew\ShopifyApp\Services\AuthShopHandler;

/**
Expand All @@ -16,7 +14,7 @@ class AuthShop extends FormRequest
/**
* Configure the validator instance.
*
* @param \Illuminate\Validation\Validator $validator
* @param \Illuminate\Validation\Validator $validator
*
* @return void
*/
Expand Down
5 changes: 2 additions & 3 deletions src/ShopifyApp/Requests/StoreUsageCharge.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

namespace OhMyBrew\ShopifyApp\Requests;

use Illuminate\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Collection;
use Illuminate\Validation\Validator;
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;

/**
Expand All @@ -15,7 +14,7 @@ class StoreUsageCharge extends FormRequest
/**
* Configure the validator instance.
*
* @param \Illuminate\Validation\Validator $validator
* @param \Illuminate\Validation\Validator $validator
*
* @return void
*/
Expand Down
12 changes: 6 additions & 6 deletions src/ShopifyApp/Services/AuthShopHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
namespace OhMyBrew\ShopifyApp\Services;

use Exception;
use Illuminate\Support\Facades\URL;
use OhMyBrew\ShopifyApp\Models\Shop;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\URL;
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;
use OhMyBrew\ShopifyApp\Jobs\WebhookInstaller;
use OhMyBrew\ShopifyApp\Jobs\ScripttagInstaller;
use OhMyBrew\ShopifyApp\Jobs\WebhookInstaller;
use OhMyBrew\ShopifyApp\Models\Shop;

/**
* Responsible for handling how to authenticate a shop.
Expand Down Expand Up @@ -83,7 +83,7 @@ public function buildAuthUrl()
*
* @param array $request The request parameters.
*
* @return boolean
* @return bool
*/
public function verifyRequest(array $request)
{
Expand All @@ -104,7 +104,7 @@ public function storeAccessToken(string $code)
$this->shop->restore();
$this->shop->charges()->restore();
}

// Save the token to the shop
$this->shop->shopify_token = $this->api->requestAccessToken($code);
$this->shop->save();
Expand All @@ -113,7 +113,7 @@ public function storeAccessToken(string $code)
/**
* Dispatches the jobs that happen after authentication.
*
* @return boolean
* @return bool
*/
public function dispatchJobs()
{
Expand Down
12 changes: 6 additions & 6 deletions src/ShopifyApp/Services/BillingPlan.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
namespace OhMyBrew\ShopifyApp\Services;

use Exception;
use OhMyBrew\ShopifyApp\Models\Plan;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Models\Charge;
use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Carbon;
use OhMyBrew\ShopifyApp\Models\Charge;
use OhMyBrew\ShopifyApp\Models\Plan;
use OhMyBrew\ShopifyApp\Models\Shop;

/**
* Responsible for creating a confirmation URL for a billing plan,
Expand Down Expand Up @@ -62,7 +62,7 @@ class BillingPlan
public function __construct(Shop $shop, Plan $plan)
{
$this->shop = $shop;
$this->api = $this->shop->api();
$this->api = $this->shop->api();
$this->plan = $plan;

return $this;
Expand Down Expand Up @@ -174,7 +174,7 @@ public function activate()
/**
* Cancels the current charge for the shop, saves the new charge.
*
* @return boolean
* @return bool
*/
public function save()
{
Expand Down
6 changes: 3 additions & 3 deletions src/ShopifyApp/Services/UsageCharge.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class UsageCharge
protected $response;

/**
* Constructor for usage charge class
* Constructor for usage charge class.
*
* @param \OhMyBrew\ShopifyApp\Models\Shop $shop The shop to target for billing.
* @param array $data The usage charge data.
Expand All @@ -50,7 +50,7 @@ class UsageCharge
public function __construct(Shop $shop, array $data)
{
$this->shop = $shop;
$this->api = $this->shop->api();
$this->api = $this->shop->api();
$this->data = $data;

return $this;
Expand Down Expand Up @@ -86,7 +86,7 @@ public function activate()
/**
* Saves the usage charge to the database.
*
* @return boolean
* @return bool
*/
public function save()
{
Expand Down
2 changes: 1 addition & 1 deletion src/ShopifyApp/ShopifyApp.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace OhMyBrew\ShopifyApp;

use Illuminate\Foundation\Application;
use OhMyBrew\ShopifyApp\Models\Shop;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use OhMyBrew\ShopifyApp\Models\Shop;

/**
* The base "helper" class for this package.
Expand Down
4 changes: 2 additions & 2 deletions src/ShopifyApp/ShopifyAppProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace OhMyBrew\ShopifyApp;

use Illuminate\Support\Facades\Config;
use Illuminate\Support\ServiceProvider;
use OhMyBrew\ShopifyApp\Observers\ShopObserver;
use OhMyBrew\ShopifyApp\Console\WebhookJobMakeCommand;
use Illuminate\Support\Facades\Config;
use OhMyBrew\ShopifyApp\Observers\ShopObserver;

/**
* This package's provider for Laravel.
Expand Down
9 changes: 4 additions & 5 deletions src/ShopifyApp/Traits/AuthControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

namespace OhMyBrew\ShopifyApp\Traits;

use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\View;
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;
use OhMyBrew\ShopifyApp\Requests\AuthShop;
use OhMyBrew\ShopifyApp\Services\AuthShopHandler;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Redirect;

/**
* Responsible for authenticating the shop.
Expand Down
9 changes: 4 additions & 5 deletions src/ShopifyApp/Traits/BillingControllerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

namespace OhMyBrew\ShopifyApp\Traits;

use Illuminate\Support\Carbon;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\View;
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;
use OhMyBrew\ShopifyApp\Models\Charge;
use OhMyBrew\ShopifyApp\Models\Plan;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Models\Charge;
use OhMyBrew\ShopifyApp\Requests\StoreUsageCharge;
use Illuminate\Support\Facades\Redirect;
use Illuminate\Support\Facades\Request;
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;
use OhMyBrew\ShopifyApp\Services\BillingPlan;
use OhMyBrew\ShopifyApp\Services\UsageCharge;

Expand Down
7 changes: 3 additions & 4 deletions src/ShopifyApp/Traits/ShopModelTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use Illuminate\Database\Eloquent\SoftDeletes;
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;
use OhMyBrew\ShopifyApp\Scopes\NamespaceScope;
use OhMyBrew\ShopifyApp\Models\Plan;
use OhMyBrew\ShopifyApp\Models\Charge;
use OhMyBrew\ShopifyApp\Models\Plan;
use OhMyBrew\ShopifyApp\Scopes\NamespaceScope;

/**
* Responsible for reprecenting a shop record.
Expand Down Expand Up @@ -126,7 +126,6 @@ public function planCharge()
->whereIn('type', [Charge::CHARGE_RECURRING, Charge::CHARGE_ONETIME])
->where('plan_id', $this->plan_id)
->orderBy('created_at', 'desc')
->first()
;
->first();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
]);

$factory->state(Charge::class, 'type_recurring', [
'type' => Charge::CHARGE_RECURRING
'type' => Charge::CHARGE_RECURRING,
]);

$factory->state(Charge::class, 'type_onetime', [
Expand Down
6 changes: 3 additions & 3 deletions tests/Controllers/AuthControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace OhMyBrew\ShopifyApp\Test\Controllers;

use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use OhMyBrew\ShopifyApp\Controllers\AuthController;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Test\TestCase;
use OhMyBrew\ShopifyApp\Test\Stubs\ApiStub;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use OhMyBrew\ShopifyApp\Test\TestCase;
use ReflectionMethod;

class AuthControllerTest extends TestCase
Expand Down
10 changes: 5 additions & 5 deletions tests/Controllers/BillingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace OhMyBrew\ShopifyApp\Test\Controllers;

use OhMyBrew\ShopifyApp\ShopifyApp;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Models\Plan;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use OhMyBrew\ShopifyApp\Models\Charge;
use OhMyBrew\ShopifyApp\Models\Plan;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\ShopifyApp;
use OhMyBrew\ShopifyApp\Test\Stubs\ApiStub;
use OhMyBrew\ShopifyApp\Test\TestCase;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;

class BillingControllerTest extends TestCase
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Controllers/HomeControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace OhMyBrew\ShopifyApp\Test\Controllers;

use OhMyBrew\ShopifyApp\Test\Stubs\ApiStub;
use OhMyBrew\ShopifyApp\Test\TestCase;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Test\Stubs\ApiStub;
use OhMyBrew\ShopifyApp\Test\TestCase;

class HomeControllerTest extends TestCase
{
Expand Down
4 changes: 1 addition & 3 deletions tests/Controllers/WebhookControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
namespace OhMyBrew\ShopifyApp\Test\Controllers;

use Illuminate\Support\Facades\Queue;
use OhMyBrew\ShopifyApp\Controllers\WebhookController;
use OhMyBrew\ShopifyApp\Test\TestCase;
use OhMyBrew\ShopifyApp\Models\Shop;
use ReflectionMethod;
use OhMyBrew\ShopifyApp\Test\TestCase;

require_once __DIR__.'/../Stubs/OrdersCreateJobStub.php';

Expand Down
1 change: 0 additions & 1 deletion tests/Jobs/AppUninstalledJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace OhMyBrew\ShopifyApp\Test\Jobs;

use Illuminate\Support\Carbon;
use OhMyBrew\ShopifyApp\Jobs\AppUninstalledJob;
use OhMyBrew\ShopifyApp\Models\Charge;
use OhMyBrew\ShopifyApp\Models\Plan;
Expand Down
2 changes: 1 addition & 1 deletion tests/Jobs/ScripttagInstallerJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace OhMyBrew\ShopifyApp\Test\Jobs;

use Illuminate\Support\Facades\Config;
use OhMyBrew\ShopifyApp\Jobs\ScripttagInstaller;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Test\Stubs\ApiStub;
use OhMyBrew\ShopifyApp\Test\TestCase;
use Illuminate\Support\Facades\Config;
use ReflectionMethod;
use ReflectionObject;

Expand Down
2 changes: 1 addition & 1 deletion tests/Jobs/WebhookInstallerJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace OhMyBrew\ShopifyApp\Test\Jobs;

use Illuminate\Support\Facades\Config;
use OhMyBrew\ShopifyApp\Jobs\WebhookInstaller;
use OhMyBrew\ShopifyApp\Models\Shop;
use OhMyBrew\ShopifyApp\Test\Stubs\ApiStub;
use OhMyBrew\ShopifyApp\Test\TestCase;
use Illuminate\Support\Facades\Config;
use ReflectionMethod;
use ReflectionObject;

Expand Down
6 changes: 3 additions & 3 deletions tests/Middleware/AuthProxyMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
namespace OhMyBrew\ShopifyApp\Test\Middleware;

use Closure;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Session;
use OhMyBrew\ShopifyApp\Facades\ShopifyApp;
use OhMyBrew\ShopifyApp\Middleware\AuthProxy;
use OhMyBrew\ShopifyApp\Test\TestCase;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Request;

class AuthProxyMiddlewareTest extends TestCase
{
Expand Down
Loading