PluginProbe
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) / 1.8.13.1
Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) v1.8.13.1
1.8.13.1 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 All 212 releases
charitable / vendor / square / square / src / Legacy / Models / Customer.php

Customer.php in Charitable – Donation & Fundraising Platform (Donation Forms, Recurring Donations & Fundraising Campaigns) 1.8.13.1, at vendor/square/square/src/Legacy/Models/Customer.php

801 lines 20.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Square\Legacy\Models;
6
7 use stdClass;
8
9 /**
10 * Represents a Square customer profile in the Customer Directory of a Square seller.
11 */
12 class Customer implements \JsonSerializable
13 {
14 /**
15 * @var string|null
16 */
17 private $id;
18
19 /**
20 * @var string|null
21 */
22 private $createdAt;
23
24 /**
25 * @var string|null
26 */
27 private $updatedAt;
28
29 /**
30 * @var array
31 */
32 private $cards = [];
33
34 /**
35 * @var array
36 */
37 private $givenName = [];
38
39 /**
40 * @var array
41 */
42 private $familyName = [];
43
44 /**
45 * @var array
46 */
47 private $nickname = [];
48
49 /**
50 * @var array
51 */
52 private $companyName = [];
53
54 /**
55 * @var array
56 */
57 private $emailAddress = [];
58
59 /**
60 * @var Address|null
61 */
62 private $address;
63
64 /**
65 * @var array
66 */
67 private $phoneNumber = [];
68
69 /**
70 * @var array
71 */
72 private $birthday = [];
73
74 /**
75 * @var array
76 */
77 private $referenceId = [];
78
79 /**
80 * @var array
81 */
82 private $note = [];
83
84 /**
85 * @var CustomerPreferences|null
86 */
87 private $preferences;
88
89 /**
90 * @var string|null
91 */
92 private $creationSource;
93
94 /**
95 * @var array
96 */
97 private $groupIds = [];
98
99 /**
100 * @var array
101 */
102 private $segmentIds = [];
103
104 /**
105 * @var int|null
106 */
107 private $version;
108
109 /**
110 * @var CustomerTaxIds|null
111 */
112 private $taxIds;
113
114 /**
115 * Returns Id.
116 * A unique Square-assigned ID for the customer profile.
117 *
118 * If you need this ID for an API request, use the ID returned when you created the customer profile or
119 * call the [SearchCustomers](api-endpoint:Customers-SearchCustomers)
120 * or [ListCustomers](api-endpoint:Customers-ListCustomers) endpoint.
121 */
122 public function getId(): ?string
123 {
124 return $this->id;
125 }
126
127 /**
128 * Sets Id.
129 * A unique Square-assigned ID for the customer profile.
130 *
131 * If you need this ID for an API request, use the ID returned when you created the customer profile or
132 * call the [SearchCustomers](api-endpoint:Customers-SearchCustomers)
133 * or [ListCustomers](api-endpoint:Customers-ListCustomers) endpoint.
134 *
135 * @maps id
136 */
137 public function setId(?string $id): void
138 {
139 $this->id = $id;
140 }
141
142 /**
143 * Returns Created At.
144 * The timestamp when the customer profile was created, in RFC 3339 format.
145 */
146 public function getCreatedAt(): ?string
147 {
148 return $this->createdAt;
149 }
150
151 /**
152 * Sets Created At.
153 * The timestamp when the customer profile was created, in RFC 3339 format.
154 *
155 * @maps created_at
156 */
157 public function setCreatedAt(?string $createdAt): void
158 {
159 $this->createdAt = $createdAt;
160 }
161
162 /**
163 * Returns Updated At.
164 * The timestamp when the customer profile was last updated, in RFC 3339 format.
165 */
166 public function getUpdatedAt(): ?string
167 {
168 return $this->updatedAt;
169 }
170
171 /**
172 * Sets Updated At.
173 * The timestamp when the customer profile was last updated, in RFC 3339 format.
174 *
175 * @maps updated_at
176 */
177 public function setUpdatedAt(?string $updatedAt): void
178 {
179 $this->updatedAt = $updatedAt;
180 }
181
182 /**
183 * Returns Cards.
184 * Payment details of the credit, debit, and gift cards stored on file for the customer profile.
185 *
186 * DEPRECATED at version 2021-06-16 and will be RETIRED at version 2024-12-18. Replaced by calling
187 * [ListCards](api-endpoint:Cards-ListCards) (for credit and debit cards on file)
188 * or [ListGiftCards](api-endpoint:GiftCards-ListGiftCards) (for gift cards on file) and including the
189 * `customer_id` query parameter.
190 * For more information, see [Migration notes](https://developer.squareup.com/docs/customers-api/what-
191 * it-does#migrate-customer-cards).
192 *
193 * @return Card[]|null
194 */
195 public function getCards(): ?array
196 {
197 if (count($this->cards) == 0) {
198 return null;
199 }
200 return $this->cards['value'];
201 }
202
203 /**
204 * Sets Cards.
205 * Payment details of the credit, debit, and gift cards stored on file for the customer profile.
206 *
207 * DEPRECATED at version 2021-06-16 and will be RETIRED at version 2024-12-18. Replaced by calling
208 * [ListCards](api-endpoint:Cards-ListCards) (for credit and debit cards on file)
209 * or [ListGiftCards](api-endpoint:GiftCards-ListGiftCards) (for gift cards on file) and including the
210 * `customer_id` query parameter.
211 * For more information, see [Migration notes](https://developer.squareup.com/docs/customers-api/what-
212 * it-does#migrate-customer-cards).
213 *
214 * @maps cards
215 *
216 * @param Card[]|null $cards
217 */
218 public function setCards(?array $cards): void
219 {
220 $this->cards['value'] = $cards;
221 }
222
223 /**
224 * Unsets Cards.
225 * Payment details of the credit, debit, and gift cards stored on file for the customer profile.
226 *
227 * DEPRECATED at version 2021-06-16 and will be RETIRED at version 2024-12-18. Replaced by calling
228 * [ListCards](api-endpoint:Cards-ListCards) (for credit and debit cards on file)
229 * or [ListGiftCards](api-endpoint:GiftCards-ListGiftCards) (for gift cards on file) and including the
230 * `customer_id` query parameter.
231 * For more information, see [Migration notes](https://developer.squareup.com/docs/customers-api/what-
232 * it-does#migrate-customer-cards).
233 */
234 public function unsetCards(): void
235 {
236 $this->cards = [];
237 }
238
239 /**
240 * Returns Given Name.
241 * The given name (that is, the first name) associated with the customer profile.
242 */
243 public function getGivenName(): ?string
244 {
245 if (count($this->givenName) == 0) {
246 return null;
247 }
248 return $this->givenName['value'];
249 }
250
251 /**
252 * Sets Given Name.
253 * The given name (that is, the first name) associated with the customer profile.
254 *
255 * @maps given_name
256 */
257 public function setGivenName(?string $givenName): void
258 {
259 $this->givenName['value'] = $givenName;
260 }
261
262 /**
263 * Unsets Given Name.
264 * The given name (that is, the first name) associated with the customer profile.
265 */
266 public function unsetGivenName(): void
267 {
268 $this->givenName = [];
269 }
270
271 /**
272 * Returns Family Name.
273 * The family name (that is, the last name) associated with the customer profile.
274 */
275 public function getFamilyName(): ?string
276 {
277 if (count($this->familyName) == 0) {
278 return null;
279 }
280 return $this->familyName['value'];
281 }
282
283 /**
284 * Sets Family Name.
285 * The family name (that is, the last name) associated with the customer profile.
286 *
287 * @maps family_name
288 */
289 public function setFamilyName(?string $familyName): void
290 {
291 $this->familyName['value'] = $familyName;
292 }
293
294 /**
295 * Unsets Family Name.
296 * The family name (that is, the last name) associated with the customer profile.
297 */
298 public function unsetFamilyName(): void
299 {
300 $this->familyName = [];
301 }
302
303 /**
304 * Returns Nickname.
305 * A nickname for the customer profile.
306 */
307 public function getNickname(): ?string
308 {
309 if (count($this->nickname) == 0) {
310 return null;
311 }
312 return $this->nickname['value'];
313 }
314
315 /**
316 * Sets Nickname.
317 * A nickname for the customer profile.
318 *
319 * @maps nickname
320 */
321 public function setNickname(?string $nickname): void
322 {
323 $this->nickname['value'] = $nickname;
324 }
325
326 /**
327 * Unsets Nickname.
328 * A nickname for the customer profile.
329 */
330 public function unsetNickname(): void
331 {
332 $this->nickname = [];
333 }
334
335 /**
336 * Returns Company Name.
337 * A business name associated with the customer profile.
338 */
339 public function getCompanyName(): ?string
340 {
341 if (count($this->companyName) == 0) {
342 return null;
343 }
344 return $this->companyName['value'];
345 }
346
347 /**
348 * Sets Company Name.
349 * A business name associated with the customer profile.
350 *
351 * @maps company_name
352 */
353 public function setCompanyName(?string $companyName): void
354 {
355 $this->companyName['value'] = $companyName;
356 }
357
358 /**
359 * Unsets Company Name.
360 * A business name associated with the customer profile.
361 */
362 public function unsetCompanyName(): void
363 {
364 $this->companyName = [];
365 }
366
367 /**
368 * Returns Email Address.
369 * The email address associated with the customer profile.
370 */
371 public function getEmailAddress(): ?string
372 {
373 if (count($this->emailAddress) == 0) {
374 return null;
375 }
376 return $this->emailAddress['value'];
377 }
378
379 /**
380 * Sets Email Address.
381 * The email address associated with the customer profile.
382 *
383 * @maps email_address
384 */
385 public function setEmailAddress(?string $emailAddress): void
386 {
387 $this->emailAddress['value'] = $emailAddress;
388 }
389
390 /**
391 * Unsets Email Address.
392 * The email address associated with the customer profile.
393 */
394 public function unsetEmailAddress(): void
395 {
396 $this->emailAddress = [];
397 }
398
399 /**
400 * Returns Address.
401 * Represents a postal address in a country.
402 * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-
403 * basics/working-with-addresses).
404 */
405 public function getAddress(): ?Address
406 {
407 return $this->address;
408 }
409
410 /**
411 * Sets Address.
412 * Represents a postal address in a country.
413 * For more information, see [Working with Addresses](https://developer.squareup.com/docs/build-
414 * basics/working-with-addresses).
415 *
416 * @maps address
417 */
418 public function setAddress(?Address $address): void
419 {
420 $this->address = $address;
421 }
422
423 /**
424 * Returns Phone Number.
425 * The phone number associated with the customer profile.
426 */
427 public function getPhoneNumber(): ?string
428 {
429 if (count($this->phoneNumber) == 0) {
430 return null;
431 }
432 return $this->phoneNumber['value'];
433 }
434
435 /**
436 * Sets Phone Number.
437 * The phone number associated with the customer profile.
438 *
439 * @maps phone_number
440 */
441 public function setPhoneNumber(?string $phoneNumber): void
442 {
443 $this->phoneNumber['value'] = $phoneNumber;
444 }
445
446 /**
447 * Unsets Phone Number.
448 * The phone number associated with the customer profile.
449 */
450 public function unsetPhoneNumber(): void
451 {
452 $this->phoneNumber = [];
453 }
454
455 /**
456 * Returns Birthday.
457 * The birthday associated with the customer profile, in `YYYY-MM-DD` format. For example, `1998-09-
458 * 21`
459 * represents September 21, 1998, and `0000-09-21` represents September 21 (without a birth year).
460 */
461 public function getBirthday(): ?string
462 {
463 if (count($this->birthday) == 0) {
464 return null;
465 }
466 return $this->birthday['value'];
467 }
468
469 /**
470 * Sets Birthday.
471 * The birthday associated with the customer profile, in `YYYY-MM-DD` format. For example, `1998-09-
472 * 21`
473 * represents September 21, 1998, and `0000-09-21` represents September 21 (without a birth year).
474 *
475 * @maps birthday
476 */
477 public function setBirthday(?string $birthday): void
478 {
479 $this->birthday['value'] = $birthday;
480 }
481
482 /**
483 * Unsets Birthday.
484 * The birthday associated with the customer profile, in `YYYY-MM-DD` format. For example, `1998-09-
485 * 21`
486 * represents September 21, 1998, and `0000-09-21` represents September 21 (without a birth year).
487 */
488 public function unsetBirthday(): void
489 {
490 $this->birthday = [];
491 }
492
493 /**
494 * Returns Reference Id.
495 * An optional second ID used to associate the customer profile with an
496 * entity in another system.
497 */
498 public function getReferenceId(): ?string
499 {
500 if (count($this->referenceId) == 0) {
501 return null;
502 }
503 return $this->referenceId['value'];
504 }
505
506 /**
507 * Sets Reference Id.
508 * An optional second ID used to associate the customer profile with an
509 * entity in another system.
510 *
511 * @maps reference_id
512 */
513 public function setReferenceId(?string $referenceId): void
514 {
515 $this->referenceId['value'] = $referenceId;
516 }
517
518 /**
519 * Unsets Reference Id.
520 * An optional second ID used to associate the customer profile with an
521 * entity in another system.
522 */
523 public function unsetReferenceId(): void
524 {
525 $this->referenceId = [];
526 }
527
528 /**
529 * Returns Note.
530 * A custom note associated with the customer profile.
531 */
532 public function getNote(): ?string
533 {
534 if (count($this->note) == 0) {
535 return null;
536 }
537 return $this->note['value'];
538 }
539
540 /**
541 * Sets Note.
542 * A custom note associated with the customer profile.
543 *
544 * @maps note
545 */
546 public function setNote(?string $note): void
547 {
548 $this->note['value'] = $note;
549 }
550
551 /**
552 * Unsets Note.
553 * A custom note associated with the customer profile.
554 */
555 public function unsetNote(): void
556 {
557 $this->note = [];
558 }
559
560 /**
561 * Returns Preferences.
562 * Represents communication preferences for the customer profile.
563 */
564 public function getPreferences(): ?CustomerPreferences
565 {
566 return $this->preferences;
567 }
568
569 /**
570 * Sets Preferences.
571 * Represents communication preferences for the customer profile.
572 *
573 * @maps preferences
574 */
575 public function setPreferences(?CustomerPreferences $preferences): void
576 {
577 $this->preferences = $preferences;
578 }
579
580 /**
581 * Returns Creation Source.
582 * Indicates the method used to create the customer profile.
583 */
584 public function getCreationSource(): ?string
585 {
586 return $this->creationSource;
587 }
588
589 /**
590 * Sets Creation Source.
591 * Indicates the method used to create the customer profile.
592 *
593 * @maps creation_source
594 */
595 public function setCreationSource(?string $creationSource): void
596 {
597 $this->creationSource = $creationSource;
598 }
599
600 /**
601 * Returns Group Ids.
602 * The IDs of [customer groups](entity:CustomerGroup) the customer belongs to.
603 *
604 * @return string[]|null
605 */
606 public function getGroupIds(): ?array
607 {
608 if (count($this->groupIds) == 0) {
609 return null;
610 }
611 return $this->groupIds['value'];
612 }
613
614 /**
615 * Sets Group Ids.
616 * The IDs of [customer groups](entity:CustomerGroup) the customer belongs to.
617 *
618 * @maps group_ids
619 *
620 * @param string[]|null $groupIds
621 */
622 public function setGroupIds(?array $groupIds): void
623 {
624 $this->groupIds['value'] = $groupIds;
625 }
626
627 /**
628 * Unsets Group Ids.
629 * The IDs of [customer groups](entity:CustomerGroup) the customer belongs to.
630 */
631 public function unsetGroupIds(): void
632 {
633 $this->groupIds = [];
634 }
635
636 /**
637 * Returns Segment Ids.
638 * The IDs of [customer segments](entity:CustomerSegment) the customer belongs to.
639 *
640 * @return string[]|null
641 */
642 public function getSegmentIds(): ?array
643 {
644 if (count($this->segmentIds) == 0) {
645 return null;
646 }
647 return $this->segmentIds['value'];
648 }
649
650 /**
651 * Sets Segment Ids.
652 * The IDs of [customer segments](entity:CustomerSegment) the customer belongs to.
653 *
654 * @maps segment_ids
655 *
656 * @param string[]|null $segmentIds
657 */
658 public function setSegmentIds(?array $segmentIds): void
659 {
660 $this->segmentIds['value'] = $segmentIds;
661 }
662
663 /**
664 * Unsets Segment Ids.
665 * The IDs of [customer segments](entity:CustomerSegment) the customer belongs to.
666 */
667 public function unsetSegmentIds(): void
668 {
669 $this->segmentIds = [];
670 }
671
672 /**
673 * Returns Version.
674 * The Square-assigned version number of the customer profile. The version number is incremented each
675 * time an update is committed to the customer profile, except for changes to customer segment
676 * membership and cards on file.
677 */
678 public function getVersion(): ?int
679 {
680 return $this->version;
681 }
682
683 /**
684 * Sets Version.
685 * The Square-assigned version number of the customer profile. The version number is incremented each
686 * time an update is committed to the customer profile, except for changes to customer segment
687 * membership and cards on file.
688 *
689 * @maps version
690 */
691 public function setVersion(?int $version): void
692 {
693 $this->version = $version;
694 }
695
696 /**
697 * Returns Tax Ids.
698 * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids`
699 * field is available only for customers of sellers in EU countries or the United Kingdom.
700 * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-
701 * it-does#customer-tax-ids).
702 */
703 public function getTaxIds(): ?CustomerTaxIds
704 {
705 return $this->taxIds;
706 }
707
708 /**
709 * Sets Tax Ids.
710 * Represents the tax ID associated with a [customer profile]($m/Customer). The corresponding `tax_ids`
711 * field is available only for customers of sellers in EU countries or the United Kingdom.
712 * For more information, see [Customer tax IDs](https://developer.squareup.com/docs/customers-api/what-
713 * it-does#customer-tax-ids).
714 *
715 * @maps tax_ids
716 */
717 public function setTaxIds(?CustomerTaxIds $taxIds): void
718 {
719 $this->taxIds = $taxIds;
720 }
721
722 /**
723 * Encode this object to JSON
724 *
725 * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
726 * are set. (default: false)
727 *
728 * @return array|stdClass
729 */
730 #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
731 public function jsonSerialize(bool $asArrayWhenEmpty = false)
732 {
733 $json = [];
734 if (isset($this->id)) {
735 $json['id'] = $this->id;
736 }
737 if (isset($this->createdAt)) {
738 $json['created_at'] = $this->createdAt;
739 }
740 if (isset($this->updatedAt)) {
741 $json['updated_at'] = $this->updatedAt;
742 }
743 if (!empty($this->cards)) {
744 $json['cards'] = $this->cards['value'];
745 }
746 if (!empty($this->givenName)) {
747 $json['given_name'] = $this->givenName['value'];
748 }
749 if (!empty($this->familyName)) {
750 $json['family_name'] = $this->familyName['value'];
751 }
752 if (!empty($this->nickname)) {
753 $json['nickname'] = $this->nickname['value'];
754 }
755 if (!empty($this->companyName)) {
756 $json['company_name'] = $this->companyName['value'];
757 }
758 if (!empty($this->emailAddress)) {
759 $json['email_address'] = $this->emailAddress['value'];
760 }
761 if (isset($this->address)) {
762 $json['address'] = $this->address;
763 }
764 if (!empty($this->phoneNumber)) {
765 $json['phone_number'] = $this->phoneNumber['value'];
766 }
767 if (!empty($this->birthday)) {
768 $json['birthday'] = $this->birthday['value'];
769 }
770 if (!empty($this->referenceId)) {
771 $json['reference_id'] = $this->referenceId['value'];
772 }
773 if (!empty($this->note)) {
774 $json['note'] = $this->note['value'];
775 }
776 if (isset($this->preferences)) {
777 $json['preferences'] = $this->preferences;
778 }
779 if (isset($this->creationSource)) {
780 $json['creation_source'] = $this->creationSource;
781 }
782 if (!empty($this->groupIds)) {
783 $json['group_ids'] = $this->groupIds['value'];
784 }
785 if (!empty($this->segmentIds)) {
786 $json['segment_ids'] = $this->segmentIds['value'];
787 }
788 if (isset($this->version)) {
789 $json['version'] = $this->version;
790 }
791 if (isset($this->taxIds)) {
792 $json['tax_ids'] = $this->taxIds;
793 }
794 $json = array_filter($json, function ($val) {
795 return $val !== null;
796 });
797
798 return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
799 }
800 }
801