PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13
1.8.13 1.8.12.3 1.8.12.2 1.8.12.1 1.8.12 1.8.11.3 1.8.11.2 1.8.11.1 1.8.11 1.6.6 1.6.60 1.6.7 1.6.8 1.6.9 1.7.0 1.7.0.1 1.7.0.11 1.7.0.12 1.7.0.14 1.7.0.2 1.7.0.3 1.7.0.5 1.7.0.6 1.7.0.7 1.7.0.9 All 211 releases
charitable / vendor / square / square / src / Subscriptions / Requests / CreateSubscriptionRequest.php

CreateSubscriptionRequest.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13, at vendor/square/square/src/Subscriptions/Requests/CreateSubscriptionRequest.php

384 lines 10.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Square\Subscriptions\Requests;
4
5 use Square\Core\Json\JsonSerializableType;
6 use Square\Core\Json\JsonProperty;
7 use Square\Types\Money;
8 use Square\Types\SubscriptionSource;
9 use Square\Types\Phase;
10 use Square\Core\Types\ArrayType;
11
12 class CreateSubscriptionRequest extends JsonSerializableType
13 {
14 /**
15 * A unique string that identifies this `CreateSubscription` request.
16 * If you do not provide a unique string (or provide an empty string as the value),
17 * the endpoint treats each request as independent.
18 *
19 * For more information, see [Idempotency keys](https://developer.squareup.com/docs/build-basics/common-api-patterns/idempotency).
20 *
21 * @var ?string $idempotencyKey
22 */
23 #[JsonProperty('idempotency_key')]
24 private ?string $idempotencyKey;
25
26 /**
27 * @var string $locationId The ID of the location the subscription is associated with.
28 */
29 #[JsonProperty('location_id')]
30 private string $locationId;
31
32 /**
33 * @var ?string $planVariationId The ID of the [subscription plan variation](https://developer.squareup.com/docs/subscriptions-api/plans-and-variations#plan-variations) created using the Catalog API.
34 */
35 #[JsonProperty('plan_variation_id')]
36 private ?string $planVariationId;
37
38 /**
39 * @var string $customerId The ID of the [customer](entity:Customer) subscribing to the subscription plan variation.
40 */
41 #[JsonProperty('customer_id')]
42 private string $customerId;
43
44 /**
45 * The `YYYY-MM-DD`-formatted date to start the subscription.
46 * If it is unspecified, the subscription starts immediately.
47 *
48 * @var ?string $startDate
49 */
50 #[JsonProperty('start_date')]
51 private ?string $startDate;
52
53 /**
54 * The `YYYY-MM-DD`-formatted date when the newly created subscription is scheduled for cancellation.
55 *
56 * This date overrides the cancellation date set in the plan variation configuration.
57 * If the cancellation date is earlier than the end date of a subscription cycle, the subscription stops
58 * at the canceled date and the subscriber is sent a prorated invoice at the beginning of the canceled cycle.
59 *
60 * When the subscription plan of the newly created subscription has a fixed number of cycles and the `canceled_date`
61 * occurs before the subscription plan expires, the specified `canceled_date` sets the date when the subscription
62 * stops through the end of the last cycle.
63 *
64 * @var ?string $canceledDate
65 */
66 #[JsonProperty('canceled_date')]
67 private ?string $canceledDate;
68
69 /**
70 * The tax to add when billing the subscription.
71 * The percentage is expressed in decimal form, using a `'.'` as the decimal
72 * separator and without a `'%'` sign. For example, a value of 7.5
73 * corresponds to 7.5%.
74 *
75 * @var ?string $taxPercentage
76 */
77 #[JsonProperty('tax_percentage')]
78 private ?string $taxPercentage;
79
80 /**
81 * A custom price which overrides the cost of a subscription plan variation with `STATIC` pricing.
82 * This field does not affect itemized subscriptions with `RELATIVE` pricing. Instead,
83 * you should edit the Subscription's [order template](https://developer.squareup.com/docs/subscriptions-api/manage-subscriptions#phases-and-order-templates).
84 *
85 * @var ?Money $priceOverrideMoney
86 */
87 #[JsonProperty('price_override_money')]
88 private ?Money $priceOverrideMoney;
89
90 /**
91 * The ID of the [subscriber's](entity:Customer) [card](entity:Card) to charge.
92 * If it is not specified, the subscriber receives an invoice via email with a link to pay for their subscription.
93 *
94 * @var ?string $cardId
95 */
96 #[JsonProperty('card_id')]
97 private ?string $cardId;
98
99 /**
100 * The timezone that is used in date calculations for the subscription. If unset, defaults to
101 * the location timezone. If a timezone is not configured for the location, defaults to "America/New_York".
102 * Format: the IANA Timezone Database identifier for the location timezone. For
103 * a list of time zones, see [List of tz database time zones](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
104 *
105 * @var ?string $timezone
106 */
107 #[JsonProperty('timezone')]
108 private ?string $timezone;
109
110 /**
111 * @var ?SubscriptionSource $source The origination details of the subscription.
112 */
113 #[JsonProperty('source')]
114 private ?SubscriptionSource $source;
115
116 /**
117 * @var ?int $monthlyBillingAnchorDate The day-of-the-month to change the billing date to.
118 */
119 #[JsonProperty('monthly_billing_anchor_date')]
120 private ?int $monthlyBillingAnchorDate;
121
122 /**
123 * @var ?array<Phase> $phases array of phases for this subscription
124 */
125 #[JsonProperty('phases'), ArrayType([Phase::class])]
126 private ?array $phases;
127
128 /**
129 * @param array{
130 * locationId: string,
131 * customerId: string,
132 * idempotencyKey?: ?string,
133 * planVariationId?: ?string,
134 * startDate?: ?string,
135 * canceledDate?: ?string,
136 * taxPercentage?: ?string,
137 * priceOverrideMoney?: ?Money,
138 * cardId?: ?string,
139 * timezone?: ?string,
140 * source?: ?SubscriptionSource,
141 * monthlyBillingAnchorDate?: ?int,
142 * phases?: ?array<Phase>,
143 * } $values
144 */
145 public function __construct(
146 array $values,
147 ) {
148 $this->idempotencyKey = $values['idempotencyKey'] ?? null;
149 $this->locationId = $values['locationId'];
150 $this->planVariationId = $values['planVariationId'] ?? null;
151 $this->customerId = $values['customerId'];
152 $this->startDate = $values['startDate'] ?? null;
153 $this->canceledDate = $values['canceledDate'] ?? null;
154 $this->taxPercentage = $values['taxPercentage'] ?? null;
155 $this->priceOverrideMoney = $values['priceOverrideMoney'] ?? null;
156 $this->cardId = $values['cardId'] ?? null;
157 $this->timezone = $values['timezone'] ?? null;
158 $this->source = $values['source'] ?? null;
159 $this->monthlyBillingAnchorDate = $values['monthlyBillingAnchorDate'] ?? null;
160 $this->phases = $values['phases'] ?? null;
161 }
162
163 /**
164 * @return ?string
165 */
166 public function getIdempotencyKey(): ?string
167 {
168 return $this->idempotencyKey;
169 }
170
171 /**
172 * @param ?string $value
173 */
174 public function setIdempotencyKey(?string $value = null): self
175 {
176 $this->idempotencyKey = $value;
177 return $this;
178 }
179
180 /**
181 * @return string
182 */
183 public function getLocationId(): string
184 {
185 return $this->locationId;
186 }
187
188 /**
189 * @param string $value
190 */
191 public function setLocationId(string $value): self
192 {
193 $this->locationId = $value;
194 return $this;
195 }
196
197 /**
198 * @return ?string
199 */
200 public function getPlanVariationId(): ?string
201 {
202 return $this->planVariationId;
203 }
204
205 /**
206 * @param ?string $value
207 */
208 public function setPlanVariationId(?string $value = null): self
209 {
210 $this->planVariationId = $value;
211 return $this;
212 }
213
214 /**
215 * @return string
216 */
217 public function getCustomerId(): string
218 {
219 return $this->customerId;
220 }
221
222 /**
223 * @param string $value
224 */
225 public function setCustomerId(string $value): self
226 {
227 $this->customerId = $value;
228 return $this;
229 }
230
231 /**
232 * @return ?string
233 */
234 public function getStartDate(): ?string
235 {
236 return $this->startDate;
237 }
238
239 /**
240 * @param ?string $value
241 */
242 public function setStartDate(?string $value = null): self
243 {
244 $this->startDate = $value;
245 return $this;
246 }
247
248 /**
249 * @return ?string
250 */
251 public function getCanceledDate(): ?string
252 {
253 return $this->canceledDate;
254 }
255
256 /**
257 * @param ?string $value
258 */
259 public function setCanceledDate(?string $value = null): self
260 {
261 $this->canceledDate = $value;
262 return $this;
263 }
264
265 /**
266 * @return ?string
267 */
268 public function getTaxPercentage(): ?string
269 {
270 return $this->taxPercentage;
271 }
272
273 /**
274 * @param ?string $value
275 */
276 public function setTaxPercentage(?string $value = null): self
277 {
278 $this->taxPercentage = $value;
279 return $this;
280 }
281
282 /**
283 * @return ?Money
284 */
285 public function getPriceOverrideMoney(): ?Money
286 {
287 return $this->priceOverrideMoney;
288 }
289
290 /**
291 * @param ?Money $value
292 */
293 public function setPriceOverrideMoney(?Money $value = null): self
294 {
295 $this->priceOverrideMoney = $value;
296 return $this;
297 }
298
299 /**
300 * @return ?string
301 */
302 public function getCardId(): ?string
303 {
304 return $this->cardId;
305 }
306
307 /**
308 * @param ?string $value
309 */
310 public function setCardId(?string $value = null): self
311 {
312 $this->cardId = $value;
313 return $this;
314 }
315
316 /**
317 * @return ?string
318 */
319 public function getTimezone(): ?string
320 {
321 return $this->timezone;
322 }
323
324 /**
325 * @param ?string $value
326 */
327 public function setTimezone(?string $value = null): self
328 {
329 $this->timezone = $value;
330 return $this;
331 }
332
333 /**
334 * @return ?SubscriptionSource
335 */
336 public function getSource(): ?SubscriptionSource
337 {
338 return $this->source;
339 }
340
341 /**
342 * @param ?SubscriptionSource $value
343 */
344 public function setSource(?SubscriptionSource $value = null): self
345 {
346 $this->source = $value;
347 return $this;
348 }
349
350 /**
351 * @return ?int
352 */
353 public function getMonthlyBillingAnchorDate(): ?int
354 {
355 return $this->monthlyBillingAnchorDate;
356 }
357
358 /**
359 * @param ?int $value
360 */
361 public function setMonthlyBillingAnchorDate(?int $value = null): self
362 {
363 $this->monthlyBillingAnchorDate = $value;
364 return $this;
365 }
366
367 /**
368 * @return ?array<Phase>
369 */
370 public function getPhases(): ?array
371 {
372 return $this->phases;
373 }
374
375 /**
376 * @param ?array<Phase> $value
377 */
378 public function setPhases(?array $value = null): self
379 {
380 $this->phases = $value;
381 return $this;
382 }
383 }
384