Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Stripe.php
01 <?php
02
03 namespace OAuth\OAuth2\Service;
04
05 use OAuth\Common\Consumer\CredentialsInterface;
06 use OAuth\Common\Http\Client\ClientInterface;
07 use OAuth\Common\Http\Exception\TokenResponseException;
08 use OAuth\Common\Http\Uri\Uri;
09 use OAuth\Common\Http\Uri\UriInterface;
10 use OAuth\Common\Storage\TokenStorageInterface;
11 use OAuth\OAuth2\Token\StdOAuth2Token;
12
13 class Stripe extends AbstractService
14 {
15 const SCOPE_READONLY = 'read_only';
16 const SCOPE_READWRITE = 'read_write';
17
18 public function __construct(
19 CredentialsInterface $credentials,
20 ClientInterface $httpClient,
21 TokenStorageInterface $storage,
22 $scopes = [],
23 ?UriInterface $baseApiUri = null
24 ) {
25 parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri);
26
27 if (null === $baseApiUri) {
28 $this->baseApiUri = new Uri('https://connect.stripe.com/');
29 }
30 }
31
32 /**
33 * {@inheritdoc}
34 */
35 public function getAuthorizationEndpoint()
36 {
37 return new Uri('https://connect.stripe.com/oauth/authorize');
38 }
39
40 /**
41 * {@inheritdoc}
42 */
43 public function getAccessTokenEndpoint()
44 {
45 return new Uri('https://connect.stripe.com/oauth/token');
46 }
47
48 /**
49 * {@inheritdoc}
50 */
51 protected function getAuthorizationMethod()
52 {
53 return static::AUTHORIZATION_METHOD_QUERY_STRING;
54 }
55
56 /**
57 * {@inheritdoc}
58 */
59 protected function parseAccessTokenResponse($responseBody)
60 {
61 $data = json_decode($responseBody, true);
62
63 if (null === $data || !is_array($data)) {
64 throw new TokenResponseException('Unable to parse response.');
65 } elseif (isset($data['error'])) {
66 throw new TokenResponseException('Error in retrieving token: "' . $data['error'] . '"');
67 }
68
69 $token = new StdOAuth2Token();
70 $token->setAccessToken($data['access_token']);
71
72 unset($data['access_token']);
73
74 $token->setExtraParams($data);
75
76 return $token;
77 }
78 }
79