Skip to content

Commit

Permalink
Merge pull request #2 from magespecialist/fix-google-api-error
Browse files Browse the repository at this point in the history
Fix google api error
  • Loading branch information
giacmir authored Jul 22, 2020
2 parents 7ee1ed9 + f0da3e8 commit b0fc243
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Model/CreateUserFromGoogleUserInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace MSP\BackendGoogleSignOn\Model;

use Google_Service_Oauth2_Userinfoplus;
use Google_Service_Oauth2_Userinfo;
use Magento\Framework\Exception\AlreadyExistsException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\User\Model\ResourceModel\User as UserResource;
Expand Down Expand Up @@ -74,10 +74,10 @@ private function userExistsByEmail(string $email): bool
/**
* Create a new admin user if not exists based on google info
*
* @param Google_Service_Oauth2_Userinfoplus $userInfo
* @param Google_Service_Oauth2_Userinfo $userInfo
* @throws AlreadyExistsException
*/
public function execute(Google_Service_Oauth2_Userinfoplus $userInfo): void
public function execute(Google_Service_Oauth2_Userinfo $userInfo): void
{
$rule = $this->getDomainRule->execute($userInfo->getHd());

Expand Down
6 changes: 3 additions & 3 deletions Model/GetGoogleUserInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace MSP\BackendGoogleSignOn\Model;

use Google_Service_Oauth2_Userinfoplus;
use Google_Service_Oauth2_Userinfo;
use Magento\Framework\Exception\LocalizedException;

/**
Expand Down Expand Up @@ -42,10 +42,10 @@ public function __construct(
* Authenticate through the Google Auth code response
*
* @param string $authCode
* @return Google_Service_Oauth2_Userinfoplus
* @return Google_Service_Oauth2_Userinfo
* @throws LocalizedException
*/
public function execute(string $authCode): Google_Service_Oauth2_Userinfoplus
public function execute(string $authCode): Google_Service_Oauth2_Userinfo
{
$googleClient = $this->getGoogleClient->execute();

Expand Down
8 changes: 4 additions & 4 deletions Test/Integration/CreateUserFromGoogleUserInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace MSP\BackendGoogleSignOn\Test\Integration;

use Google_Service_Oauth2_Userinfoplus;
use Google_Service_Oauth2_Userinfo;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\User\Model\User;
use MSP\BackendGoogleSignOn\Model\CreateUserFromGoogleUserInfo;
Expand Down Expand Up @@ -66,7 +66,7 @@ private function getUserByEmail(string $email): ?User
*/
public function testShouldCreateNewUser(): void
{
$googleInfo = new Google_Service_Oauth2_Userinfoplus();
$googleInfo = new Google_Service_Oauth2_Userinfo();
$googleInfo->setGivenName('John');
$googleInfo->setFamilyName('Doe');
$googleInfo->setEmail('some@mydomain3.com');
Expand All @@ -87,7 +87,7 @@ public function testShouldCreateNewUser(): void
*/
public function testShouldNotCreateNewUserWithADomainRule(): void
{
$googleInfo = new Google_Service_Oauth2_Userinfoplus();
$googleInfo = new Google_Service_Oauth2_Userinfo();
$googleInfo->setGivenName('John');
$googleInfo->setFamilyName('Doe');
$googleInfo->setEmail('some@mydomain.com');
Expand All @@ -104,7 +104,7 @@ public function testShouldNotCreateNewUserWithADomainRule(): void
*/
public function testShouldNotCreateNewUserWithoutADomainRule(): void
{
$googleInfo = new Google_Service_Oauth2_Userinfoplus();
$googleInfo = new Google_Service_Oauth2_Userinfo();
$googleInfo->setGivenName('John');
$googleInfo->setFamilyName('Doe');
$googleInfo->setEmail('some@gmail.com');
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"magento/magento2-base": "^2.3",
"magento/module-backend": "*",
"magento/module-user": "*",
"google/apiclient": "^2.4"
"google/apiclient": "2.6.*"
},
"support": {
"issues": "https://github.com/magespecialist/m2-GoogleSignOn/issues"
Expand Down

0 comments on commit b0fc243

Please sign in to comment.