1<?php
2/*!
3* Hybridauth
4* https://hybridauth.github.io | https://github.com/hybridauth/hybridauth
5*  (c) 2017 Hybridauth authors | https://hybridauth.github.io/license.html
6*/
7
8namespace Hybridauth\Provider;
9
10use Hybridauth\Adapter\OpenID as OpenIDAdapter;
11use Hybridauth\HttpClient;
12
13/**
14 * PayPal OpenID provider adapter.
15 */
16class PaypalOpenID extends OpenIDAdapter
17{
18    /**
19    * {@inheritdoc}
20    */
21    protected $openidIdentifier = 'https://www.sandbox.paypal.com/webapps/auth/server';
22
23    /**
24    * {@inheritdoc}
25    */
26    public function authenticateBegin()
27    {
28        $this->openIdClient->identity  = $this->openidIdentifier;
29        $this->openIdClient->returnUrl = $this->callback;
30        $this->openIdClient->required  = [
31            'namePerson/prefix',
32            'namePerson/first',
33            'namePerson/last',
34            'namePerson/middle',
35            'namePerson/suffix',
36            'namePerson/friendly',
37            'person/guid',
38            'birthDate/birthYear',
39            'birthDate/birthMonth',
40            'birthDate/birthday',
41            'gender',
42            'language/pref',
43            'contact/phone/default',
44            'contact/phone/home',
45            'contact/phone/business',
46            'contact/phone/cell',
47            'contact/phone/fax',
48            'contact/postaladdress/home',
49            'contact/postaladdressadditional/home',
50            'contact/city/home',
51            'contact/state/home',
52            'contact/country/home',
53            'contact/postalcode/home',
54            'contact/postaladdress/business',
55            'contact/postaladdressadditional/business',
56            'contact/city/business',
57            'contact/state/business',
58            'contact/country/business',
59            'contact/postalcode/business',
60            'company/name',
61            'company/title',
62        ];
63
64        HttpClient\Util::redirect($this->openIdClient->authUrl());
65    }
66}
67