-
Notifications
You must be signed in to change notification settings - Fork 101
/
AccountHolder.php
861 lines (782 loc) · 24.9 KB
/
AccountHolder.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
<?php
/**
* Configuration webhooks
*
* The version of the OpenAPI document: 1
* Generated by: https://openapi-generator.tech
* OpenAPI Generator version: 6.0.1
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
namespace Adyen\Model\ConfigurationWebhooks;
use \ArrayAccess;
use Adyen\Model\ConfigurationWebhooks\ObjectSerializer;
/**
* AccountHolder Class Doc Comment
*
* @category Class
* @package Adyen
* @author OpenAPI Generator team
* @link https://openapi-generator.tech
* @implements \ArrayAccess<string, mixed>
*/
class AccountHolder implements ModelInterface, ArrayAccess, \JsonSerializable
{
public const DISCRIMINATOR = null;
/**
* The original name of the model.
*
* @var string
*/
protected static $openAPIModelName = 'AccountHolder';
/**
* Array of property to type mappings. Used for (de)serialization
*
* @var string[]
*/
protected static $openAPITypes = [
'balancePlatform' => 'string',
'capabilities' => 'array<string,\Adyen\Model\ConfigurationWebhooks\AccountHolderCapability>',
'contactDetails' => '\Adyen\Model\ConfigurationWebhooks\ContactDetails',
'description' => 'string',
'id' => 'string',
'legalEntityId' => 'string',
'metadata' => 'array<string,string>',
'migratedAccountHolderCode' => 'string',
'primaryBalanceAccount' => 'string',
'reference' => 'string',
'status' => 'string',
'timeZone' => 'string',
'verificationDeadlines' => '\Adyen\Model\ConfigurationWebhooks\VerificationDeadline[]'
];
/**
* Array of property to format mappings. Used for (de)serialization
*
* @var string[]
* @phpstan-var array<string, string|null>
* @psalm-var array<string, string|null>
*/
protected static $openAPIFormats = [
'balancePlatform' => null,
'capabilities' => null,
'contactDetails' => null,
'description' => null,
'id' => null,
'legalEntityId' => null,
'metadata' => null,
'migratedAccountHolderCode' => null,
'primaryBalanceAccount' => null,
'reference' => null,
'status' => null,
'timeZone' => null,
'verificationDeadlines' => null
];
/**
* Array of nullable properties. Used for (de)serialization
*
* @var boolean[]
*/
protected static $openAPINullables = [
'balancePlatform' => false,
'capabilities' => false,
'contactDetails' => false,
'description' => false,
'id' => false,
'legalEntityId' => false,
'metadata' => false,
'migratedAccountHolderCode' => false,
'primaryBalanceAccount' => false,
'reference' => false,
'status' => false,
'timeZone' => false,
'verificationDeadlines' => false
];
/**
* If a nullable field gets set to null, insert it here
*
* @var boolean[]
*/
protected $openAPINullablesSetToNull = [];
/**
* Array of property to type mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPITypes()
{
return self::$openAPITypes;
}
/**
* Array of property to format mappings. Used for (de)serialization
*
* @return array
*/
public static function openAPIFormats()
{
return self::$openAPIFormats;
}
/**
* Array of nullable properties
*
* @return array
*/
protected static function openAPINullables(): array
{
return self::$openAPINullables;
}
/**
* Array of nullable field names deliberately set to null
*
* @return boolean[]
*/
private function getOpenAPINullablesSetToNull(): array
{
return $this->openAPINullablesSetToNull;
}
/**
* Setter - Array of nullable field names deliberately set to null
*
* @param boolean[] $openAPINullablesSetToNull
*/
private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
{
$this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
}
/**
* Checks if a property is nullable
*
* @param string $property
* @return bool
*/
public static function isNullable(string $property): bool
{
return self::openAPINullables()[$property] ?? false;
}
/**
* Checks if a nullable property is set to null.
*
* @param string $property
* @return bool
*/
public function isNullableSetToNull(string $property): bool
{
return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
}
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @var string[]
*/
protected static $attributeMap = [
'balancePlatform' => 'balancePlatform',
'capabilities' => 'capabilities',
'contactDetails' => 'contactDetails',
'description' => 'description',
'id' => 'id',
'legalEntityId' => 'legalEntityId',
'metadata' => 'metadata',
'migratedAccountHolderCode' => 'migratedAccountHolderCode',
'primaryBalanceAccount' => 'primaryBalanceAccount',
'reference' => 'reference',
'status' => 'status',
'timeZone' => 'timeZone',
'verificationDeadlines' => 'verificationDeadlines'
];
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @var string[]
*/
protected static $setters = [
'balancePlatform' => 'setBalancePlatform',
'capabilities' => 'setCapabilities',
'contactDetails' => 'setContactDetails',
'description' => 'setDescription',
'id' => 'setId',
'legalEntityId' => 'setLegalEntityId',
'metadata' => 'setMetadata',
'migratedAccountHolderCode' => 'setMigratedAccountHolderCode',
'primaryBalanceAccount' => 'setPrimaryBalanceAccount',
'reference' => 'setReference',
'status' => 'setStatus',
'timeZone' => 'setTimeZone',
'verificationDeadlines' => 'setVerificationDeadlines'
];
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @var string[]
*/
protected static $getters = [
'balancePlatform' => 'getBalancePlatform',
'capabilities' => 'getCapabilities',
'contactDetails' => 'getContactDetails',
'description' => 'getDescription',
'id' => 'getId',
'legalEntityId' => 'getLegalEntityId',
'metadata' => 'getMetadata',
'migratedAccountHolderCode' => 'getMigratedAccountHolderCode',
'primaryBalanceAccount' => 'getPrimaryBalanceAccount',
'reference' => 'getReference',
'status' => 'getStatus',
'timeZone' => 'getTimeZone',
'verificationDeadlines' => 'getVerificationDeadlines'
];
/**
* Array of attributes where the key is the local name,
* and the value is the original name
*
* @return array
*/
public static function attributeMap()
{
return self::$attributeMap;
}
/**
* Array of attributes to setter functions (for deserialization of responses)
*
* @return array
*/
public static function setters()
{
return self::$setters;
}
/**
* Array of attributes to getter functions (for serialization of requests)
*
* @return array
*/
public static function getters()
{
return self::$getters;
}
/**
* The original name of the model.
*
* @return string
*/
public function getModelName()
{
return self::$openAPIModelName;
}
public const STATUS_ACTIVE = 'Active';
public const STATUS_CLOSED = 'Closed';
public const STATUS_INACTIVE = 'Inactive';
public const STATUS_SUSPENDED = 'Suspended';
/**
* Gets allowable values of the enum
*
* @return string[]
*/
public function getStatusAllowableValues()
{
return [
self::STATUS_ACTIVE,
self::STATUS_CLOSED,
self::STATUS_INACTIVE,
self::STATUS_SUSPENDED,
];
}
/**
* Associative array for storing property values
*
* @var mixed[]
*/
protected $container = [];
/**
* Constructor
*
* @param mixed[] $data Associated array of property values
* initializing the model
*/
public function __construct(array $data = null)
{
$this->setIfExists('balancePlatform', $data ?? [], null);
$this->setIfExists('capabilities', $data ?? [], null);
$this->setIfExists('contactDetails', $data ?? [], null);
$this->setIfExists('description', $data ?? [], null);
$this->setIfExists('id', $data ?? [], null);
$this->setIfExists('legalEntityId', $data ?? [], null);
$this->setIfExists('metadata', $data ?? [], null);
$this->setIfExists('migratedAccountHolderCode', $data ?? [], null);
$this->setIfExists('primaryBalanceAccount', $data ?? [], null);
$this->setIfExists('reference', $data ?? [], null);
$this->setIfExists('status', $data ?? [], null);
$this->setIfExists('timeZone', $data ?? [], null);
$this->setIfExists('verificationDeadlines', $data ?? [], null);
}
/**
* Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
* is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
* $this->openAPINullablesSetToNull array
*
* @param string $variableName
* @param array $fields
* @param mixed $defaultValue
*/
private function setIfExists(string $variableName, array $fields, $defaultValue): void
{
if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
$this->openAPINullablesSetToNull[] = $variableName;
}
$this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
}
/**
* Show all the invalid properties with reasons.
*
* @return array invalid properties with reasons
*/
public function listInvalidProperties()
{
$invalidProperties = [];
if ($this->container['id'] === null) {
$invalidProperties[] = "'id' can't be null";
}
if ($this->container['legalEntityId'] === null) {
$invalidProperties[] = "'legalEntityId' can't be null";
}
$allowedValues = $this->getStatusAllowableValues();
if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) {
$invalidProperties[] = sprintf(
"invalid value '%s' for 'status', must be one of '%s'",
$this->container['status'],
implode("', '", $allowedValues)
);
}
return $invalidProperties;
}
/**
* Validate all the properties in the model
* return true if all passed
*
* @return bool True if all properties are valid
*/
public function valid()
{
return count($this->listInvalidProperties()) === 0;
}
/**
* Gets balancePlatform
*
* @return string|null
*/
public function getBalancePlatform()
{
return $this->container['balancePlatform'];
}
/**
* Sets balancePlatform
*
* @param string|null $balancePlatform The unique identifier of the [balance platform](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balancePlatforms/{id}__queryParam_id) to which the account holder belongs. Required in the request if your API credentials can be used for multiple balance platforms.
*
* @return self
*/
public function setBalancePlatform($balancePlatform)
{
if (is_null($balancePlatform)) {
throw new \InvalidArgumentException('non-nullable balancePlatform cannot be null');
}
$this->container['balancePlatform'] = $balancePlatform;
return $this;
}
/**
* Gets capabilities
*
* @return array<string,\Adyen\Model\ConfigurationWebhooks\AccountHolderCapability>|null
*/
public function getCapabilities()
{
return $this->container['capabilities'];
}
/**
* Sets capabilities
*
* @param array<string,\Adyen\Model\ConfigurationWebhooks\AccountHolderCapability>|null $capabilities Contains key-value pairs that specify the actions that an account holder can do in your platform. The key is a capability required for your integration. For example, **issueCard** for Issuing. The value is an object containing the settings for the capability.
*
* @return self
*/
public function setCapabilities($capabilities)
{
if (is_null($capabilities)) {
throw new \InvalidArgumentException('non-nullable capabilities cannot be null');
}
$this->container['capabilities'] = $capabilities;
return $this;
}
/**
* Gets contactDetails
*
* @return \Adyen\Model\ConfigurationWebhooks\ContactDetails|null
*/
public function getContactDetails()
{
return $this->container['contactDetails'];
}
/**
* Sets contactDetails
*
* @param \Adyen\Model\ConfigurationWebhooks\ContactDetails|null $contactDetails contactDetails
*
* @return self
*/
public function setContactDetails($contactDetails)
{
if (is_null($contactDetails)) {
throw new \InvalidArgumentException('non-nullable contactDetails cannot be null');
}
$this->container['contactDetails'] = $contactDetails;
return $this;
}
/**
* Gets description
*
* @return string|null
*/
public function getDescription()
{
return $this->container['description'];
}
/**
* Sets description
*
* @param string|null $description Your description for the account holder, maximum 300 characters.
*
* @return self
*/
public function setDescription($description)
{
if (is_null($description)) {
throw new \InvalidArgumentException('non-nullable description cannot be null');
}
$this->container['description'] = $description;
return $this;
}
/**
* Gets id
*
* @return string
*/
public function getId()
{
return $this->container['id'];
}
/**
* Sets id
*
* @param string $id The unique identifier of the account holder.
*
* @return self
*/
public function setId($id)
{
if (is_null($id)) {
throw new \InvalidArgumentException('non-nullable id cannot be null');
}
$this->container['id'] = $id;
return $this;
}
/**
* Gets legalEntityId
*
* @return string
*/
public function getLegalEntityId()
{
return $this->container['legalEntityId'];
}
/**
* Sets legalEntityId
*
* @param string $legalEntityId The unique identifier of the [legal entity](https://docs.adyen.com/api-explorer/legalentity/latest/post/legalEntities#responses-200-id) associated with the account holder. Adyen performs a verification process against the legal entity of the account holder.
*
* @return self
*/
public function setLegalEntityId($legalEntityId)
{
if (is_null($legalEntityId)) {
throw new \InvalidArgumentException('non-nullable legalEntityId cannot be null');
}
$this->container['legalEntityId'] = $legalEntityId;
return $this;
}
/**
* Gets metadata
*
* @return array<string,string>|null
*/
public function getMetadata()
{
return $this->container['metadata'];
}
/**
* Sets metadata
*
* @param array<string,string>|null $metadata A set of key and value pairs for general use. The keys do not have specific names and may be used for storing miscellaneous data as desired. > Note that during an update of metadata, the omission of existing key-value pairs will result in the deletion of those key-value pairs.
*
* @return self
*/
public function setMetadata($metadata)
{
if (is_null($metadata)) {
throw new \InvalidArgumentException('non-nullable metadata cannot be null');
}
$this->container['metadata'] = $metadata;
return $this;
}
/**
* Gets migratedAccountHolderCode
*
* @return string|null
*/
public function getMigratedAccountHolderCode()
{
return $this->container['migratedAccountHolderCode'];
}
/**
* Sets migratedAccountHolderCode
*
* @param string|null $migratedAccountHolderCode The unique identifier of the migrated account holder in the classic integration.
*
* @return self
*/
public function setMigratedAccountHolderCode($migratedAccountHolderCode)
{
if (is_null($migratedAccountHolderCode)) {
throw new \InvalidArgumentException('non-nullable migratedAccountHolderCode cannot be null');
}
$this->container['migratedAccountHolderCode'] = $migratedAccountHolderCode;
return $this;
}
/**
* Gets primaryBalanceAccount
*
* @return string|null
*/
public function getPrimaryBalanceAccount()
{
return $this->container['primaryBalanceAccount'];
}
/**
* Sets primaryBalanceAccount
*
* @param string|null $primaryBalanceAccount The ID of the account holder's primary balance account. By default, this is set to the first balance account that you create for the account holder. To assign a different balance account, send a PATCH request.
*
* @return self
*/
public function setPrimaryBalanceAccount($primaryBalanceAccount)
{
if (is_null($primaryBalanceAccount)) {
throw new \InvalidArgumentException('non-nullable primaryBalanceAccount cannot be null');
}
$this->container['primaryBalanceAccount'] = $primaryBalanceAccount;
return $this;
}
/**
* Gets reference
*
* @return string|null
*/
public function getReference()
{
return $this->container['reference'];
}
/**
* Sets reference
*
* @param string|null $reference Your reference for the account holder, maximum 150 characters.
*
* @return self
*/
public function setReference($reference)
{
if (is_null($reference)) {
throw new \InvalidArgumentException('non-nullable reference cannot be null');
}
$this->container['reference'] = $reference;
return $this;
}
/**
* Gets status
*
* @return string|null
*/
public function getStatus()
{
return $this->container['status'];
}
/**
* Sets status
*
* @param string|null $status The status of the account holder. Possible values: * **Active**: The account holder is active. This is the default status when creating an account holder. * **Inactive (Deprecated)**: The account holder is temporarily inactive due to missing KYC details. You can set the account back to active by providing the missing KYC details. * **Suspended**: The account holder is permanently deactivated by Adyen. This action cannot be undone. * **Closed**: The account holder is permanently deactivated by you. This action cannot be undone.
*
* @return self
*/
public function setStatus($status)
{
if (is_null($status)) {
throw new \InvalidArgumentException('non-nullable status cannot be null');
}
$allowedValues = $this->getStatusAllowableValues();
if (!in_array($status, $allowedValues, true)) {
throw new \InvalidArgumentException(
sprintf(
"Invalid value '%s' for 'status', must be one of '%s'",
$status,
implode("', '", $allowedValues)
)
);
}
$this->container['status'] = $status;
return $this;
}
/**
* Gets timeZone
*
* @return string|null
*/
public function getTimeZone()
{
return $this->container['timeZone'];
}
/**
* Sets timeZone
*
* @param string|null $timeZone The time zone of the account holder. For example, **Europe/Amsterdam**. Defaults to the time zone of the balance platform if no time zone is set. For possible values, see the [list of time zone codes](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones).
*
* @return self
*/
public function setTimeZone($timeZone)
{
if (is_null($timeZone)) {
throw new \InvalidArgumentException('non-nullable timeZone cannot be null');
}
$this->container['timeZone'] = $timeZone;
return $this;
}
/**
* Gets verificationDeadlines
*
* @return \Adyen\Model\ConfigurationWebhooks\VerificationDeadline[]|null
*/
public function getVerificationDeadlines()
{
return $this->container['verificationDeadlines'];
}
/**
* Sets verificationDeadlines
*
* @param \Adyen\Model\ConfigurationWebhooks\VerificationDeadline[]|null $verificationDeadlines List of verification deadlines and the capabilities that will be disallowed if verification errors are not resolved.
*
* @return self
*/
public function setVerificationDeadlines($verificationDeadlines)
{
if (is_null($verificationDeadlines)) {
throw new \InvalidArgumentException('non-nullable verificationDeadlines cannot be null');
}
$this->container['verificationDeadlines'] = $verificationDeadlines;
return $this;
}
/**
* Returns true if offset exists. False otherwise.
*
* @param integer $offset Offset
*
* @return boolean
*/
public function offsetExists($offset): bool
{
return isset($this->container[$offset]);
}
/**
* Gets offset.
*
* @param integer $offset Offset
*
* @return mixed|null
*/
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
return $this->container[$offset] ?? null;
}
/**
* Sets value based on offset.
*
* @param int|null $offset Offset
* @param mixed $value Value to be set
*
* @return void
*/
public function offsetSet($offset, $value): void
{
if (is_null($offset)) {
$this->container[] = $value;
} else {
$this->container[$offset] = $value;
}
}
/**
* Unsets offset.
*
* @param integer $offset Offset
*
* @return void
*/
public function offsetUnset($offset): void
{
unset($this->container[$offset]);
}
/**
* Serializes the object to a value that can be serialized natively by json_encode().
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
*
* @return mixed Returns data which can be serialized by json_encode(), which is a value
* of any type other than a resource.
*/
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
return ObjectSerializer::sanitizeForSerialization($this);
}
public function toArray(): array
{
$array = [];
foreach (self::$openAPITypes as $propertyName => $propertyType) {
$propertyValue = $this[$propertyName];
if ($propertyValue !== null) {
// Check if the property value is an object and has a toArray() method
if (is_object($propertyValue) && method_exists($propertyValue, 'toArray')) {
$array[$propertyName] = $propertyValue->toArray();
// Check if it's type datetime
} elseif ($propertyValue instanceof \DateTime) {
$array[$propertyName] = $propertyValue->format(DATE_ATOM);
// If it's an array type we should check whether it contains objects and if so call toArray method
} elseif (is_array($propertyValue)) {
$array[$propertyName] = array_map(function ($item) {
return $item instanceof ModelInterface ? $item->toArray() : $item;
}, $propertyValue);
} else {
// Otherwise, directly assign the property value to the array
$array[$propertyName] = $propertyValue;
}
}
}
return $array;
}
/**
* Gets the string presentation of the object
*
* @return string
*/
public function __toString()
{
return json_encode(
ObjectSerializer::sanitizeForSerialization($this),
JSON_PRETTY_PRINT
);
}
}