-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIdentification.php
More file actions
179 lines (155 loc) · 5.29 KB
/
Identification.php
File metadata and controls
179 lines (155 loc) · 5.29 KB
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
<?php
declare(strict_types=1);
namespace Increase\BeneficialOwners\BeneficialOwnerUpdateParams;
use Increase\BeneficialOwners\BeneficialOwnerUpdateParams\Identification\DriversLicense;
use Increase\BeneficialOwners\BeneficialOwnerUpdateParams\Identification\Method;
use Increase\BeneficialOwners\BeneficialOwnerUpdateParams\Identification\Other;
use Increase\BeneficialOwners\BeneficialOwnerUpdateParams\Identification\Passport;
use Increase\Core\Attributes\Optional;
use Increase\Core\Attributes\Required;
use Increase\Core\Concerns\SdkModel;
use Increase\Core\Contracts\BaseModel;
/**
* A means of verifying the person's identity.
*
* @phpstan-import-type DriversLicenseShape from \Increase\BeneficialOwners\BeneficialOwnerUpdateParams\Identification\DriversLicense
* @phpstan-import-type OtherShape from \Increase\BeneficialOwners\BeneficialOwnerUpdateParams\Identification\Other
* @phpstan-import-type PassportShape from \Increase\BeneficialOwners\BeneficialOwnerUpdateParams\Identification\Passport
*
* @phpstan-type IdentificationShape = array{
* method: Method|value-of<Method>,
* number: string,
* driversLicense?: null|DriversLicense|DriversLicenseShape,
* other?: null|Other|OtherShape,
* passport?: null|Passport|PassportShape,
* }
*/
final class Identification implements BaseModel
{
/** @use SdkModel<IdentificationShape> */
use SdkModel;
/**
* A method that can be used to verify the individual's identity.
*
* @var value-of<Method> $method
*/
#[Required(enum: Method::class)]
public string $method;
/**
* An identification number that can be used to verify the individual's identity, such as a social security number.
*/
#[Required]
public string $number;
/**
* Information about the United States driver's license used for identification. Required if `method` is equal to `drivers_license`.
*/
#[Optional('drivers_license')]
public ?DriversLicense $driversLicense;
/**
* Information about the identification document provided. Required if `method` is equal to `other`.
*/
#[Optional]
public ?Other $other;
/**
* Information about the passport used for identification. Required if `method` is equal to `passport`.
*/
#[Optional]
public ?Passport $passport;
/**
* `new Identification()` is missing required properties by the API.
*
* To enforce required parameters use
* ```
* Identification::with(method: ..., number: ...)
* ```
*
* Otherwise ensure the following setters are called
*
* ```
* (new Identification)->withMethod(...)->withNumber(...)
* ```
*/
public function __construct()
{
$this->initialize();
}
/**
* Construct an instance from the required parameters.
*
* You must use named parameters to construct any parameters with a default value.
*
* @param Method|value-of<Method> $method
* @param DriversLicense|DriversLicenseShape|null $driversLicense
* @param Other|OtherShape|null $other
* @param Passport|PassportShape|null $passport
*/
public static function with(
Method|string $method,
string $number,
DriversLicense|array|null $driversLicense = null,
Other|array|null $other = null,
Passport|array|null $passport = null,
): self {
$self = new self;
$self['method'] = $method;
$self['number'] = $number;
null !== $driversLicense && $self['driversLicense'] = $driversLicense;
null !== $other && $self['other'] = $other;
null !== $passport && $self['passport'] = $passport;
return $self;
}
/**
* A method that can be used to verify the individual's identity.
*
* @param Method|value-of<Method> $method
*/
public function withMethod(Method|string $method): self
{
$self = clone $this;
$self['method'] = $method;
return $self;
}
/**
* An identification number that can be used to verify the individual's identity, such as a social security number.
*/
public function withNumber(string $number): self
{
$self = clone $this;
$self['number'] = $number;
return $self;
}
/**
* Information about the United States driver's license used for identification. Required if `method` is equal to `drivers_license`.
*
* @param DriversLicense|DriversLicenseShape $driversLicense
*/
public function withDriversLicense(
DriversLicense|array $driversLicense
): self {
$self = clone $this;
$self['driversLicense'] = $driversLicense;
return $self;
}
/**
* Information about the identification document provided. Required if `method` is equal to `other`.
*
* @param Other|OtherShape $other
*/
public function withOther(Other|array $other): self
{
$self = clone $this;
$self['other'] = $other;
return $self;
}
/**
* Information about the passport used for identification. Required if `method` is equal to `passport`.
*
* @param Passport|PassportShape $passport
*/
public function withPassport(Passport|array $passport): self
{
$self = clone $this;
$self['passport'] = $passport;
return $self;
}
}