1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace AdamPaterson\OAuth2\Client\Provider; |
5
|
|
|
|
6
|
|
|
use League\OAuth2\Client\Provider\ResourceOwnerInterface; |
7
|
|
|
|
8
|
|
|
class StripeResourceOwner implements ResourceOwnerInterface |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* Raw response |
12
|
|
|
* |
13
|
|
|
* @var array |
14
|
|
|
*/ |
15
|
|
|
protected $response; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Set response |
19
|
|
|
* |
20
|
|
|
* @param array $response |
21
|
|
|
*/ |
22
|
3 |
|
public function __construct(array $response) |
23
|
|
|
{ |
24
|
3 |
|
$this->response = $response; |
25
|
3 |
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Get Stripe account id |
29
|
|
|
* |
30
|
|
|
* @return string |
31
|
|
|
*/ |
32
|
3 |
|
public function getId() |
33
|
|
|
{ |
34
|
3 |
|
return $this->response['id']; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Return all of the account details available as an array |
39
|
|
|
* |
40
|
|
|
* @return array |
41
|
|
|
*/ |
42
|
3 |
|
public function toArray() |
43
|
|
|
{ |
44
|
3 |
|
return $this->response; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* The primary user’s email address |
49
|
|
|
* |
50
|
|
|
* @return string |
51
|
|
|
*/ |
52
|
3 |
|
public function getEmail() |
53
|
|
|
{ |
54
|
3 |
|
return $this->response['email']; |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* The text that will appear on credit card statements |
59
|
|
|
* |
60
|
|
|
* @return string |
61
|
|
|
*/ |
62
|
3 |
|
public function getStatementDescriptor() |
63
|
|
|
{ |
64
|
3 |
|
return $this->response['statement_descriptor']; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* A publicly shareable email address that can be reached for support for this account |
69
|
|
|
* |
70
|
|
|
* @return string |
71
|
|
|
*/ |
72
|
3 |
|
public function getDisplayName() |
73
|
|
|
{ |
74
|
3 |
|
return $this->response['display_name']; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* The timezone used in the Stripe dashboard for this account. |
79
|
|
|
* |
80
|
|
|
* @return string |
81
|
|
|
*/ |
82
|
3 |
|
public function getTimezone() |
83
|
|
|
{ |
84
|
3 |
|
return $this->response['timezone']; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Whether or not account details have been submitted yet. |
89
|
|
|
* Standalone accounts cannot receive transfers before this is true. |
90
|
|
|
* |
91
|
|
|
* @return bool |
92
|
|
|
*/ |
93
|
3 |
|
public function getDetailsSubmitted() |
94
|
|
|
{ |
95
|
3 |
|
return $this->response['details_submitted']; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Whether or not the account can create live charges |
100
|
|
|
* |
101
|
|
|
* @return bool |
102
|
|
|
*/ |
103
|
3 |
|
public function getChargesEnabled() |
104
|
|
|
{ |
105
|
3 |
|
return $this->response['charges_enabled']; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Whether or not Stripe will send automatic transfers for this account. |
110
|
|
|
* This is only false when Stripe is waiting for additional information from the account holder. |
111
|
|
|
* |
112
|
|
|
* @return bool |
113
|
|
|
*/ |
114
|
3 |
|
public function getTransfersEnabled() |
115
|
|
|
{ |
116
|
3 |
|
return $this->response['transfers_enabled']; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* The currencies this account can submit when creating charges |
121
|
|
|
* |
122
|
|
|
* @return array |
123
|
|
|
*/ |
124
|
3 |
|
public function getCurrenciesSupported() |
125
|
|
|
{ |
126
|
3 |
|
return $this->response['currencies_supported']; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* The currency this account has chosen to use as the default |
131
|
|
|
* |
132
|
|
|
* @return string |
133
|
|
|
*/ |
134
|
3 |
|
public function getDefaultCurrency() |
135
|
|
|
{ |
136
|
3 |
|
return $this->response['default_currency']; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* The country of the account |
141
|
|
|
* |
142
|
|
|
* @return string |
143
|
|
|
*/ |
144
|
3 |
|
public function getCountry() |
145
|
|
|
{ |
146
|
3 |
|
return $this->response['country']; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* The object requested. Will always return "account" |
151
|
|
|
* |
152
|
|
|
* @return string |
153
|
|
|
*/ |
154
|
3 |
|
public function getObject() |
155
|
|
|
{ |
156
|
3 |
|
return $this->response['object']; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* The publicly visible name of the business |
161
|
|
|
* |
162
|
|
|
* @return string |
163
|
|
|
*/ |
164
|
3 |
|
public function getBusinessName() |
165
|
|
|
{ |
166
|
3 |
|
return $this->response['business_name']; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* A publicly shareable URL that can be reached for support for this account |
171
|
|
|
* |
172
|
|
|
* @return string |
173
|
|
|
*/ |
174
|
3 |
|
public function getBusinessUrl() |
175
|
|
|
{ |
176
|
3 |
|
return $this->response['business_url']; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* The publicly visible support phone number for the business |
181
|
|
|
* |
182
|
|
|
* @return string |
183
|
|
|
*/ |
184
|
3 |
|
public function getSupportPhone() |
185
|
|
|
{ |
186
|
3 |
|
return $this->response['support_phone']; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* The publicly visible logo url |
191
|
|
|
* |
192
|
|
|
* @return string |
193
|
|
|
*/ |
194
|
3 |
|
public function getBusinessLogo() |
195
|
|
|
{ |
196
|
3 |
|
return $this->response['business_logo']; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* Updatable Stripe objects |
201
|
|
|
* |
202
|
|
|
* @see https://stripe.com/docs/api/curl#metadata |
203
|
|
|
* @return array |
204
|
|
|
*/ |
205
|
3 |
|
public function getMetaData() |
206
|
|
|
{ |
207
|
3 |
|
return $this->response['metadata']; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
/** |
211
|
|
|
* Whether or not the account is managed by your platform. |
212
|
|
|
* Returns null if the account was not created by a platform. |
213
|
|
|
* |
214
|
|
|
* @return bool |
215
|
|
|
*/ |
216
|
3 |
|
public function getManaged() |
217
|
|
|
{ |
218
|
3 |
|
return $this->response['managed']; |
219
|
|
|
} |
220
|
|
|
} |
221
|
|
|
|