2 namespace PayPal\Auth\Openid;
3 use PayPal\Common\PPModel;
5 * OpenIdConnect UserInfo Resource
7 class PPOpenIdUserinfo extends PPModel {
10 * Subject - Identifier for the End-User at the Issuer.
11 * @param string $user_id
13 public function setUserId($user_id) {
14 $this->user_id = $user_id;
19 * Subject - Identifier for the End-User at the Issuer.
22 public function getUserId() {
23 return $this->user_id;
27 * Subject - Identifier for the End-User at the Issuer.
30 public function setSub($sub) {
36 * Subject - Identifier for the End-User at the Issuer.
39 public function getSub() {
44 * End-User's full name in displayable form including all name parts, possibly including titles and suffixes, ordered according to the End-User's locale and preferences.
47 public function setName($name) {
53 * End-User's full name in displayable form including all name parts, possibly including titles and suffixes, ordered according to the End-User's locale and preferences.
56 public function getName() {
61 * Given name(s) or first name(s) of the End-User
62 * @param string $given_name
64 public function setGivenName($given_name) {
65 $this->given_name = $given_name;
70 * Given name(s) or first name(s) of the End-User
73 public function getGivenName() {
74 return $this->given_name;
78 * Surname(s) or last name(s) of the End-User.
79 * @param string $family_name
81 public function setFamilyName($family_name) {
82 $this->family_name = $family_name;
87 * Surname(s) or last name(s) of the End-User.
90 public function getFamilyName() {
91 return $this->family_name;
95 * Middle name(s) of the End-User.
96 * @param string $middle_name
98 public function setMiddleName($middle_name) {
99 $this->middle_name = $middle_name;
104 * Middle name(s) of the End-User.
107 public function getMiddleName() {
108 return $this->middle_name;
112 * URL of the End-User's profile picture.
113 * @param string $picture
115 public function setPicture($picture) {
116 $this->picture = $picture;
121 * URL of the End-User's profile picture.
124 public function getPicture() {
125 return $this->picture;
129 * End-User's preferred e-mail address.
130 * @param string $email
132 public function setEmail($email) {
133 $this->email = $email;
138 * End-User's preferred e-mail address.
141 public function getEmail() {
146 * True if the End-User's e-mail address has been verified; otherwise false.
147 * @param boolean $email_verified
149 public function setEmailVerified($email_verified) {
150 $this->email_verified = $email_verified;
155 * True if the End-User's e-mail address has been verified; otherwise false.
158 public function getEmailVerified() {
159 return $this->email_verified;
164 * @param string $gender
166 public function setGender($gender) {
167 $this->gender = $gender;
175 public function getGender() {
176 return $this->gender;
180 * End-User's birthday, represented as an YYYY-MM-DD format. They year MAY be 0000, indicating it is omited. To represent only the year, YYYY format would be used.
181 * @param string $birthday
183 public function setBirthday($birthday) {
184 $this->birthday = $birthday;
189 * End-User's birthday, represented as an YYYY-MM-DD format. They year MAY be 0000, indicating it is omited. To represent only the year, YYYY format would be used.
192 public function getBirthday() {
193 return $this->birthday;
197 * Time zone database representing the End-User's time zone
198 * @param string $zoneinfo
200 public function setZoneinfo($zoneinfo) {
201 $this->zoneinfo = $zoneinfo;
206 * Time zone database representing the End-User's time zone
209 public function getZoneinfo() {
210 return $this->zoneinfo;
215 * @param string $locale
217 public function setLocale($locale) {
218 $this->locale = $locale;
226 public function getLocale() {
227 return $this->locale;
231 * End-User's language.
232 * @param string $language
234 public function setLanguage($language) {
235 $this->language = $language;
240 * End-User's language.
243 public function getLanguage() {
244 return $this->language;
248 * End-User's verified status.
249 * @param boolean $verified
251 public function setVerified($verified) {
252 $this->verified = $verified;
257 * End-User's verified status.
260 public function getVerified() {
261 return $this->verified;
265 * End-User's preferred telephone number.
266 * @param string $phone_number
268 public function setPhoneNumber($phone_number) {
269 $this->phone_number = $phone_number;
274 * End-User's preferred telephone number.
277 public function getPhoneNumber() {
278 return $this->phone_number;
282 * End-User's preferred address.
283 * @param PPOpenIdAddress $address
285 public function setAddress($address) {
286 $this->address = $address;
291 * End-User's preferred address.
292 * @return PPOpenIdAddress
294 public function getAddress() {
295 return $this->address;
299 * Verified account status.
300 * @param boolean $verified_account
302 public function setVerifiedAccount($verified_account) {
303 $this->verified_account = $verified_account;
308 * Verified account status.
311 public function getVerifiedAccount() {
312 return $this->verified_account;
317 * @param string $account_type
319 public function setAccountType($account_type) {
320 $this->account_type = $account_type;
328 public function getAccountType() {
329 return $this->account_type;
333 * Account holder age range.
334 * @param string $age_range
336 public function setAgeRange($age_range) {
337 $this->age_range = $age_range;
342 * Account holder age range.
345 public function getAgeRange() {
346 return $this->age_range;
350 * Account payer identifier.
351 * @param string $payer_id
353 public function setPayerId($payer_id) {
354 $this->payer_id = $payer_id;
359 * Account payer identifier.
362 public function getPayerId() {
363 return $this->payer_id;
368 * returns user details
370 * @path /v1/identity/openidconnect/userinfo
372 * @param array $params (allowed values are access_token)
373 * access_token - access token from the createFromAuthorizationCode / createFromRefreshToken calls
374 * @param PPApiContext $apiContext Optional API Context
375 * @return PPOpenIdUserinfo
377 public static function getUserinfo($params, $apiContext=null) {
378 static $allowedParams = array( 'schema' => 1);
379 if(is_null($apiContext)) {
380 $apiContext = new PPApiContext();
383 if(!array_key_exists('schema', $params)) {
384 $params['schema'] = 'openid';
386 $requestUrl = "/v1/identity/openidconnect/userinfo?"
387 . http_build_query(array_intersect_key($params, $allowedParams));
388 $call = new PPRestCall($apiContext);
389 $ret = new PPOpenIdUserinfo();
391 $call->execute(array('PPOpenIdHandler'), $requestUrl, "GET", "",
393 'Authorization' => "Bearer " . $params['access_token'],
394 'Content-Type'=> 'x-www-form-urlencoded'