PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.7.2
GiveWP – Donation Plugin and Fundraising Platform v2.7.2
4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / vendor / stripe / stripe-php / lib / Customer.php
give / vendor / stripe / stripe-php / lib Last commit date
ApiOperations 6 years ago Checkout 6 years ago Error 6 years ago HttpClient 6 years ago Issuing 6 years ago Radar 6 years ago Reporting 6 years ago Sigma 6 years ago Terminal 6 years ago Util 6 years ago Account.php 6 years ago AccountLink.php 6 years ago AlipayAccount.php 6 years ago ApiRequestor.php 6 years ago ApiResource.php 6 years ago ApiResponse.php 6 years ago ApplePayDomain.php 6 years ago ApplicationFee.php 6 years ago ApplicationFeeRefund.php 6 years ago Balance.php 6 years ago BalanceTransaction.php 6 years ago BankAccount.php 6 years ago BitcoinReceiver.php 6 years ago BitcoinTransaction.php 6 years ago Capability.php 6 years ago Card.php 6 years ago Charge.php 6 years ago Collection.php 6 years ago CountrySpec.php 6 years ago Coupon.php 6 years ago CreditNote.php 6 years ago Customer.php 6 years ago CustomerBalanceTransaction.php 6 years ago Discount.php 6 years ago Dispute.php 6 years ago EphemeralKey.php 6 years ago Event.php 6 years ago ExchangeRate.php 6 years ago File.php 6 years ago FileLink.php 6 years ago FileUpload.php 6 years ago Invoice.php 6 years ago InvoiceItem.php 6 years ago InvoiceLineItem.php 6 years ago IssuerFraudRecord.php 6 years ago LoginLink.php 6 years ago OAuth.php 6 years ago Order.php 6 years ago OrderItem.php 6 years ago OrderReturn.php 6 years ago PaymentIntent.php 6 years ago PaymentMethod.php 6 years ago Payout.php 6 years ago Person.php 6 years ago Plan.php 6 years ago Product.php 6 years ago Recipient.php 6 years ago RecipientTransfer.php 6 years ago Refund.php 6 years ago RequestTelemetry.php 6 years ago Review.php 6 years ago SKU.php 6 years ago SetupIntent.php 6 years ago SingletonApiResource.php 6 years ago Source.php 6 years ago SourceTransaction.php 6 years ago Stripe.php 6 years ago StripeObject.php 6 years ago Subscription.php 6 years ago SubscriptionItem.php 6 years ago SubscriptionSchedule.php 6 years ago TaxId.php 6 years ago TaxRate.php 6 years ago ThreeDSecure.php 6 years ago Token.php 6 years ago Topup.php 6 years ago Transfer.php 6 years ago TransferReversal.php 6 years ago UsageRecord.php 6 years ago UsageRecordSummary.php 6 years ago Webhook.php 6 years ago WebhookEndpoint.php 6 years ago WebhookSignature.php 6 years ago
Customer.php
320 lines
1 <?php
2
3 namespace Stripe;
4
5 /**
6 * Class Customer
7 *
8 * @property string $id
9 * @property string $object
10 * @property mixed $address
11 * @property int $balance
12 * @property string $created
13 * @property string $currency
14 * @property string $default_source
15 * @property bool $delinquent
16 * @property string $description
17 * @property Discount $discount
18 * @property string $email
19 * @property string $invoice_prefix
20 * @property mixed $invoice_settings
21 * @property bool $livemode
22 * @property StripeObject $metadata
23 * @property string $name
24 * @property string $phone
25 * @property string[] preferred_locales
26 * @property mixed $shipping
27 * @property Collection $sources
28 * @property Collection $subscriptions
29 * @property string $tax_exempt
30 * @property Collection $tax_ids
31 *
32 * @package Stripe
33 */
34 class Customer extends ApiResource
35 {
36 const OBJECT_NAME = "customer";
37
38 use ApiOperations\All;
39 use ApiOperations\Create;
40 use ApiOperations\Delete;
41 use ApiOperations\NestedResource;
42 use ApiOperations\Retrieve;
43 use ApiOperations\Update;
44
45 /**
46 * Possible string representations of the customer's type of tax exemption.
47 * @link https://stripe.com/docs/api/customers/object#customer_object-tax_exempt
48 */
49 const TAX_EXEMPT_NONE = 'none';
50 const TAX_EXEMPT_EXEMPT = 'exempt';
51 const TAX_EXEMPT_REVERSE = 'reverse';
52
53 public static function getSavedNestedResources()
54 {
55 static $savedNestedResources = null;
56 if ($savedNestedResources === null) {
57 $savedNestedResources = new Util\Set([
58 'source',
59 ]);
60 }
61 return $savedNestedResources;
62 }
63
64 const PATH_BALANCE_TRANSACTIONS = '/balance_transactions';
65 const PATH_SOURCES = '/sources';
66 const PATH_TAX_IDS = '/tax_ids';
67
68 /**
69 * @param array|null $params
70 *
71 * @return InvoiceItem The resulting invoice item.
72 */
73 public function addInvoiceItem($params = null)
74 {
75 $params = $params ?: [];
76 $params['customer'] = $this->id;
77 $ii = InvoiceItem::create($params, $this->_opts);
78 return $ii;
79 }
80
81 /**
82 * @param array|null $params
83 *
84 * @return array An array of the customer's Invoices.
85 */
86 public function invoices($params = null)
87 {
88 $params = $params ?: [];
89 $params['customer'] = $this->id;
90 $invoices = Invoice::all($params, $this->_opts);
91 return $invoices;
92 }
93
94 /**
95 * @param array|null $params
96 *
97 * @return array An array of the customer's InvoiceItems.
98 */
99 public function invoiceItems($params = null)
100 {
101 $params = $params ?: [];
102 $params['customer'] = $this->id;
103 $iis = InvoiceItem::all($params, $this->_opts);
104 return $iis;
105 }
106
107 /**
108 * @param array|null $params
109 *
110 * @return array An array of the customer's Charges.
111 */
112 public function charges($params = null)
113 {
114 $params = $params ?: [];
115 $params['customer'] = $this->id;
116 $charges = Charge::all($params, $this->_opts);
117 return $charges;
118 }
119
120 /**
121 * @param array|null $params
122 *
123 * @return Subscription The updated subscription.
124 */
125 public function updateSubscription($params = null)
126 {
127 $url = $this->instanceUrl() . '/subscription';
128 list($response, $opts) = $this->_request('post', $url, $params);
129 $this->refreshFrom(['subscription' => $response], $opts, true);
130 return $this->subscription;
131 }
132
133 /**
134 * @param array|null $params
135 *
136 * @return Subscription The cancelled subscription.
137 */
138 public function cancelSubscription($params = null)
139 {
140 $url = $this->instanceUrl() . '/subscription';
141 list($response, $opts) = $this->_request('delete', $url, $params);
142 $this->refreshFrom(['subscription' => $response], $opts, true);
143 return $this->subscription;
144 }
145
146 /**
147 * @return Customer The updated customer.
148 */
149 public function deleteDiscount()
150 {
151 $url = $this->instanceUrl() . '/discount';
152 list($response, $opts) = $this->_request('delete', $url);
153 $this->refreshFrom(['discount' => null], $opts, true);
154 }
155
156 /**
157 * @param string|null $id The ID of the customer on which to create the source.
158 * @param array|null $params
159 * @param array|string|null $opts
160 *
161 * @return ApiResource
162 */
163 public static function createSource($id, $params = null, $opts = null)
164 {
165 return self::_createNestedResource($id, static::PATH_SOURCES, $params, $opts);
166 }
167
168 /**
169 * @param string|null $id The ID of the customer to which the source belongs.
170 * @param string|null $sourceId The ID of the source to retrieve.
171 * @param array|null $params
172 * @param array|string|null $opts
173 *
174 * @return ApiResource
175 */
176 public static function retrieveSource($id, $sourceId, $params = null, $opts = null)
177 {
178 return self::_retrieveNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
179 }
180
181 /**
182 * @param string|null $id The ID of the customer to which the source belongs.
183 * @param string|null $sourceId The ID of the source to update.
184 * @param array|null $params
185 * @param array|string|null $opts
186 *
187 * @return ApiResource
188 */
189 public static function updateSource($id, $sourceId, $params = null, $opts = null)
190 {
191 return self::_updateNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
192 }
193
194 /**
195 * @param string|null $id The ID of the customer to which the source belongs.
196 * @param string|null $sourceId The ID of the source to delete.
197 * @param array|null $params
198 * @param array|string|null $opts
199 *
200 * @return ApiResource
201 */
202 public static function deleteSource($id, $sourceId, $params = null, $opts = null)
203 {
204 return self::_deleteNestedResource($id, static::PATH_SOURCES, $sourceId, $params, $opts);
205 }
206
207 /**
208 * @param string|null $id The ID of the customer on which to retrieve the sources.
209 * @param array|null $params
210 * @param array|string|null $opts
211 *
212 * @return Collection The list of sources.
213 */
214 public static function allSources($id, $params = null, $opts = null)
215 {
216 return self::_allNestedResources($id, static::PATH_SOURCES, $params, $opts);
217 }
218
219 /**
220 * @param string|null $id The ID of the customer on which to create the tax id.
221 * @param array|null $params
222 * @param array|string|null $opts
223 *
224 * @return ApiResource
225 */
226 public static function createTaxId($id, $params = null, $opts = null)
227 {
228 return self::_createNestedResource($id, static::PATH_TAX_IDS, $params, $opts);
229 }
230
231 /**
232 * @param string|null $id The ID of the customer to which the tax id belongs.
233 * @param string|null $taxIdId The ID of the tax id to retrieve.
234 * @param array|null $params
235 * @param array|string|null $opts
236 *
237 * @return ApiResource
238 */
239 public static function retrieveTaxId($id, $taxIdId, $params = null, $opts = null)
240 {
241 return self::_retrieveNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
242 }
243
244 /**
245 * @param string|null $id The ID of the customer to which the tax id belongs.
246 * @param string|null $taxIdId The ID of the tax id to delete.
247 * @param array|null $params
248 * @param array|string|null $opts
249 *
250 * @return ApiResource
251 */
252 public static function deleteTaxId($id, $taxIdId, $params = null, $opts = null)
253 {
254 return self::_deleteNestedResource($id, static::PATH_TAX_IDS, $taxIdId, $params, $opts);
255 }
256
257 /**
258 * @param string|null $id The ID of the customer on which to retrieve the tax ids.
259 * @param array|null $params
260 * @param array|string|null $opts
261 *
262 * @return Collection The list of tax ids.
263 */
264 public static function allTaxIds($id, $params = null, $opts = null)
265 {
266 return self::_allNestedResources($id, static::PATH_TAX_IDS, $params, $opts);
267 }
268
269 /**
270 * @param string|null $id The ID of the customer on which to create the balance transaction.
271 * @param array|null $params
272 * @param array|string|null $opts
273 *
274 * @return ApiResource
275 */
276 public static function createBalanceTransaction($id, $params = null, $opts = null)
277 {
278 return self::_createNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
279 }
280
281 /**
282 * @param string|null $id The ID of the customer to which the balance transaction belongs.
283 * @param string|null $balanceTransactionId The ID of the balance transaction to retrieve.
284 * @param array|null $params
285 * @param array|string|null $opts
286 *
287 * @return ApiResource
288 */
289 public static function retrieveBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
290 {
291 return self::_retrieveNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
292 }
293
294 /**
295 * @param string|null $id The ID of the customer on which to update the balance transaction.
296 * @param string|null $balanceTransactionId The ID of the balance transaction to update.
297 * @param array|null $params
298 * @param array|string|null $opts
299 *
300 *
301 * @return ApiResource
302 */
303 public static function updateBalanceTransaction($id, $balanceTransactionId, $params = null, $opts = null)
304 {
305 return self::_updateNestedResource($id, static::PATH_BALANCE_TRANSACTIONS, $balanceTransactionId, $params, $opts);
306 }
307
308 /**
309 * @param string|null $id The ID of the customer on which to retrieve the customer balance transactions.
310 * @param array|null $params
311 * @param array|string|null $opts
312 *
313 * @return Collection The list of customer balance transactions.
314 */
315 public static function allBalanceTransactions($id, $params = null, $opts = null)
316 {
317 return self::_allNestedResources($id, static::PATH_BALANCE_TRANSACTIONS, $params, $opts);
318 }
319 }
320