-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntrafiExclusionsRawService.php
More file actions
148 lines (138 loc) · 4.33 KB
/
IntrafiExclusionsRawService.php
File metadata and controls
148 lines (138 loc) · 4.33 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
<?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\IntrafiExclusions\IntrafiExclusion;
use Increase\IntrafiExclusions\IntrafiExclusionCreateParams;
use Increase\IntrafiExclusions\IntrafiExclusionListParams;
use Increase\Page;
use Increase\RequestOptions;
use Increase\ServiceContracts\IntrafiExclusionsRawContract;
/**
* @phpstan-import-type RequestOpts from \Increase\RequestOptions
*/
final class IntrafiExclusionsRawService implements IntrafiExclusionsRawContract
{
// @phpstan-ignore-next-line
/**
* @internal
*/
public function __construct(private Client $client) {}
/**
* @api
*
* Create an IntraFi Exclusion
*
* @param array{
* entityID: string, fdicCertificateNumber: string
* }|IntrafiExclusionCreateParams $params
* @param RequestOpts|null $requestOptions
*
* @return BaseResponse<IntrafiExclusion>
*
* @throws APIException
*/
public function create(
array|IntrafiExclusionCreateParams $params,
RequestOptions|array|null $requestOptions = null,
): BaseResponse {
[$parsed, $options] = IntrafiExclusionCreateParams::parseRequest(
$params,
$requestOptions,
);
// @phpstan-ignore-next-line return.type
return $this->client->request(
method: 'post',
path: 'intrafi_exclusions',
body: (object) $parsed,
options: $options,
convert: IntrafiExclusion::class,
);
}
/**
* @api
*
* Get an IntraFi Exclusion
*
* @param string $intrafiExclusionID the identifier of the IntraFi Exclusion to retrieve
* @param RequestOpts|null $requestOptions
*
* @return BaseResponse<IntrafiExclusion>
*
* @throws APIException
*/
public function retrieve(
string $intrafiExclusionID,
RequestOptions|array|null $requestOptions = null
): BaseResponse {
// @phpstan-ignore-next-line return.type
return $this->client->request(
method: 'get',
path: ['intrafi_exclusions/%1$s', $intrafiExclusionID],
options: $requestOptions,
convert: IntrafiExclusion::class,
);
}
/**
* @api
*
* List IntraFi Exclusions
*
* @param array{
* cursor?: string, entityID?: string, idempotencyKey?: string, limit?: int
* }|IntrafiExclusionListParams $params
* @param RequestOpts|null $requestOptions
*
* @return BaseResponse<Page<IntrafiExclusion>>
*
* @throws APIException
*/
public function list(
array|IntrafiExclusionListParams $params,
RequestOptions|array|null $requestOptions = null,
): BaseResponse {
[$parsed, $options] = IntrafiExclusionListParams::parseRequest(
$params,
$requestOptions,
);
// @phpstan-ignore-next-line return.type
return $this->client->request(
method: 'get',
path: 'intrafi_exclusions',
query: Util::array_transform_keys(
$parsed,
['entityID' => 'entity_id', 'idempotencyKey' => 'idempotency_key'],
),
options: $options,
convert: IntrafiExclusion::class,
page: Page::class,
);
}
/**
* @api
*
* Archive an IntraFi Exclusion
*
* @param string $intrafiExclusionID The identifier of the IntraFi Exclusion request to archive. It may take 5 business days for an exclusion removal to be processed. Removing an exclusion does not guarantee that funds will be swept to the previously-excluded bank.
* @param RequestOpts|null $requestOptions
*
* @return BaseResponse<IntrafiExclusion>
*
* @throws APIException
*/
public function archive(
string $intrafiExclusionID,
RequestOptions|array|null $requestOptions = null
): BaseResponse {
// @phpstan-ignore-next-line return.type
return $this->client->request(
method: 'post',
path: ['intrafi_exclusions/%1$s/archive', $intrafiExclusionID],
options: $requestOptions,
convert: IntrafiExclusion::class,
);
}
}