-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWireDrawdownRequestsRawService.php
More file actions
144 lines (135 loc) · 4.65 KB
/
WireDrawdownRequestsRawService.php
File metadata and controls
144 lines (135 loc) · 4.65 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
<?php
declare(strict_types=1);
namespace Increase\Services;
use Increase\Client;
use Increase\Core\Contracts\BaseResponse;
use Increase\Core\Exceptions\APIException;
use Increase\Core\Util;
use Increase\Page;
use Increase\RequestOptions;
use Increase\ServiceContracts\WireDrawdownRequestsRawContract;
use Increase\WireDrawdownRequests\WireDrawdownRequest;
use Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams;
use Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams\ChargeBearer;
use Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams\CreditorAddress;
use Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams\DebtorAddress;
use Increase\WireDrawdownRequests\WireDrawdownRequestListParams;
use Increase\WireDrawdownRequests\WireDrawdownRequestListParams\Status;
/**
* @phpstan-import-type CreditorAddressShape from \Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams\CreditorAddress
* @phpstan-import-type DebtorAddressShape from \Increase\WireDrawdownRequests\WireDrawdownRequestCreateParams\DebtorAddress
* @phpstan-import-type StatusShape from \Increase\WireDrawdownRequests\WireDrawdownRequestListParams\Status
* @phpstan-import-type RequestOpts from \Increase\RequestOptions
*/
final class WireDrawdownRequestsRawService implements WireDrawdownRequestsRawContract
{
// @phpstan-ignore-next-line
/**
* @internal
*/
public function __construct(private Client $client) {}
/**
* @api
*
* Create a Wire Drawdown Request
*
* @param array{
* accountNumberID: string,
* amount: int,
* creditorAddress: CreditorAddress|CreditorAddressShape,
* creditorName: string,
* debtorAddress: DebtorAddress|DebtorAddressShape,
* debtorName: string,
* unstructuredRemittanceInformation: string,
* chargeBearer?: ChargeBearer|value-of<ChargeBearer>,
* debtorAccountNumber?: string,
* debtorExternalAccountID?: string,
* debtorRoutingNumber?: string,
* endToEndIdentification?: string,
* }|WireDrawdownRequestCreateParams $params
* @param RequestOpts|null $requestOptions
*
* @return BaseResponse<WireDrawdownRequest>
*
* @throws APIException
*/
public function create(
array|WireDrawdownRequestCreateParams $params,
RequestOptions|array|null $requestOptions = null,
): BaseResponse {
[$parsed, $options] = WireDrawdownRequestCreateParams::parseRequest(
$params,
$requestOptions,
);
// @phpstan-ignore-next-line return.type
return $this->client->request(
method: 'post',
path: 'wire_drawdown_requests',
body: (object) $parsed,
options: $options,
convert: WireDrawdownRequest::class,
);
}
/**
* @api
*
* Retrieve a Wire Drawdown Request
*
* @param string $wireDrawdownRequestID the identifier of the Wire Drawdown Request to retrieve
* @param RequestOpts|null $requestOptions
*
* @return BaseResponse<WireDrawdownRequest>
*
* @throws APIException
*/
public function retrieve(
string $wireDrawdownRequestID,
RequestOptions|array|null $requestOptions = null,
): BaseResponse {
// @phpstan-ignore-next-line return.type
return $this->client->request(
method: 'get',
path: ['wire_drawdown_requests/%1$s', $wireDrawdownRequestID],
options: $requestOptions,
convert: WireDrawdownRequest::class,
);
}
/**
* @api
*
* List Wire Drawdown Requests
*
* @param array{
* cursor?: string,
* idempotencyKey?: string,
* limit?: int,
* status?: Status|StatusShape,
* }|WireDrawdownRequestListParams $params
* @param RequestOpts|null $requestOptions
*
* @return BaseResponse<Page<WireDrawdownRequest>>
*
* @throws APIException
*/
public function list(
array|WireDrawdownRequestListParams $params,
RequestOptions|array|null $requestOptions = null,
): BaseResponse {
[$parsed, $options] = WireDrawdownRequestListParams::parseRequest(
$params,
$requestOptions,
);
// @phpstan-ignore-next-line return.type
return $this->client->request(
method: 'get',
path: 'wire_drawdown_requests',
query: Util::array_transform_keys(
$parsed,
['idempotencyKey' => 'idempotency_key']
),
options: $options,
convert: WireDrawdownRequest::class,
page: Page::class,
);
}
}