-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWireDrawdownRequestCreateParams.php
More file actions
336 lines (291 loc) · 9.64 KB
/
WireDrawdownRequestCreateParams.php
File metadata and controls
336 lines (291 loc) · 9.64 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
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
<?php
declare(strict_types=1);
namespace Increase\WireDrawdownRequests;
use Increase\Core\Attributes\Optional;
use Increase\Core\Attributes\Required;
use Increase\Core\Concerns\SdkModel;
use Increase\Core\Concerns\SdkParams;
use Increase\Core\Contracts\BaseModel;
use Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams\ChargeBearer;
use Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams\CreditorAddress;
use Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams\DebtorAddress;
/**
* Create a Wire Drawdown Request.
*
* @see Increase\Services\WireDrawdownRequestsService::create()
*
* @phpstan-import-type CreditorAddressShape from \Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams\CreditorAddress
* @phpstan-import-type DebtorAddressShape from \Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams\DebtorAddress
*
* @phpstan-type WireDrawdownRequestCreateParamsShape = array{
* accountNumberID: string,
* amount: int,
* creditorAddress: CreditorAddress|CreditorAddressShape,
* creditorName: string,
* debtorAddress: DebtorAddress|DebtorAddressShape,
* debtorName: string,
* unstructuredRemittanceInformation: string,
* chargeBearer?: null|ChargeBearer|value-of<ChargeBearer>,
* debtorAccountNumber?: string|null,
* debtorExternalAccountID?: string|null,
* debtorRoutingNumber?: string|null,
* endToEndIdentification?: string|null,
* }
*/
final class WireDrawdownRequestCreateParams implements BaseModel
{
/** @use SdkModel<WireDrawdownRequestCreateParamsShape> */
use SdkModel;
use SdkParams;
/**
* The Account Number to which the debtor should send funds.
*/
#[Required('account_number_id')]
public string $accountNumberID;
/**
* The amount requested from the debtor, in USD cents.
*/
#[Required]
public int $amount;
/**
* The creditor's address.
*/
#[Required('creditor_address')]
public CreditorAddress $creditorAddress;
/**
* The creditor's name.
*/
#[Required('creditor_name')]
public string $creditorName;
/**
* The debtor's address.
*/
#[Required('debtor_address')]
public DebtorAddress $debtorAddress;
/**
* The debtor's name.
*/
#[Required('debtor_name')]
public string $debtorName;
/**
* Remittance information the debtor will see as part of the request.
*/
#[Required('unstructured_remittance_information')]
public string $unstructuredRemittanceInformation;
/**
* Determines who bears the cost of the drawdown request. Defaults to `shared` if not specified.
*
* @var value-of<ChargeBearer>|null $chargeBearer
*/
#[Optional('charge_bearer', enum: ChargeBearer::class)]
public ?string $chargeBearer;
/**
* The debtor's account number.
*/
#[Optional('debtor_account_number')]
public ?string $debtorAccountNumber;
/**
* The ID of an External Account to initiate a transfer to. If this parameter is provided, `debtor_account_number` and `debtor_routing_number` must be absent.
*/
#[Optional('debtor_external_account_id')]
public ?string $debtorExternalAccountID;
/**
* The debtor's routing number.
*/
#[Optional('debtor_routing_number')]
public ?string $debtorRoutingNumber;
/**
* A free-form reference string set by the sender mirrored back in the subsequent wire transfer.
*/
#[Optional('end_to_end_identification')]
public ?string $endToEndIdentification;
/**
* `new WireDrawdownRequestCreateParams()` is missing required properties by the API.
*
* To enforce required parameters use
* ```
* WireDrawdownRequestCreateParams::with(
* accountNumberID: ...,
* amount: ...,
* creditorAddress: ...,
* creditorName: ...,
* debtorAddress: ...,
* debtorName: ...,
* unstructuredRemittanceInformation: ...,
* )
* ```
*
* Otherwise ensure the following setters are called
*
* ```
* (new WireDrawdownRequestCreateParams)
* ->withAccountNumberID(...)
* ->withAmount(...)
* ->withCreditorAddress(...)
* ->withCreditorName(...)
* ->withDebtorAddress(...)
* ->withDebtorName(...)
* ->withUnstructuredRemittanceInformation(...)
* ```
*/
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 CreditorAddress|CreditorAddressShape $creditorAddress
* @param DebtorAddress|DebtorAddressShape $debtorAddress
* @param ChargeBearer|value-of<ChargeBearer>|null $chargeBearer
*/
public static function with(
string $accountNumberID,
int $amount,
CreditorAddress|array $creditorAddress,
string $creditorName,
DebtorAddress|array $debtorAddress,
string $debtorName,
string $unstructuredRemittanceInformation,
ChargeBearer|string|null $chargeBearer = null,
?string $debtorAccountNumber = null,
?string $debtorExternalAccountID = null,
?string $debtorRoutingNumber = null,
?string $endToEndIdentification = null,
): self {
$self = new self;
$self['accountNumberID'] = $accountNumberID;
$self['amount'] = $amount;
$self['creditorAddress'] = $creditorAddress;
$self['creditorName'] = $creditorName;
$self['debtorAddress'] = $debtorAddress;
$self['debtorName'] = $debtorName;
$self['unstructuredRemittanceInformation'] = $unstructuredRemittanceInformation;
null !== $chargeBearer && $self['chargeBearer'] = $chargeBearer;
null !== $debtorAccountNumber && $self['debtorAccountNumber'] = $debtorAccountNumber;
null !== $debtorExternalAccountID && $self['debtorExternalAccountID'] = $debtorExternalAccountID;
null !== $debtorRoutingNumber && $self['debtorRoutingNumber'] = $debtorRoutingNumber;
null !== $endToEndIdentification && $self['endToEndIdentification'] = $endToEndIdentification;
return $self;
}
/**
* The Account Number to which the debtor should send funds.
*/
public function withAccountNumberID(string $accountNumberID): self
{
$self = clone $this;
$self['accountNumberID'] = $accountNumberID;
return $self;
}
/**
* The amount requested from the debtor, in USD cents.
*/
public function withAmount(int $amount): self
{
$self = clone $this;
$self['amount'] = $amount;
return $self;
}
/**
* The creditor's address.
*
* @param CreditorAddress|CreditorAddressShape $creditorAddress
*/
public function withCreditorAddress(
CreditorAddress|array $creditorAddress
): self {
$self = clone $this;
$self['creditorAddress'] = $creditorAddress;
return $self;
}
/**
* The creditor's name.
*/
public function withCreditorName(string $creditorName): self
{
$self = clone $this;
$self['creditorName'] = $creditorName;
return $self;
}
/**
* The debtor's address.
*
* @param DebtorAddress|DebtorAddressShape $debtorAddress
*/
public function withDebtorAddress(DebtorAddress|array $debtorAddress): self
{
$self = clone $this;
$self['debtorAddress'] = $debtorAddress;
return $self;
}
/**
* The debtor's name.
*/
public function withDebtorName(string $debtorName): self
{
$self = clone $this;
$self['debtorName'] = $debtorName;
return $self;
}
/**
* Remittance information the debtor will see as part of the request.
*/
public function withUnstructuredRemittanceInformation(
string $unstructuredRemittanceInformation
): self {
$self = clone $this;
$self['unstructuredRemittanceInformation'] = $unstructuredRemittanceInformation;
return $self;
}
/**
* Determines who bears the cost of the drawdown request. Defaults to `shared` if not specified.
*
* @param ChargeBearer|value-of<ChargeBearer> $chargeBearer
*/
public function withChargeBearer(ChargeBearer|string $chargeBearer): self
{
$self = clone $this;
$self['chargeBearer'] = $chargeBearer;
return $self;
}
/**
* The debtor's account number.
*/
public function withDebtorAccountNumber(string $debtorAccountNumber): self
{
$self = clone $this;
$self['debtorAccountNumber'] = $debtorAccountNumber;
return $self;
}
/**
* The ID of an External Account to initiate a transfer to. If this parameter is provided, `debtor_account_number` and `debtor_routing_number` must be absent.
*/
public function withDebtorExternalAccountID(
string $debtorExternalAccountID
): self {
$self = clone $this;
$self['debtorExternalAccountID'] = $debtorExternalAccountID;
return $self;
}
/**
* The debtor's routing number.
*/
public function withDebtorRoutingNumber(string $debtorRoutingNumber): self
{
$self = clone $this;
$self['debtorRoutingNumber'] = $debtorRoutingNumber;
return $self;
}
/**
* A free-form reference string set by the sender mirrored back in the subsequent wire transfer.
*/
public function withEndToEndIdentification(
string $endToEndIdentification
): self {
$self = clone $this;
$self['endToEndIdentification'] = $endToEndIdentification;
return $self;
}
}