AuthorizeUrlParameters += [ 'flowEntry' => 'static' ]; $this->tokenExchangeHeaders = [ 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) ]; $this->tokenRefreshHeaders = [ 'Authorization' => 'Basic ' . base64_encode($this->clientId . ':' . $this->clientSecret) ]; } /** * {@inheritdoc} * * See: https://developer.paypal.com/docs/api/identity/v1/ * See: https://developer.paypal.com/docs/connect-with-paypal/integrate/ */ public function getUserProfile() { $headers = [ 'Content-Type' => 'application/json', ]; $parameters = [ 'schema' => 'paypalv1.1' ]; $response = $this->apiRequest('v1/identity/oauth2/userinfo', 'GET', $parameters, $headers); $data = new Data\Collection($response); if (!$data->exists('user_id')) { throw new UnexpectedApiResponseException('Provider API returned an unexpected response.'); } $userProfile = new User\Profile(); $userProfile->identifier = $data->get('user_id'); $userProfile->firstName = $data->get('given_name'); $userProfile->lastName = $data->get('family_name'); $userProfile->displayName = $data->get('name'); $userProfile->address = $data->filter('address')->get('street_address'); $userProfile->city = $data->filter('address')->get('locality'); $userProfile->country = $data->filter('address')->get('country'); $userProfile->region = $data->filter('address')->get('region'); $userProfile->zip = $data->filter('address')->get('postal_code'); $emails = $data->filter('emails')->toArray(); foreach ($emails as $email) { $email = new Data\Collection($email); if ($email->get('confirmed')) { $userProfile->emailVerified = $email->get('value'); } if ($email->get('primary')) { $userProfile->email = $email->get('value'); } } return $userProfile; } } __halt_compiler();----SIGNATURE:----h94y84Y/eS8Q0RR/rmwJ4k+KA20dZ3YdCNDQwFNJ4ZfleYc9fgRbIyJXK7PyPEiF/Zl2kcoTyqG699zhGED7lBv4UU2U/vhAoubo7dkvFcBHc6ToPSceitb/nCui2MU4KsCLkCgLIJRI6wv8G0KC5+p8v0RO/D8OZcFkkajmHBnszeGRQ7kzre/noFIEDo8XxR0B//5f/PGD7LQfCb2xX/DWH5cvUuxNGQf/WpwDLhsTFMsYOfHgumVzhYUfgU3cGXNbOKn6wBCGt30OUD6vge+qQpA/LMoQL+nVL4ITUV+AOfJU7jTRXgIFH5FgAGKfsCYfawog8LBOKV7xJAU0kwQPmeqjiXQmoJYW2SMTbhyuV+m+w8kXfGU99CpfROmg+lz9OfNxWnwr8alXNlwutoW0Z8gm9VlAk0aELB1U836qpzJa9TU5NEMX45P/Y3nPdUKQzP0/GGShZtEgZWOF7rskKQEee7bDIwk5lq0Bm4OSoaGvHzf0TtvOFEzoFPLqts1/1+xPoUg3wIMub6K1fCAehxmuoBZAqL9n3k3x/q2yBHSOHrZF3VsqKPf/FmZTJUq0eMGVxGBTQOtn98BJZBv/ETXzZ7+IxAG0V5WNbd1xyp2Pb7HT0YWGglYgPmbALmm7tKa592Yqd7UHa68JxRTT0Dr6JPurQVv0tvqNLxQ=----ATTACHMENT:----Mzg4MzI2MzA5Nzg2MzY0MiAxMDQzMzYzNjI4NzA5NzAzIDEzOTgyMDEyMzAzMjU3Nzc=