Skip to content

Commit

Permalink
Fix error where wrong scopes order would result in failing check if a…
Browse files Browse the repository at this point in the history
…pp already installed
  • Loading branch information
a47ae committed Dec 5, 2024
1 parent 3ff9d55 commit d1e1992
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Http/Middleware/EnsureShopifyInstalled.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ public function handle(Request $request, Closure $next)
{
$shop = $request->query('shop') ? Utils::sanitizeShopDomain($request->query('shop')) : null;

$appInstalled = $shop && ShopifySession::where('shop', $shop)->where('access_token', '<>', null)->where('scope', Context::$SCOPES->toString())->exists();
$session = Utils::loadOfflineSession($shop);

$appInstalled = !empty($session);

$isExitingIframe = preg_match('/^ExitIframe/i', $request->path());

if ($isExitingIframe) {
Expand All @@ -35,8 +38,6 @@ public function handle(Request $request, Closure $next)
event(new ShopifyAppInstalled($shop));
}

$session ??= Utils::loadOfflineSession($shop);

if (config('shopify-integration.billing.required')) {
[$hasPayment, $confirmationUrl] = EnsureBilling::check(
$session,
Expand Down

0 comments on commit d1e1992

Please sign in to comment.