diff --git a/src/Clover/CloverExtendSocialite.php b/src/Clover/CloverExtendSocialite.php index 32476227e..a740ab060 100644 --- a/src/Clover/CloverExtendSocialite.php +++ b/src/Clover/CloverExtendSocialite.php @@ -6,7 +6,7 @@ class CloverExtendSocialite { - public function handle(SocialiteWasCalled $socialiteWasCalled) + public function handle(SocialiteWasCalled $socialiteWasCalled): void { $socialiteWasCalled->extendSocialite(Provider::IDENTIFIER, Provider::class); } diff --git a/src/Clover/Provider.php b/src/Clover/Provider.php index c71144aa1..f1c7a93bc 100644 --- a/src/Clover/Provider.php +++ b/src/Clover/Provider.php @@ -26,7 +26,7 @@ class Provider extends AbstractProvider */ protected $stateless = true; - public static function additionalConfigKeys() + public static function additionalConfigKeys(): array { return [ 'environment', @@ -37,9 +37,8 @@ public static function additionalConfigKeys() * Get the access token response for the given code. * * @param string $code - * @return array */ - public function getAccessTokenResponse($code) + public function getAccessTokenResponse($code): array { $response = $this->getHttpClient()->post($this->getTokenUrl(), [ RequestOptions::HEADERS => $this->getTokenHeaders($code), @@ -60,7 +59,7 @@ protected function getApiDomain(): string /** * {@inheritdoc} */ - protected function getAuthUrl($state) + protected function getAuthUrl($state): string { return $this->buildAuthUrlFromBase( sprintf('https://%s/oauth/v2/authorize', $this->getApiDomain()), @@ -71,7 +70,7 @@ protected function getAuthUrl($state) /** * {@inheritdoc} */ - protected function getTokenUrl() + protected function getTokenUrl(): string { $domain = match ($this->getConfig('environment')) { 'sandbox' => 'apisandbox.dev.clover.com', @@ -86,16 +85,11 @@ protected function getTokenUrl() */ protected function getUserByToken($token) { - $requestParams = str(request()->fullUrl()) - ->after('?') - ->explode('&') - ->mapWithKeys(fn (string $keyAndValue) => [str($keyAndValue)->before('=')->toString() => str($keyAndValue)->after('=')->toString()]); - $response = $this->getHttpClient()->get(sprintf( 'https://%s/v3/merchants/%s/employees/%s', $this->getApiDomain(), - $requestParams['merchant_id'], - $requestParams['employee_id'], + $this->request->query('merchant_id'), + $this->request->query('employee_id'), ), [ 'headers' => [ 'Authorization' => 'Bearer '.$token, diff --git a/src/Clover/README.md b/src/Clover/README.md index e0a258cb3..34284703b 100644 --- a/src/Clover/README.md +++ b/src/Clover/README.md @@ -31,7 +31,7 @@ Add the event to your `listen[]` array in `app/Providers/EventServiceProvider`. protected $listen = [ \SocialiteProviders\Manager\SocialiteWasCalled::class => [ // ... other providers - 'SocialiteProviders\\Clover\\CloverExtendSocialite@handle', + \SocialiteProviders\Clover\CloverExtendSocialite::class.'@handle', ], ]; ``` diff --git a/src/Clover/composer.json b/src/Clover/composer.json index b64340f4c..ba5746806 100644 --- a/src/Clover/composer.json +++ b/src/Clover/composer.json @@ -2,16 +2,28 @@ "name": "socialiteproviders/clover", "description": "Clover OAuth2 Provider for Laravel Socialite", "license": "MIT", + "keywords": [ + "clover", + "laravel", + "oauth", + "provider", + "socialite" + ], "authors": [ { "name": "macbookandrew", "homepage": "https://andrewrminion.com" } ], + "support": { + "issues": "https://github.com/socialiteproviders/providers/issues", + "source": "https://github.com/socialiteproviders/providers", + "docs": "https://socialiteproviders.com/clover" + }, "require": { "php": "^8.1", "ext-json": "*", - "socialiteproviders/manager": "^4.0" + "socialiteproviders/manager": "^4.4" }, "autoload": { "psr-4": {