1
0
Fork 0
mirror of synced 2024-06-29 19:50:26 +12:00

feat: update paypal OAuth provider

This commit is contained in:
Christy Jacob 2022-04-27 22:32:06 +03:00
parent 16c45fad29
commit d5b2f0c7d4
2 changed files with 23 additions and 1 deletions

View file

@ -148,7 +148,13 @@ class Paypal extends OAuth2
$user = $this->getUser($accessToken);
if (isset($user['emails'])) {
return $user['emails'][0]['value'];
$email = array_filter($user['emails'], function ($email) {
return $email['primary'] === true;
});
if (!empty($email)) {
return $email[0]['value'];
}
}
return '';
@ -157,12 +163,20 @@ class Paypal extends OAuth2
/**
* Check if the OAuth email is verified
*
* @link https://developer.paypal.com/docs/api/identity/v1/#userinfo_get
*
* @param $accessToken
*
* @return bool
*/
public function isEmailVerififed(string $accessToken): bool
{
$user = $this->getUser($accessToken);
if (isset($user['verified_account']) && $user['verified_account'] === true) {
return true;
}
return false;
}

View file

@ -151,12 +151,20 @@ class Salesforce extends OAuth2
/**
* Check if the OAuth email is verified
*
* @link https://help.salesforce.com/s/articleView?id=sf.remoteaccess_using_userinfo_endpoint.htm&type=5
*
* @param $accessToken
*
* @return bool
*/
public function isEmailVerififed(string $accessToken): bool
{
$user = $this->getUser($accessToken);
if (isset($user['email_verified']) && $user['email_verified'] === true) {
return true;
}
return false;
}