diff --git a/composer.json b/composer.json index f5feb1d3..ada2c77f 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "ext-json": "*", "funeralzone/valueobjects": "^0.5", "jenssegers/agent": "^2.6", - "laravel/framework": "^7.0 || ^8.0 || ^9.0", + "laravel/framework": "^7.0 || ^8.0 || ^9.0 || ^10.0", "osiset/basic-shopify-api": "^9.0 || <=10.0.5" }, "require-dev": { diff --git a/src/Actions/InstallShop.php b/src/Actions/InstallShop.php index ea89ad77..83c634b6 100644 --- a/src/Actions/InstallShop.php +++ b/src/Actions/InstallShop.php @@ -5,6 +5,7 @@ use Exception; use Osiset\ShopifyApp\Contracts\Commands\Shop as IShopCommand; use Osiset\ShopifyApp\Contracts\Queries\Shop as IShopQuery; +use Osiset\ShopifyApp\Messaging\Events\AppInstalled; use Osiset\ShopifyApp\Objects\Enums\AuthMode; use Osiset\ShopifyApp\Objects\Values\AccessToken; use Osiset\ShopifyApp\Objects\Values\NullAccessToken; @@ -88,6 +89,9 @@ public function __invoke(ShopDomain $shopDomain, ?string $code): array $data = $apiHelper->getAccessData($code); $this->shopCommand->setAccessToken($shop->getId(), AccessToken::fromNative($data['access_token'])); + // Fire the AppInstalled event + AppInstalled::dispatch($shop); + return [ 'completed' => true, 'url' => null, diff --git a/src/Messaging/Events/AppInstalled.php b/src/Messaging/Events/AppInstalled.php new file mode 100644 index 00000000..ee908cb5 --- /dev/null +++ b/src/Messaging/Events/AppInstalled.php @@ -0,0 +1,36 @@ +shop = $shop; + } + + public function getShop() + { + return $this->shop; + } +}