mollie-api-typescript 1.6.10 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/commonjs/funcs/payoutsCancel.d.ts +22 -0
- package/dist/commonjs/funcs/payoutsCancel.d.ts.map +1 -0
- package/dist/commonjs/funcs/payoutsCancel.js +147 -0
- package/dist/commonjs/funcs/payoutsCancel.js.map +1 -0
- package/dist/commonjs/funcs/payoutsCreate.d.ts +54 -0
- package/dist/commonjs/funcs/payoutsCreate.d.ts.map +1 -0
- package/dist/commonjs/funcs/payoutsCreate.js +174 -0
- package/dist/commonjs/funcs/payoutsCreate.js.map +1 -0
- package/dist/commonjs/funcs/payoutsGet.d.ts +19 -0
- package/dist/commonjs/funcs/payoutsGet.d.ts.map +1 -0
- package/dist/commonjs/funcs/payoutsGet.js +144 -0
- package/dist/commonjs/funcs/payoutsGet.js.map +1 -0
- package/dist/commonjs/funcs/payoutsList.d.ts +29 -0
- package/dist/commonjs/funcs/payoutsList.d.ts.map +1 -0
- package/dist/commonjs/funcs/payoutsList.js +182 -0
- package/dist/commonjs/funcs/payoutsList.js.map +1 -0
- package/dist/commonjs/hooks/mollie-auth-utils.js +1 -1
- package/dist/commonjs/hooks/mollie-auth-utils.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/models/entitypayoutresponse.d.ts +102 -0
- package/dist/commonjs/models/entitypayoutresponse.d.ts.map +1 -0
- package/dist/commonjs/models/entitypayoutresponse.js +82 -0
- package/dist/commonjs/models/entitypayoutresponse.js.map +1 -0
- package/dist/commonjs/models/entitywebhookevent.d.ts +8 -2
- package/dist/commonjs/models/entitywebhookevent.d.ts.map +1 -1
- package/dist/commonjs/models/entitywebhookevent.js +8 -0
- package/dist/commonjs/models/entitywebhookevent.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +6 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +6 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/listentitypayout.d.ts +98 -0
- package/dist/commonjs/models/listentitypayout.d.ts.map +1 -0
- package/dist/commonjs/models/listentitypayout.js +81 -0
- package/dist/commonjs/models/listentitypayout.js.map +1 -0
- package/dist/commonjs/models/operations/cancelpayout.d.ts +43 -0
- package/dist/commonjs/models/operations/cancelpayout.d.ts.map +1 -0
- package/dist/commonjs/models/operations/cancelpayout.js +57 -0
- package/dist/commonjs/models/operations/cancelpayout.js.map +1 -0
- package/dist/commonjs/models/operations/createpayout.d.ts +41 -0
- package/dist/commonjs/models/operations/createpayout.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createpayout.js +59 -0
- package/dist/commonjs/models/operations/createpayout.js.map +1 -0
- package/dist/commonjs/models/operations/getpayout.d.ts +43 -0
- package/dist/commonjs/models/operations/getpayout.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getpayout.js +57 -0
- package/dist/commonjs/models/operations/getpayout.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +4 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +4 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listpayouts.d.ts +114 -0
- package/dist/commonjs/models/operations/listpayouts.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listpayouts.js +97 -0
- package/dist/commonjs/models/operations/listpayouts.js.map +1 -0
- package/dist/commonjs/models/payoutrequest.d.ts +45 -0
- package/dist/commonjs/models/payoutrequest.d.ts.map +1 -0
- package/dist/commonjs/models/payoutrequest.js +54 -0
- package/dist/commonjs/models/payoutrequest.js.map +1 -0
- package/dist/commonjs/models/payoutstatus.d.ts +20 -0
- package/dist/commonjs/models/payoutstatus.d.ts.map +1 -0
- package/dist/commonjs/models/payoutstatus.js +55 -0
- package/dist/commonjs/models/payoutstatus.js.map +1 -0
- package/dist/commonjs/models/payoutstatusreason.d.ts +21 -0
- package/dist/commonjs/models/payoutstatusreason.d.ts.map +1 -0
- package/dist/commonjs/models/payoutstatusreason.js +53 -0
- package/dist/commonjs/models/payoutstatusreason.js.map +1 -0
- package/dist/commonjs/models/payoutstatusreasoncode.d.ts +28 -0
- package/dist/commonjs/models/payoutstatusreasoncode.d.ts.map +1 -0
- package/dist/commonjs/models/payoutstatusreasoncode.js +63 -0
- package/dist/commonjs/models/payoutstatusreasoncode.js.map +1 -0
- package/dist/commonjs/models/webhookeventtypes.d.ts +5 -0
- package/dist/commonjs/models/webhookeventtypes.d.ts.map +1 -1
- package/dist/commonjs/models/webhookeventtypes.js +5 -0
- package/dist/commonjs/models/webhookeventtypes.js.map +1 -1
- package/dist/commonjs/sdk/payouts.d.ts +81 -0
- package/dist/commonjs/sdk/payouts.d.ts.map +1 -0
- package/dist/commonjs/sdk/payouts.js +98 -0
- package/dist/commonjs/sdk/payouts.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/funcs/payoutsCancel.d.ts +22 -0
- package/dist/esm/funcs/payoutsCancel.d.ts.map +1 -0
- package/dist/esm/funcs/payoutsCancel.js +111 -0
- package/dist/esm/funcs/payoutsCancel.js.map +1 -0
- package/dist/esm/funcs/payoutsCreate.d.ts +54 -0
- package/dist/esm/funcs/payoutsCreate.d.ts.map +1 -0
- package/dist/esm/funcs/payoutsCreate.js +138 -0
- package/dist/esm/funcs/payoutsCreate.js.map +1 -0
- package/dist/esm/funcs/payoutsGet.d.ts +19 -0
- package/dist/esm/funcs/payoutsGet.d.ts.map +1 -0
- package/dist/esm/funcs/payoutsGet.js +108 -0
- package/dist/esm/funcs/payoutsGet.js.map +1 -0
- package/dist/esm/funcs/payoutsList.d.ts +29 -0
- package/dist/esm/funcs/payoutsList.d.ts.map +1 -0
- package/dist/esm/funcs/payoutsList.js +146 -0
- package/dist/esm/funcs/payoutsList.js.map +1 -0
- package/dist/esm/hooks/mollie-auth-utils.js +1 -1
- package/dist/esm/hooks/mollie-auth-utils.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/models/entitypayoutresponse.d.ts +102 -0
- package/dist/esm/models/entitypayoutresponse.d.ts.map +1 -0
- package/dist/esm/models/entitypayoutresponse.js +44 -0
- package/dist/esm/models/entitypayoutresponse.js.map +1 -0
- package/dist/esm/models/entitywebhookevent.d.ts +8 -2
- package/dist/esm/models/entitywebhookevent.d.ts.map +1 -1
- package/dist/esm/models/entitywebhookevent.js +8 -0
- package/dist/esm/models/entitywebhookevent.js.map +1 -1
- package/dist/esm/models/index.d.ts +6 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +6 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/listentitypayout.d.ts +98 -0
- package/dist/esm/models/listentitypayout.d.ts.map +1 -0
- package/dist/esm/models/listentitypayout.js +43 -0
- package/dist/esm/models/listentitypayout.js.map +1 -0
- package/dist/esm/models/operations/cancelpayout.d.ts +43 -0
- package/dist/esm/models/operations/cancelpayout.d.ts.map +1 -0
- package/dist/esm/models/operations/cancelpayout.js +20 -0
- package/dist/esm/models/operations/cancelpayout.js.map +1 -0
- package/dist/esm/models/operations/createpayout.d.ts +41 -0
- package/dist/esm/models/operations/createpayout.d.ts.map +1 -0
- package/dist/esm/models/operations/createpayout.js +22 -0
- package/dist/esm/models/operations/createpayout.js.map +1 -0
- package/dist/esm/models/operations/getpayout.d.ts +43 -0
- package/dist/esm/models/operations/getpayout.d.ts.map +1 -0
- package/dist/esm/models/operations/getpayout.js +20 -0
- package/dist/esm/models/operations/getpayout.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +4 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +4 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listpayouts.d.ts +114 -0
- package/dist/esm/models/operations/listpayouts.d.ts.map +1 -0
- package/dist/esm/models/operations/listpayouts.js +57 -0
- package/dist/esm/models/operations/listpayouts.js.map +1 -0
- package/dist/esm/models/payoutrequest.d.ts +45 -0
- package/dist/esm/models/payoutrequest.d.ts.map +1 -0
- package/dist/esm/models/payoutrequest.js +17 -0
- package/dist/esm/models/payoutrequest.js.map +1 -0
- package/dist/esm/models/payoutstatus.d.ts +20 -0
- package/dist/esm/models/payoutstatus.d.ts.map +1 -0
- package/dist/esm/models/payoutstatus.js +19 -0
- package/dist/esm/models/payoutstatus.js.map +1 -0
- package/dist/esm/models/payoutstatusreason.d.ts +21 -0
- package/dist/esm/models/payoutstatusreason.d.ts.map +1 -0
- package/dist/esm/models/payoutstatusreason.js +16 -0
- package/dist/esm/models/payoutstatusreason.js.map +1 -0
- package/dist/esm/models/payoutstatusreasoncode.d.ts +28 -0
- package/dist/esm/models/payoutstatusreasoncode.d.ts.map +1 -0
- package/dist/esm/models/payoutstatusreasoncode.js +27 -0
- package/dist/esm/models/payoutstatusreasoncode.js.map +1 -0
- package/dist/esm/models/webhookeventtypes.d.ts +5 -0
- package/dist/esm/models/webhookeventtypes.d.ts.map +1 -1
- package/dist/esm/models/webhookeventtypes.js +5 -0
- package/dist/esm/models/webhookeventtypes.js.map +1 -1
- package/dist/esm/sdk/payouts.d.ts +81 -0
- package/dist/esm/sdk/payouts.d.ts.map +1 -0
- package/dist/esm/sdk/payouts.js +94 -0
- package/dist/esm/sdk/payouts.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/payoutsCancel.ts +204 -0
- package/src/funcs/payoutsCreate.ts +231 -0
- package/src/funcs/payoutsGet.ts +201 -0
- package/src/funcs/payoutsList.ts +278 -0
- package/src/hooks/mollie-auth-utils.ts +3 -3
- package/src/lib/config.ts +2 -2
- package/src/models/entitypayoutresponse.ts +165 -0
- package/src/models/entitywebhookevent.ts +13 -0
- package/src/models/index.ts +6 -0
- package/src/models/listentitypayout.ts +160 -0
- package/src/models/operations/cancelpayout.ts +71 -0
- package/src/models/operations/createpayout.ts +70 -0
- package/src/models/operations/getpayout.ts +71 -0
- package/src/models/operations/index.ts +4 -0
- package/src/models/operations/listpayouts.ts +208 -0
- package/src/models/payoutrequest.ts +68 -0
- package/src/models/payoutstatus.ts +31 -0
- package/src/models/payoutstatusreason.ts +47 -0
- package/src/models/payoutstatusreasoncode.ts +39 -0
- package/src/models/webhookeventtypes.ts +5 -0
- package/src/sdk/payouts.ts +128 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: dc969f7d14e9
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ClientCore } from "../core.js";
|
|
7
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
8
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
9
|
+
import * as M from "../lib/matchers.js";
|
|
10
|
+
import { compactMap } from "../lib/primitives.js";
|
|
11
|
+
import { safeParse } from "../lib/schemas.js";
|
|
12
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
13
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
14
|
+
import { pathToFunc } from "../lib/url.js";
|
|
15
|
+
import { ClientError } from "../models/errors/clienterror.js";
|
|
16
|
+
import {
|
|
17
|
+
ConnectionError,
|
|
18
|
+
InvalidRequestError,
|
|
19
|
+
RequestAbortedError,
|
|
20
|
+
RequestTimeoutError,
|
|
21
|
+
UnexpectedClientError,
|
|
22
|
+
} from "../models/errors/httpclienterrors.js";
|
|
23
|
+
import * as errors from "../models/errors/index.js";
|
|
24
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
25
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
26
|
+
import * as models from "../models/index.js";
|
|
27
|
+
import * as operations from "../models/operations/index.js";
|
|
28
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
29
|
+
import { Result } from "../types/fp.js";
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get payout
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Retrieve a single payout by its ID.
|
|
36
|
+
*/
|
|
37
|
+
export function payoutsGet(
|
|
38
|
+
client: ClientCore,
|
|
39
|
+
request: operations.GetPayoutRequest,
|
|
40
|
+
options?: RequestOptions,
|
|
41
|
+
): APIPromise<
|
|
42
|
+
Result<
|
|
43
|
+
models.EntityPayoutResponse,
|
|
44
|
+
| errors.ErrorResponse
|
|
45
|
+
| ClientError
|
|
46
|
+
| ResponseValidationError
|
|
47
|
+
| ConnectionError
|
|
48
|
+
| RequestAbortedError
|
|
49
|
+
| RequestTimeoutError
|
|
50
|
+
| InvalidRequestError
|
|
51
|
+
| UnexpectedClientError
|
|
52
|
+
| SDKValidationError
|
|
53
|
+
>
|
|
54
|
+
> {
|
|
55
|
+
return new APIPromise($do(
|
|
56
|
+
client,
|
|
57
|
+
request,
|
|
58
|
+
options,
|
|
59
|
+
));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function $do(
|
|
63
|
+
client: ClientCore,
|
|
64
|
+
request: operations.GetPayoutRequest,
|
|
65
|
+
options?: RequestOptions,
|
|
66
|
+
): Promise<
|
|
67
|
+
[
|
|
68
|
+
Result<
|
|
69
|
+
models.EntityPayoutResponse,
|
|
70
|
+
| errors.ErrorResponse
|
|
71
|
+
| ClientError
|
|
72
|
+
| ResponseValidationError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
| RequestAbortedError
|
|
75
|
+
| RequestTimeoutError
|
|
76
|
+
| InvalidRequestError
|
|
77
|
+
| UnexpectedClientError
|
|
78
|
+
| SDKValidationError
|
|
79
|
+
>,
|
|
80
|
+
APICall,
|
|
81
|
+
]
|
|
82
|
+
> {
|
|
83
|
+
const parsed = safeParse(
|
|
84
|
+
request,
|
|
85
|
+
(value) => operations.GetPayoutRequest$outboundSchema.parse(value),
|
|
86
|
+
"Input validation failed",
|
|
87
|
+
);
|
|
88
|
+
if (!parsed.ok) {
|
|
89
|
+
return [parsed, { status: "invalid" }];
|
|
90
|
+
}
|
|
91
|
+
const payload = parsed.value;
|
|
92
|
+
const body = null;
|
|
93
|
+
|
|
94
|
+
const pathParams = {
|
|
95
|
+
payoutId: encodeSimple("payoutId", payload.payoutId, {
|
|
96
|
+
explode: false,
|
|
97
|
+
charEncoding: "percent",
|
|
98
|
+
}),
|
|
99
|
+
};
|
|
100
|
+
const path = pathToFunc("/v2/payouts/{payoutId}")(pathParams);
|
|
101
|
+
|
|
102
|
+
const query = encodeFormQuery({
|
|
103
|
+
"testmode": payload.testmode ?? client._options.testmode,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
const headers = new Headers(compactMap({
|
|
107
|
+
Accept: "application/hal+json",
|
|
108
|
+
"idempotency-key": encodeSimple(
|
|
109
|
+
"idempotency-key",
|
|
110
|
+
payload["idempotency-key"],
|
|
111
|
+
{ explode: false, charEncoding: "none" },
|
|
112
|
+
),
|
|
113
|
+
}));
|
|
114
|
+
|
|
115
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
116
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
117
|
+
|
|
118
|
+
const context = {
|
|
119
|
+
options: client._options,
|
|
120
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
121
|
+
operationID: "get-payout",
|
|
122
|
+
oAuth2Scopes: null,
|
|
123
|
+
|
|
124
|
+
resolvedSecurity: requestSecurity,
|
|
125
|
+
|
|
126
|
+
securitySource: client._options.security,
|
|
127
|
+
retryConfig: options?.retries
|
|
128
|
+
|| client._options.retryConfig
|
|
129
|
+
|| {
|
|
130
|
+
strategy: "backoff",
|
|
131
|
+
backoff: {
|
|
132
|
+
initialInterval: 500,
|
|
133
|
+
maxInterval: 5000,
|
|
134
|
+
exponent: 2,
|
|
135
|
+
maxElapsedTime: 7500,
|
|
136
|
+
},
|
|
137
|
+
retryConnectionErrors: true,
|
|
138
|
+
}
|
|
139
|
+
|| { strategy: "none" },
|
|
140
|
+
retryCodes: options?.retryCodes || ["5xx"],
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
const requestRes = client._createRequest(context, {
|
|
144
|
+
security: requestSecurity,
|
|
145
|
+
method: "GET",
|
|
146
|
+
baseURL: options?.serverURL,
|
|
147
|
+
path: path,
|
|
148
|
+
headers: headers,
|
|
149
|
+
query: query,
|
|
150
|
+
body: body,
|
|
151
|
+
userAgent: client._options.userAgent,
|
|
152
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
153
|
+
}, options);
|
|
154
|
+
if (!requestRes.ok) {
|
|
155
|
+
return [requestRes, { status: "invalid" }];
|
|
156
|
+
}
|
|
157
|
+
const req = requestRes.value;
|
|
158
|
+
|
|
159
|
+
const doResult = await client._do(req, {
|
|
160
|
+
context,
|
|
161
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
162
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
163
|
+
retryConfig: context.retryConfig,
|
|
164
|
+
retryCodes: context.retryCodes,
|
|
165
|
+
});
|
|
166
|
+
if (!doResult.ok) {
|
|
167
|
+
return [doResult, { status: "request-error", request: req }];
|
|
168
|
+
}
|
|
169
|
+
const response = doResult.value;
|
|
170
|
+
|
|
171
|
+
const responseFields = {
|
|
172
|
+
HttpMeta: { Response: response, Request: req },
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const [result] = await M.match<
|
|
176
|
+
models.EntityPayoutResponse,
|
|
177
|
+
| errors.ErrorResponse
|
|
178
|
+
| ClientError
|
|
179
|
+
| ResponseValidationError
|
|
180
|
+
| ConnectionError
|
|
181
|
+
| RequestAbortedError
|
|
182
|
+
| RequestTimeoutError
|
|
183
|
+
| InvalidRequestError
|
|
184
|
+
| UnexpectedClientError
|
|
185
|
+
| SDKValidationError
|
|
186
|
+
>(
|
|
187
|
+
M.json(200, models.EntityPayoutResponse$inboundSchema, {
|
|
188
|
+
ctype: "application/hal+json",
|
|
189
|
+
}),
|
|
190
|
+
M.jsonErr(404, errors.ErrorResponse$inboundSchema, {
|
|
191
|
+
ctype: "application/hal+json",
|
|
192
|
+
}),
|
|
193
|
+
M.fail("4XX"),
|
|
194
|
+
M.fail("5XX"),
|
|
195
|
+
)(response, req, { extraFields: responseFields });
|
|
196
|
+
if (!result.ok) {
|
|
197
|
+
return [result, { status: "complete", request: req, response }];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return [result, { status: "complete", request: req, response }];
|
|
201
|
+
}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 9b9d3a48147e
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { ClientCore } from "../core.js";
|
|
7
|
+
import { dlv } from "../lib/dlv.js";
|
|
8
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
9
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
10
|
+
import * as M from "../lib/matchers.js";
|
|
11
|
+
import { compactMap } from "../lib/primitives.js";
|
|
12
|
+
import { safeParse } from "../lib/schemas.js";
|
|
13
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
14
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
15
|
+
import { pathToFunc } from "../lib/url.js";
|
|
16
|
+
import { ClientError } from "../models/errors/clienterror.js";
|
|
17
|
+
import {
|
|
18
|
+
ConnectionError,
|
|
19
|
+
InvalidRequestError,
|
|
20
|
+
RequestAbortedError,
|
|
21
|
+
RequestTimeoutError,
|
|
22
|
+
UnexpectedClientError,
|
|
23
|
+
} from "../models/errors/httpclienterrors.js";
|
|
24
|
+
import * as errors from "../models/errors/index.js";
|
|
25
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
26
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
27
|
+
import * as operations from "../models/operations/index.js";
|
|
28
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
29
|
+
import { Result } from "../types/fp.js";
|
|
30
|
+
import {
|
|
31
|
+
createPageIterator,
|
|
32
|
+
haltIterator,
|
|
33
|
+
PageIterator,
|
|
34
|
+
Paginator,
|
|
35
|
+
URL_OVERRIDE,
|
|
36
|
+
} from "../types/operations.js";
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* List payouts
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* Retrieve a list of all payouts for your organization, including payouts initiated automatically by the
|
|
43
|
+
* balance's payout schedule and payouts requested via the API or dashboard.
|
|
44
|
+
*
|
|
45
|
+
* Only payouts created on or after April 1st, 2026 are returned.
|
|
46
|
+
*
|
|
47
|
+
* The results are paginated. Use the `from` query parameter together with `_links.next` to iterate through
|
|
48
|
+
* the full result set.
|
|
49
|
+
*/
|
|
50
|
+
export function payoutsList(
|
|
51
|
+
client: ClientCore,
|
|
52
|
+
request?: operations.ListPayoutsRequest | undefined,
|
|
53
|
+
options?: RequestOptions & { [URL_OVERRIDE]?: URL },
|
|
54
|
+
): APIPromise<
|
|
55
|
+
PageIterator<
|
|
56
|
+
Result<
|
|
57
|
+
operations.ListPayoutsResponse,
|
|
58
|
+
| errors.ErrorResponse
|
|
59
|
+
| ClientError
|
|
60
|
+
| ResponseValidationError
|
|
61
|
+
| ConnectionError
|
|
62
|
+
| RequestAbortedError
|
|
63
|
+
| RequestTimeoutError
|
|
64
|
+
| InvalidRequestError
|
|
65
|
+
| UnexpectedClientError
|
|
66
|
+
| SDKValidationError
|
|
67
|
+
>,
|
|
68
|
+
{ url: string }
|
|
69
|
+
>
|
|
70
|
+
> {
|
|
71
|
+
return new APIPromise($do(
|
|
72
|
+
client,
|
|
73
|
+
request,
|
|
74
|
+
options,
|
|
75
|
+
));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function $do(
|
|
79
|
+
client: ClientCore,
|
|
80
|
+
request?: operations.ListPayoutsRequest | undefined,
|
|
81
|
+
options?: RequestOptions & { [URL_OVERRIDE]?: URL },
|
|
82
|
+
): Promise<
|
|
83
|
+
[
|
|
84
|
+
PageIterator<
|
|
85
|
+
Result<
|
|
86
|
+
operations.ListPayoutsResponse,
|
|
87
|
+
| errors.ErrorResponse
|
|
88
|
+
| ClientError
|
|
89
|
+
| ResponseValidationError
|
|
90
|
+
| ConnectionError
|
|
91
|
+
| RequestAbortedError
|
|
92
|
+
| RequestTimeoutError
|
|
93
|
+
| InvalidRequestError
|
|
94
|
+
| UnexpectedClientError
|
|
95
|
+
| SDKValidationError
|
|
96
|
+
>,
|
|
97
|
+
{ url: string }
|
|
98
|
+
>,
|
|
99
|
+
APICall,
|
|
100
|
+
]
|
|
101
|
+
> {
|
|
102
|
+
const parsed = safeParse(
|
|
103
|
+
request,
|
|
104
|
+
(value) =>
|
|
105
|
+
operations.ListPayoutsRequest$outboundSchema.optional().parse(value),
|
|
106
|
+
"Input validation failed",
|
|
107
|
+
);
|
|
108
|
+
if (!parsed.ok) {
|
|
109
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
110
|
+
}
|
|
111
|
+
const payload = parsed.value;
|
|
112
|
+
const body = null;
|
|
113
|
+
|
|
114
|
+
const path = options?.[URL_OVERRIDE]
|
|
115
|
+
? ""
|
|
116
|
+
: pathToFunc("/v2/payouts")();
|
|
117
|
+
|
|
118
|
+
const query = options?.[URL_OVERRIDE]
|
|
119
|
+
? options[URL_OVERRIDE].search.substring(1)
|
|
120
|
+
: encodeFormQuery({
|
|
121
|
+
"balanceId": payload?.balanceId,
|
|
122
|
+
"from": payload?.from,
|
|
123
|
+
"limit": payload?.limit,
|
|
124
|
+
"sort": payload?.sort,
|
|
125
|
+
"testmode": payload?.testmode ?? client._options.testmode,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const headers = new Headers(compactMap({
|
|
129
|
+
Accept: "application/hal+json",
|
|
130
|
+
"idempotency-key": encodeSimple(
|
|
131
|
+
"idempotency-key",
|
|
132
|
+
payload?.["idempotency-key"],
|
|
133
|
+
{ explode: false, charEncoding: "none" },
|
|
134
|
+
),
|
|
135
|
+
}));
|
|
136
|
+
|
|
137
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
138
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
139
|
+
|
|
140
|
+
const context = {
|
|
141
|
+
options: client._options,
|
|
142
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
143
|
+
operationID: "list-payouts",
|
|
144
|
+
oAuth2Scopes: null,
|
|
145
|
+
|
|
146
|
+
resolvedSecurity: requestSecurity,
|
|
147
|
+
|
|
148
|
+
securitySource: client._options.security,
|
|
149
|
+
retryConfig: options?.retries
|
|
150
|
+
|| client._options.retryConfig
|
|
151
|
+
|| {
|
|
152
|
+
strategy: "backoff",
|
|
153
|
+
backoff: {
|
|
154
|
+
initialInterval: 500,
|
|
155
|
+
maxInterval: 5000,
|
|
156
|
+
exponent: 2,
|
|
157
|
+
maxElapsedTime: 7500,
|
|
158
|
+
},
|
|
159
|
+
retryConnectionErrors: true,
|
|
160
|
+
}
|
|
161
|
+
|| { strategy: "none" },
|
|
162
|
+
retryCodes: options?.retryCodes || ["5xx"],
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const requestRes = client._createRequest(context, {
|
|
166
|
+
security: requestSecurity,
|
|
167
|
+
method: "GET",
|
|
168
|
+
baseURL: options?.[URL_OVERRIDE]?.href || options?.serverURL,
|
|
169
|
+
path: path,
|
|
170
|
+
headers: headers,
|
|
171
|
+
query: query,
|
|
172
|
+
body: body,
|
|
173
|
+
userAgent: client._options.userAgent,
|
|
174
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
175
|
+
}, options);
|
|
176
|
+
if (!requestRes.ok) {
|
|
177
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
178
|
+
}
|
|
179
|
+
const req = requestRes.value;
|
|
180
|
+
|
|
181
|
+
const doResult = await client._do(req, {
|
|
182
|
+
context,
|
|
183
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
184
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
185
|
+
retryConfig: context.retryConfig,
|
|
186
|
+
retryCodes: context.retryCodes,
|
|
187
|
+
});
|
|
188
|
+
if (!doResult.ok) {
|
|
189
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
190
|
+
}
|
|
191
|
+
const response = doResult.value;
|
|
192
|
+
|
|
193
|
+
const responseFields = {
|
|
194
|
+
HttpMeta: { Response: response, Request: req },
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const [result, raw] = await M.match<
|
|
198
|
+
operations.ListPayoutsResponse,
|
|
199
|
+
| errors.ErrorResponse
|
|
200
|
+
| ClientError
|
|
201
|
+
| ResponseValidationError
|
|
202
|
+
| ConnectionError
|
|
203
|
+
| RequestAbortedError
|
|
204
|
+
| RequestTimeoutError
|
|
205
|
+
| InvalidRequestError
|
|
206
|
+
| UnexpectedClientError
|
|
207
|
+
| SDKValidationError
|
|
208
|
+
>(
|
|
209
|
+
M.json(200, operations.ListPayoutsResponse$inboundSchema, {
|
|
210
|
+
ctype: "application/hal+json",
|
|
211
|
+
key: "Result",
|
|
212
|
+
}),
|
|
213
|
+
M.jsonErr(400, errors.ErrorResponse$inboundSchema, {
|
|
214
|
+
ctype: "application/hal+json",
|
|
215
|
+
}),
|
|
216
|
+
M.fail("4XX"),
|
|
217
|
+
M.fail("5XX"),
|
|
218
|
+
)(response, req, { extraFields: responseFields });
|
|
219
|
+
if (!result.ok) {
|
|
220
|
+
return [haltIterator(result), {
|
|
221
|
+
status: "complete",
|
|
222
|
+
request: req,
|
|
223
|
+
response,
|
|
224
|
+
}];
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
const nextFunc = (
|
|
228
|
+
responseData: unknown,
|
|
229
|
+
): {
|
|
230
|
+
next: Paginator<
|
|
231
|
+
Result<
|
|
232
|
+
operations.ListPayoutsResponse,
|
|
233
|
+
| errors.ErrorResponse
|
|
234
|
+
| ClientError
|
|
235
|
+
| ResponseValidationError
|
|
236
|
+
| ConnectionError
|
|
237
|
+
| RequestAbortedError
|
|
238
|
+
| RequestTimeoutError
|
|
239
|
+
| InvalidRequestError
|
|
240
|
+
| UnexpectedClientError
|
|
241
|
+
| SDKValidationError
|
|
242
|
+
>
|
|
243
|
+
>;
|
|
244
|
+
"~next"?: { url: string };
|
|
245
|
+
} => {
|
|
246
|
+
let nextURL = dlv(responseData, "_links.next.href");
|
|
247
|
+
if (typeof nextURL !== "string") {
|
|
248
|
+
return { next: () => null };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
try {
|
|
252
|
+
if (nextURL.startsWith("/")) {
|
|
253
|
+
nextURL = new URL(nextURL, client._baseURL ?? "").href;
|
|
254
|
+
}
|
|
255
|
+
new URL(nextURL);
|
|
256
|
+
} catch (_error) {
|
|
257
|
+
return { next: () => null };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const nextVal = () =>
|
|
261
|
+
payoutsList(
|
|
262
|
+
client,
|
|
263
|
+
{
|
|
264
|
+
...request!,
|
|
265
|
+
},
|
|
266
|
+
{ ...options, [URL_OVERRIDE]: new URL(nextURL) },
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
return { next: nextVal, "~next": { url: nextURL } };
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
273
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
274
|
+
status: "complete",
|
|
275
|
+
request: req,
|
|
276
|
+
response,
|
|
277
|
+
}];
|
|
278
|
+
}
|
|
@@ -7,9 +7,9 @@ export function clientCanHaveGlobalFields(options: SDKOptions): boolean {
|
|
|
7
7
|
const securityObj = typeof security === "function" ? security() : security;
|
|
8
8
|
if (securityObj instanceof Promise) return false;
|
|
9
9
|
|
|
10
|
-
const token = (securityObj as { apiKey?: string;
|
|
11
|
-
|| (securityObj as { apiKey?: string;
|
|
12
|
-
|| (securityObj as { apiKey?: string;
|
|
10
|
+
const token = (securityObj as { apiKey?: string; advancedAccessToken?: string; oAuth?: string }).apiKey
|
|
11
|
+
|| (securityObj as { apiKey?: string; advancedAccessToken?: string; oAuth?: string }).advancedAccessToken
|
|
12
|
+
|| (securityObj as { apiKey?: string; advancedAccessToken?: string; oAuth?: string }).oAuth;
|
|
13
13
|
return !!token && token.startsWith("access_");
|
|
14
14
|
}
|
|
15
15
|
|
package/src/lib/config.ts
CHANGED
|
@@ -78,8 +78,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
78
78
|
export const SDK_METADATA = {
|
|
79
79
|
language: "typescript",
|
|
80
80
|
openapiDocVersion: "1.0.0",
|
|
81
|
-
sdkVersion: "1.
|
|
81
|
+
sdkVersion: "1.7.1",
|
|
82
82
|
genVersion: "2.882.0",
|
|
83
83
|
userAgent:
|
|
84
|
-
"speakeasy-sdk/typescript 1.
|
|
84
|
+
"speakeasy-sdk/typescript 1.7.1 2.882.0 1.0.0 mollie-api-typescript",
|
|
85
85
|
} as const;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 43f55d244bf6
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import * as z from "zod/v3";
|
|
7
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
8
|
+
import { safeParse } from "../lib/schemas.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
10
|
+
import {
|
|
11
|
+
AmountNullable,
|
|
12
|
+
AmountNullable$inboundSchema,
|
|
13
|
+
} from "./amountnullable.js";
|
|
14
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
15
|
+
import { Mode, Mode$inboundSchema } from "./mode.js";
|
|
16
|
+
import { PayoutStatus, PayoutStatus$inboundSchema } from "./payoutstatus.js";
|
|
17
|
+
import {
|
|
18
|
+
PayoutStatusReason,
|
|
19
|
+
PayoutStatusReason$inboundSchema,
|
|
20
|
+
} from "./payoutstatusreason.js";
|
|
21
|
+
import { Url, Url$inboundSchema } from "./url.js";
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* An object with several relevant URLs. Every URL object will contain an `href` and a `type` field.
|
|
25
|
+
*/
|
|
26
|
+
export type EntityPayoutResponseLinks = {
|
|
27
|
+
/**
|
|
28
|
+
* In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.
|
|
29
|
+
*/
|
|
30
|
+
self: Url;
|
|
31
|
+
/**
|
|
32
|
+
* In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field.
|
|
33
|
+
*/
|
|
34
|
+
documentation: Url;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type EntityPayoutResponse = {
|
|
38
|
+
/**
|
|
39
|
+
* Indicates the response contains a payout object. Will always contain the string `payout` for this endpoint.
|
|
40
|
+
*/
|
|
41
|
+
resource: string;
|
|
42
|
+
/**
|
|
43
|
+
* The identifier uniquely referring to this payout. Mollie assigns this identifier at payout creation time.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* Mollie will always refer to the payout by this ID. Example: `payout_j8NvRAM2WNZtsykpLEX8J`.
|
|
47
|
+
*/
|
|
48
|
+
id: string;
|
|
49
|
+
/**
|
|
50
|
+
* The identifier of the balance that will be paid out. Example: `bal_gVMhHKqSSRYJyPsuoPNFH`.
|
|
51
|
+
*/
|
|
52
|
+
balanceId: string;
|
|
53
|
+
/**
|
|
54
|
+
* The amount to pay out. When omitted from the request, the full available balance minus any configured
|
|
55
|
+
*
|
|
56
|
+
* @remarks
|
|
57
|
+
* balance reserve is paid out.
|
|
58
|
+
*
|
|
59
|
+
* Merchants registered in the United Kingdom cannot specify a custom amount — omit this field to pay out
|
|
60
|
+
* the full available balance.
|
|
61
|
+
*
|
|
62
|
+
* The value in the response reflects the amount paid out, excluding any applicable fees.
|
|
63
|
+
*/
|
|
64
|
+
amount?: AmountNullable | null | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* The description that will appear on the bank statement for this payout.
|
|
67
|
+
*/
|
|
68
|
+
description?: string | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* The status of the payout.
|
|
71
|
+
*/
|
|
72
|
+
status: PayoutStatus;
|
|
73
|
+
/**
|
|
74
|
+
* The reason for the payout's current status.
|
|
75
|
+
*/
|
|
76
|
+
statusReason: PayoutStatusReason;
|
|
77
|
+
/**
|
|
78
|
+
* The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
79
|
+
*/
|
|
80
|
+
createdAt: string;
|
|
81
|
+
/**
|
|
82
|
+
* The date and time the payout was initiated, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* This is the moment Mollie attempted to reserve the funds on the balance.
|
|
86
|
+
*/
|
|
87
|
+
initiatedAt?: string | null | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* The date and time the payout was sent to the destination bank account, in
|
|
90
|
+
*
|
|
91
|
+
* @remarks
|
|
92
|
+
* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. `null` if the payout has not completed yet.
|
|
93
|
+
*/
|
|
94
|
+
completedAt?: string | null | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* The date and time the payout was canceled, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* `null` if the payout was not canceled.
|
|
100
|
+
*/
|
|
101
|
+
canceledAt?: string | null | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Whether this entity was created in live mode or in test mode.
|
|
104
|
+
*/
|
|
105
|
+
mode: Mode;
|
|
106
|
+
/**
|
|
107
|
+
* An object with several relevant URLs. Every URL object will contain an `href` and a `type` field.
|
|
108
|
+
*/
|
|
109
|
+
links?: EntityPayoutResponseLinks | undefined;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/** @internal */
|
|
113
|
+
export const EntityPayoutResponseLinks$inboundSchema: z.ZodType<
|
|
114
|
+
EntityPayoutResponseLinks,
|
|
115
|
+
z.ZodTypeDef,
|
|
116
|
+
unknown
|
|
117
|
+
> = z.object({
|
|
118
|
+
self: Url$inboundSchema,
|
|
119
|
+
documentation: Url$inboundSchema,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export function entityPayoutResponseLinksFromJSON(
|
|
123
|
+
jsonString: string,
|
|
124
|
+
): SafeParseResult<EntityPayoutResponseLinks, SDKValidationError> {
|
|
125
|
+
return safeParse(
|
|
126
|
+
jsonString,
|
|
127
|
+
(x) => EntityPayoutResponseLinks$inboundSchema.parse(JSON.parse(x)),
|
|
128
|
+
`Failed to parse 'EntityPayoutResponseLinks' from JSON`,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** @internal */
|
|
133
|
+
export const EntityPayoutResponse$inboundSchema: z.ZodType<
|
|
134
|
+
EntityPayoutResponse,
|
|
135
|
+
z.ZodTypeDef,
|
|
136
|
+
unknown
|
|
137
|
+
> = z.object({
|
|
138
|
+
resource: z.string(),
|
|
139
|
+
id: z.string(),
|
|
140
|
+
balanceId: z.string(),
|
|
141
|
+
amount: z.nullable(AmountNullable$inboundSchema).optional(),
|
|
142
|
+
description: z.string().optional(),
|
|
143
|
+
status: PayoutStatus$inboundSchema,
|
|
144
|
+
statusReason: PayoutStatusReason$inboundSchema,
|
|
145
|
+
createdAt: z.string(),
|
|
146
|
+
initiatedAt: z.nullable(z.string()).optional(),
|
|
147
|
+
completedAt: z.nullable(z.string()).optional(),
|
|
148
|
+
canceledAt: z.nullable(z.string()).optional(),
|
|
149
|
+
mode: Mode$inboundSchema,
|
|
150
|
+
_links: z.lazy(() => EntityPayoutResponseLinks$inboundSchema).optional(),
|
|
151
|
+
}).transform((v) => {
|
|
152
|
+
return remap$(v, {
|
|
153
|
+
"_links": "links",
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
export function entityPayoutResponseFromJSON(
|
|
158
|
+
jsonString: string,
|
|
159
|
+
): SafeParseResult<EntityPayoutResponse, SDKValidationError> {
|
|
160
|
+
return safeParse(
|
|
161
|
+
jsonString,
|
|
162
|
+
(x) => EntityPayoutResponse$inboundSchema.parse(JSON.parse(x)),
|
|
163
|
+
`Failed to parse 'EntityPayoutResponse' from JSON`,
|
|
164
|
+
);
|
|
165
|
+
}
|