From 00b2e17bae0d3e1a2c4d6845fc5630802817da17 Mon Sep 17 00:00:00 2001 From: abisheksrikaanth Date: Mon, 26 Sep 2022 16:12:33 +0530 Subject: [PATCH 1/2] Adding event to notify App Installation on the store --- src/Actions/InstallShop.php | 4 +++ src/Messaging/Events/AppInstalled.php | 36 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/Messaging/Events/AppInstalled.php 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; + } +} From 9ac337a900a6d8b868721bbe5877d544ab4af617 Mon Sep 17 00:00:00 2001 From: Abishek R Srikaanth Date: Fri, 5 May 2023 19:36:17 +0530 Subject: [PATCH 2/2] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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": {