@gr4vy/sdk 2.1.7 → 2.2.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.
Files changed (75) hide show
  1. package/README.md +7 -0
  2. package/funcs/transactionsCapturesGet.d.ts +18 -0
  3. package/funcs/transactionsCapturesGet.d.ts.map +1 -0
  4. package/funcs/transactionsCapturesGet.js +145 -0
  5. package/funcs/transactionsCapturesGet.js.map +1 -0
  6. package/funcs/transactionsCapturesList.d.ts +18 -0
  7. package/funcs/transactionsCapturesList.d.ts.map +1 -0
  8. package/funcs/transactionsCapturesList.js +140 -0
  9. package/funcs/transactionsCapturesList.js.map +1 -0
  10. package/jsr.json +1 -1
  11. package/lib/config.d.ts +3 -3
  12. package/lib/config.js +3 -3
  13. package/lib/sdks.d.ts.map +1 -1
  14. package/lib/sdks.js +37 -12
  15. package/lib/sdks.js.map +1 -1
  16. package/models/components/capture.d.ts +84 -0
  17. package/models/components/capture.d.ts.map +1 -0
  18. package/models/components/capture.js +86 -0
  19. package/models/components/capture.js.map +1 -0
  20. package/models/components/capturecollection.d.ts +26 -0
  21. package/models/components/capturecollection.d.ts.map +1 -0
  22. package/models/components/capturecollection.js +60 -0
  23. package/models/components/capturecollection.js.map +1 -0
  24. package/models/components/index.d.ts +2 -0
  25. package/models/components/index.d.ts.map +1 -1
  26. package/models/components/index.js +2 -0
  27. package/models/components/index.js.map +1 -1
  28. package/models/components/method.d.ts +1 -0
  29. package/models/components/method.d.ts.map +1 -1
  30. package/models/components/method.js +1 -0
  31. package/models/components/method.js.map +1 -1
  32. package/models/components/redirectpaymentmethodcreate.d.ts +1 -0
  33. package/models/components/redirectpaymentmethodcreate.d.ts.map +1 -1
  34. package/models/components/redirectpaymentmethodcreate.js +1 -0
  35. package/models/components/redirectpaymentmethodcreate.js.map +1 -1
  36. package/models/components/transactioncapturecreate.d.ts +10 -0
  37. package/models/components/transactioncapturecreate.d.ts.map +1 -1
  38. package/models/components/transactioncapturecreate.js +3 -0
  39. package/models/components/transactioncapturecreate.js.map +1 -1
  40. package/models/operations/gettransactioncapture.d.ts +28 -0
  41. package/models/operations/gettransactioncapture.d.ts.map +1 -0
  42. package/models/operations/gettransactioncapture.js +57 -0
  43. package/models/operations/gettransactioncapture.js.map +1 -0
  44. package/models/operations/index.d.ts +2 -0
  45. package/models/operations/index.d.ts.map +1 -1
  46. package/models/operations/index.js +2 -0
  47. package/models/operations/index.js.map +1 -1
  48. package/models/operations/listtransactioncaptures.d.ts +23 -0
  49. package/models/operations/listtransactioncaptures.d.ts.map +1 -0
  50. package/models/operations/listtransactioncaptures.js +55 -0
  51. package/models/operations/listtransactioncaptures.js.map +1 -0
  52. package/package.json +1 -1
  53. package/sdk/captures.d.ts +19 -0
  54. package/sdk/captures.d.ts.map +1 -0
  55. package/sdk/captures.js +32 -0
  56. package/sdk/captures.js.map +1 -0
  57. package/sdk/transactions.d.ts +3 -0
  58. package/sdk/transactions.d.ts.map +1 -1
  59. package/sdk/transactions.js +4 -0
  60. package/sdk/transactions.js.map +1 -1
  61. package/src/funcs/transactionsCapturesGet.ts +255 -0
  62. package/src/funcs/transactionsCapturesList.ts +247 -0
  63. package/src/lib/config.ts +3 -3
  64. package/src/lib/sdks.ts +41 -13
  65. package/src/models/components/capture.ts +142 -0
  66. package/src/models/components/capturecollection.ts +56 -0
  67. package/src/models/components/index.ts +2 -0
  68. package/src/models/components/method.ts +1 -0
  69. package/src/models/components/redirectpaymentmethodcreate.ts +1 -0
  70. package/src/models/components/transactioncapturecreate.ts +13 -0
  71. package/src/models/operations/gettransactioncapture.ts +58 -0
  72. package/src/models/operations/index.ts +2 -0
  73. package/src/models/operations/listtransactioncaptures.ts +51 -0
  74. package/src/sdk/captures.ts +51 -0
  75. package/src/sdk/transactions.ts +6 -0
@@ -0,0 +1,247 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { Gr4vyCore } from "../core.js";
6
+ import { encodeSimple } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import { Gr4vyError } from "../models/errors/gr4vyerror.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 operations from "../models/operations/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * List transaction captures
32
+ *
33
+ * @remarks
34
+ * List all captures for a specific transaction.
35
+ */
36
+ export function transactionsCapturesList(
37
+ client: Gr4vyCore,
38
+ transactionId: string,
39
+ merchantAccountId?: string | null | undefined,
40
+ options?: RequestOptions,
41
+ ): APIPromise<
42
+ Result<
43
+ components.CaptureCollection,
44
+ | errors.Error400
45
+ | errors.Error401
46
+ | errors.Error403
47
+ | errors.Error404
48
+ | errors.Error405
49
+ | errors.Error409
50
+ | errors.HTTPValidationError
51
+ | errors.Error425
52
+ | errors.Error429
53
+ | errors.Error500
54
+ | errors.Error502
55
+ | errors.Error504
56
+ | Gr4vyError
57
+ | ResponseValidationError
58
+ | ConnectionError
59
+ | RequestAbortedError
60
+ | RequestTimeoutError
61
+ | InvalidRequestError
62
+ | UnexpectedClientError
63
+ | SDKValidationError
64
+ >
65
+ > {
66
+ return new APIPromise($do(
67
+ client,
68
+ transactionId,
69
+ merchantAccountId,
70
+ options,
71
+ ));
72
+ }
73
+
74
+ async function $do(
75
+ client: Gr4vyCore,
76
+ transactionId: string,
77
+ merchantAccountId?: string | null | undefined,
78
+ options?: RequestOptions,
79
+ ): Promise<
80
+ [
81
+ Result<
82
+ components.CaptureCollection,
83
+ | errors.Error400
84
+ | errors.Error401
85
+ | errors.Error403
86
+ | errors.Error404
87
+ | errors.Error405
88
+ | errors.Error409
89
+ | errors.HTTPValidationError
90
+ | errors.Error425
91
+ | errors.Error429
92
+ | errors.Error500
93
+ | errors.Error502
94
+ | errors.Error504
95
+ | Gr4vyError
96
+ | ResponseValidationError
97
+ | ConnectionError
98
+ | RequestAbortedError
99
+ | RequestTimeoutError
100
+ | InvalidRequestError
101
+ | UnexpectedClientError
102
+ | SDKValidationError
103
+ >,
104
+ APICall,
105
+ ]
106
+ > {
107
+ const input: operations.ListTransactionCapturesRequest = {
108
+ transactionId: transactionId,
109
+ merchantAccountId: merchantAccountId,
110
+ };
111
+
112
+ const parsed = safeParse(
113
+ input,
114
+ (value) =>
115
+ operations.ListTransactionCapturesRequest$outboundSchema.parse(value),
116
+ "Input validation failed",
117
+ );
118
+ if (!parsed.ok) {
119
+ return [parsed, { status: "invalid" }];
120
+ }
121
+ const payload = parsed.value;
122
+ const body = null;
123
+
124
+ const pathParams = {
125
+ transaction_id: encodeSimple("transaction_id", payload.transaction_id, {
126
+ explode: false,
127
+ charEncoding: "percent",
128
+ }),
129
+ };
130
+ const path = pathToFunc("/transactions/{transaction_id}/captures")(
131
+ pathParams,
132
+ );
133
+
134
+ const headers = new Headers(compactMap({
135
+ Accept: "application/json",
136
+ "x-gr4vy-merchant-account-id": encodeSimple(
137
+ "x-gr4vy-merchant-account-id",
138
+ payload.merchantAccountId ?? client._options.merchantAccountId,
139
+ { explode: false, charEncoding: "none" },
140
+ ),
141
+ }));
142
+
143
+ const secConfig = await extractSecurity(client._options.bearerAuth);
144
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
145
+ const requestSecurity = resolveGlobalSecurity(securityInput);
146
+
147
+ const context = {
148
+ options: client._options,
149
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
150
+ operationID: "list_transaction_captures",
151
+ oAuth2Scopes: null,
152
+
153
+ resolvedSecurity: requestSecurity,
154
+
155
+ securitySource: client._options.bearerAuth,
156
+ retryConfig: options?.retries
157
+ || client._options.retryConfig
158
+ || {
159
+ strategy: "backoff",
160
+ backoff: {
161
+ initialInterval: 200,
162
+ maxInterval: 200,
163
+ exponent: 1,
164
+ maxElapsedTime: 1000,
165
+ },
166
+ retryConnectionErrors: true,
167
+ }
168
+ || { strategy: "none" },
169
+ retryCodes: options?.retryCodes || ["5XX"],
170
+ };
171
+
172
+ const requestRes = client._createRequest(context, {
173
+ security: requestSecurity,
174
+ method: "GET",
175
+ baseURL: options?.serverURL,
176
+ path: path,
177
+ headers: headers,
178
+ body: body,
179
+ userAgent: client._options.userAgent,
180
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
181
+ }, options);
182
+ if (!requestRes.ok) {
183
+ return [requestRes, { status: "invalid" }];
184
+ }
185
+ const req = requestRes.value;
186
+
187
+ const doResult = await client._do(req, {
188
+ context,
189
+ isErrorStatusCode: (statusCode: number) =>
190
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
191
+ retryConfig: context.retryConfig,
192
+ retryCodes: context.retryCodes,
193
+ });
194
+ if (!doResult.ok) {
195
+ return [doResult, { status: "request-error", request: req }];
196
+ }
197
+ const response = doResult.value;
198
+
199
+ const responseFields = {
200
+ HttpMeta: { Response: response, Request: req },
201
+ };
202
+
203
+ const [result] = await M.match<
204
+ components.CaptureCollection,
205
+ | errors.Error400
206
+ | errors.Error401
207
+ | errors.Error403
208
+ | errors.Error404
209
+ | errors.Error405
210
+ | errors.Error409
211
+ | errors.HTTPValidationError
212
+ | errors.Error425
213
+ | errors.Error429
214
+ | errors.Error500
215
+ | errors.Error502
216
+ | errors.Error504
217
+ | Gr4vyError
218
+ | ResponseValidationError
219
+ | ConnectionError
220
+ | RequestAbortedError
221
+ | RequestTimeoutError
222
+ | InvalidRequestError
223
+ | UnexpectedClientError
224
+ | SDKValidationError
225
+ >(
226
+ M.json(200, components.CaptureCollection$inboundSchema),
227
+ M.jsonErr(400, errors.Error400$inboundSchema),
228
+ M.jsonErr(401, errors.Error401$inboundSchema),
229
+ M.jsonErr(403, errors.Error403$inboundSchema),
230
+ M.jsonErr(404, errors.Error404$inboundSchema),
231
+ M.jsonErr(405, errors.Error405$inboundSchema),
232
+ M.jsonErr(409, errors.Error409$inboundSchema),
233
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
234
+ M.jsonErr(425, errors.Error425$inboundSchema),
235
+ M.jsonErr(429, errors.Error429$inboundSchema),
236
+ M.jsonErr(500, errors.Error500$inboundSchema),
237
+ M.jsonErr(502, errors.Error502$inboundSchema),
238
+ M.jsonErr(504, errors.Error504$inboundSchema),
239
+ M.fail("4XX"),
240
+ M.fail("5XX"),
241
+ )(response, req, { extraFields: responseFields });
242
+ if (!result.ok) {
243
+ return [result, { status: "complete", request: req, response }];
244
+ }
245
+
246
+ return [result, { status: "complete", request: req, response }];
247
+ }
package/src/lib/config.ts CHANGED
@@ -77,7 +77,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
77
77
  export const SDK_METADATA = {
78
78
  language: "typescript",
79
79
  openapiDocVersion: "1.0.0",
80
- sdkVersion: "2.1.7",
81
- genVersion: "2.897.1",
82
- userAgent: "speakeasy-sdk/typescript 2.1.7 2.897.1 1.0.0 @gr4vy/sdk",
80
+ sdkVersion: "2.2.1",
81
+ genVersion: "2.900.1",
82
+ userAgent: "speakeasy-sdk/typescript 2.2.1 2.900.1 1.0.0 @gr4vy/sdk",
83
83
  } as const;
package/src/lib/sdks.ts CHANGED
@@ -133,27 +133,55 @@ export class ClientSDK {
133
133
  if (path) {
134
134
  baseURL.pathname = baseURL.pathname.replace(/\/+$/, "") + "/";
135
135
  reqURL = new URL(path, baseURL);
136
+ if (!reqURL.search && baseURL.search) {
137
+ reqURL.search = baseURL.search;
138
+ }
136
139
  } else {
137
140
  reqURL = baseURL;
138
141
  }
139
142
  reqURL.hash = "";
140
143
 
141
- let finalQuery = query || "";
142
-
143
- const secQuery: string[] = [];
144
- for (const [k, v] of Object.entries(security?.queryParams || {})) {
145
- const q = encodeForm(k, v, { charEncoding: "percent" });
146
- if (typeof q !== "undefined") {
147
- secQuery.push(q);
144
+ // Appends already-encoded query pairs to a query string, replacing any
145
+ // existing pairs with the same key so later sources take precedence.
146
+ const mergeQuery = (current: string, additions: string): string => {
147
+ if (!additions) {
148
+ return current;
148
149
  }
149
- }
150
- if (secQuery.length) {
151
- finalQuery += `&${secQuery.join("&")}`;
152
- }
150
+ const additionKeys = new Set(
151
+ additions
152
+ .split("&")
153
+ .filter((pair) => pair !== "")
154
+ .map((pair) => pair.split("=")[0] ?? ""),
155
+ );
156
+ const kept = current.split("&").filter((pair) => {
157
+ return pair !== "" && !additionKeys.has(pair.split("=")[0] ?? "");
158
+ });
159
+ return [...kept, additions].join("&");
160
+ };
161
+
162
+ const encodeQueryRecord = (record: Record<string, unknown>): string => {
163
+ return Object.entries(record)
164
+ .map(([k, v]) => {
165
+ if (v == null) {
166
+ return undefined;
167
+ }
168
+ const value = v;
169
+ return encodeForm(k, value, {
170
+ explode: Array.isArray(value),
171
+ charEncoding: "percent",
172
+ });
173
+ })
174
+ .filter((pair): pair is string => typeof pair !== "undefined")
175
+ .join("&");
176
+ };
177
+
178
+ const finalQuery = [
179
+ query || "",
180
+ encodeQueryRecord(security?.queryParams || {}),
181
+ ].reduce(mergeQuery, reqURL.search.slice(1));
153
182
 
154
183
  if (finalQuery) {
155
- const q = finalQuery.startsWith("&") ? finalQuery.slice(1) : finalQuery;
156
- reqURL.search = `?${q}`;
184
+ reqURL.search = `?${finalQuery}`;
157
185
  }
158
186
 
159
187
  const headers = new Headers(opHeaders);
@@ -0,0 +1,142 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import { CaptureStatus, CaptureStatus$inboundSchema } from "./capturestatus.js";
11
+ import { CartItem, CartItem$inboundSchema } from "./cartitem.js";
12
+
13
+ export type Capture = {
14
+ /**
15
+ * Always `capture`.
16
+ */
17
+ type: "capture";
18
+ /**
19
+ * The unique identifier for the capture.
20
+ */
21
+ id: string;
22
+ /**
23
+ * The merchant account this capture belongs to.
24
+ */
25
+ merchantAccountId: string;
26
+ /**
27
+ * The ID of the transaction associated with this capture.
28
+ */
29
+ transactionId: string;
30
+ /**
31
+ * The payment service's unique ID for the capture.
32
+ */
33
+ xid?: string | null | undefined;
34
+ /**
35
+ * The ISO 4217 currency code for this capture.
36
+ */
37
+ currency: string;
38
+ /**
39
+ * The capture amount in the smallest currency unit.
40
+ */
41
+ amount: number;
42
+ status: CaptureStatus;
43
+ /**
44
+ * Whether this is marked as the final capture for the associated transaction.
45
+ */
46
+ final: boolean;
47
+ /**
48
+ * The date and time this capture was created.
49
+ */
50
+ createdAt: Date;
51
+ /**
52
+ * The date and time this capture was last updated.
53
+ */
54
+ updatedAt: Date;
55
+ /**
56
+ * The date and time the capture was completed.
57
+ */
58
+ capturedAt?: Date | null | undefined;
59
+ /**
60
+ * An external identifier that can be used to match the capture against your own records.
61
+ */
62
+ externalIdentifier?: string | null | undefined;
63
+ /**
64
+ * The standardized error code set by Gr4vy.
65
+ */
66
+ errorCode?: string | null | undefined;
67
+ /**
68
+ * The ISO response code.
69
+ */
70
+ isoResponseCode?: string | null | undefined;
71
+ /**
72
+ * This is the response code received from the payment service. This can be set to any value and is not standardized across different payment services.
73
+ */
74
+ rawResponseCode?: string | null | undefined;
75
+ /**
76
+ * This is the response description received from the payment service. This can be set to any value and is not standardized across different payment services.
77
+ */
78
+ rawResponseDescription?: string | null | undefined;
79
+ /**
80
+ * The external identifier of the associated transaction.
81
+ */
82
+ transactionExternalIdentifier?: string | null | undefined;
83
+ /**
84
+ * An array of cart items that represents the line items of this capture.
85
+ */
86
+ cartItems?: Array<CartItem> | null | undefined;
87
+ };
88
+
89
+ /** @internal */
90
+ export const Capture$inboundSchema: z.ZodType<Capture, z.ZodTypeDef, unknown> =
91
+ z.object({
92
+ type: z.literal("capture").default("capture"),
93
+ id: z.string(),
94
+ merchant_account_id: z.string(),
95
+ transaction_id: z.string(),
96
+ xid: z.nullable(z.string()).optional(),
97
+ currency: z.string(),
98
+ amount: z.number().int(),
99
+ status: CaptureStatus$inboundSchema,
100
+ final: z.boolean(),
101
+ created_at: z.string().datetime({ offset: true }).transform(v =>
102
+ new Date(v)
103
+ ),
104
+ updated_at: z.string().datetime({ offset: true }).transform(v =>
105
+ new Date(v)
106
+ ),
107
+ captured_at: z.nullable(
108
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
109
+ ).optional(),
110
+ external_identifier: z.nullable(z.string()).optional(),
111
+ error_code: z.nullable(z.string()).optional(),
112
+ iso_response_code: z.nullable(z.string()).optional(),
113
+ raw_response_code: z.nullable(z.string()).optional(),
114
+ raw_response_description: z.nullable(z.string()).optional(),
115
+ transaction_external_identifier: z.nullable(z.string()).optional(),
116
+ cart_items: z.nullable(z.array(CartItem$inboundSchema)).optional(),
117
+ }).transform((v) => {
118
+ return remap$(v, {
119
+ "merchant_account_id": "merchantAccountId",
120
+ "transaction_id": "transactionId",
121
+ "created_at": "createdAt",
122
+ "updated_at": "updatedAt",
123
+ "captured_at": "capturedAt",
124
+ "external_identifier": "externalIdentifier",
125
+ "error_code": "errorCode",
126
+ "iso_response_code": "isoResponseCode",
127
+ "raw_response_code": "rawResponseCode",
128
+ "raw_response_description": "rawResponseDescription",
129
+ "transaction_external_identifier": "transactionExternalIdentifier",
130
+ "cart_items": "cartItems",
131
+ });
132
+ });
133
+
134
+ export function captureFromJSON(
135
+ jsonString: string,
136
+ ): SafeParseResult<Capture, SDKValidationError> {
137
+ return safeParse(
138
+ jsonString,
139
+ (x) => Capture$inboundSchema.parse(JSON.parse(x)),
140
+ `Failed to parse 'Capture' from JSON`,
141
+ );
142
+ }
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+ import { Capture, Capture$inboundSchema } from "./capture.js";
11
+
12
+ export type CaptureCollection = {
13
+ /**
14
+ * A list of items returned for this request.
15
+ */
16
+ items: Array<Capture>;
17
+ /**
18
+ * The number of items for this page.
19
+ */
20
+ limit: number;
21
+ /**
22
+ * The cursor pointing at the next page of items.
23
+ */
24
+ nextCursor?: string | null | undefined;
25
+ /**
26
+ * The cursor pointing at the previous page of items.
27
+ */
28
+ previousCursor?: string | null | undefined;
29
+ };
30
+
31
+ /** @internal */
32
+ export const CaptureCollection$inboundSchema: z.ZodType<
33
+ CaptureCollection,
34
+ z.ZodTypeDef,
35
+ unknown
36
+ > = z.object({
37
+ items: z.array(Capture$inboundSchema),
38
+ limit: z.number().int().default(20),
39
+ next_cursor: z.nullable(z.string()).optional(),
40
+ previous_cursor: z.nullable(z.string()).optional(),
41
+ }).transform((v) => {
42
+ return remap$(v, {
43
+ "next_cursor": "nextCursor",
44
+ "previous_cursor": "previousCursor",
45
+ });
46
+ });
47
+
48
+ export function captureCollectionFromJSON(
49
+ jsonString: string,
50
+ ): SafeParseResult<CaptureCollection, SDKValidationError> {
51
+ return safeParse(
52
+ jsonString,
53
+ (x) => CaptureCollection$inboundSchema.parse(JSON.parse(x)),
54
+ `Failed to parse 'CaptureCollection' from JSON`,
55
+ );
56
+ }
@@ -46,6 +46,8 @@ export * from "./buyercreate.js";
46
46
  export * from "./buyers.js";
47
47
  export * from "./buyerupdate.js";
48
48
  export * from "./cancelstatus.js";
49
+ export * from "./capture.js";
50
+ export * from "./capturecollection.js";
49
51
  export * from "./capturestatus.js";
50
52
  export * from "./cardpaymentmethodcreate.js";
51
53
  export * from "./cardscheme.js";
@@ -54,6 +54,7 @@ export const Method = {
54
54
  Gopay: "gopay",
55
55
  Grabpay: "grabpay",
56
56
  Ideal: "ideal",
57
+ Interac: "interac",
57
58
  Kakaopay: "kakaopay",
58
59
  Kcp: "kcp",
59
60
  Khipu: "khipu",
@@ -50,6 +50,7 @@ export const RedirectPaymentMethodCreateMethod = {
50
50
  Gopay: "gopay",
51
51
  Grabpay: "grabpay",
52
52
  Ideal: "ideal",
53
+ Interac: "interac",
53
54
  Kakaopay: "kakaopay",
54
55
  Kcp: "kcp",
55
56
  Khipu: "khipu",
@@ -31,6 +31,14 @@ export type TransactionCaptureCreate = {
31
31
  * An array of cart items that represents the line items of this capture.
32
32
  */
33
33
  cartItems?: Array<CartItem> | null | undefined;
34
+ /**
35
+ * Whether this is marked as the final capture for the associated transaction. Must be `true` or omitted when multi-capture is not enabled; a value of `false` is only valid when multi-capture is available on the connection.
36
+ */
37
+ final?: boolean | undefined;
38
+ /**
39
+ * An external identifier that can be used to match the capture against your own records.
40
+ */
41
+ externalIdentifier?: string | null | undefined;
34
42
  };
35
43
 
36
44
  /** @internal */
@@ -38,6 +46,8 @@ export type TransactionCaptureCreate$Outbound = {
38
46
  amount?: number | null | undefined;
39
47
  airline?: Airline$Outbound | null | undefined;
40
48
  cart_items?: Array<CartItem$Outbound> | null | undefined;
49
+ final: boolean;
50
+ external_identifier?: string | null | undefined;
41
51
  };
42
52
 
43
53
  /** @internal */
@@ -49,9 +59,12 @@ export const TransactionCaptureCreate$outboundSchema: z.ZodType<
49
59
  amount: z.nullable(z.number().int()).optional(),
50
60
  airline: z.nullable(Airline$outboundSchema).optional(),
51
61
  cartItems: z.nullable(z.array(CartItem$outboundSchema)).optional(),
62
+ final: z.boolean().default(true),
63
+ externalIdentifier: z.nullable(z.string()).optional(),
52
64
  }).transform((v) => {
53
65
  return remap$(v, {
54
66
  cartItems: "cart_items",
67
+ externalIdentifier: "external_identifier",
55
68
  });
56
69
  });
57
70
 
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+
8
+ export type GetTransactionCaptureGlobals = {
9
+ merchantAccountId?: string | undefined;
10
+ };
11
+
12
+ export type GetTransactionCaptureRequest = {
13
+ /**
14
+ * The unique identifier of the transaction.
15
+ */
16
+ transactionId: string;
17
+ /**
18
+ * The unique identifier of the capture.
19
+ */
20
+ captureId: string;
21
+ /**
22
+ * The ID of the merchant account to use for this request.
23
+ */
24
+ merchantAccountId?: string | null | undefined;
25
+ };
26
+
27
+ /** @internal */
28
+ export type GetTransactionCaptureRequest$Outbound = {
29
+ transaction_id: string;
30
+ capture_id: string;
31
+ merchantAccountId?: string | null | undefined;
32
+ };
33
+
34
+ /** @internal */
35
+ export const GetTransactionCaptureRequest$outboundSchema: z.ZodType<
36
+ GetTransactionCaptureRequest$Outbound,
37
+ z.ZodTypeDef,
38
+ GetTransactionCaptureRequest
39
+ > = z.object({
40
+ transactionId: z.string(),
41
+ captureId: z.string(),
42
+ merchantAccountId: z.nullable(z.string()).optional(),
43
+ }).transform((v) => {
44
+ return remap$(v, {
45
+ transactionId: "transaction_id",
46
+ captureId: "capture_id",
47
+ });
48
+ });
49
+
50
+ export function getTransactionCaptureRequestToJSON(
51
+ getTransactionCaptureRequest: GetTransactionCaptureRequest,
52
+ ): string {
53
+ return JSON.stringify(
54
+ GetTransactionCaptureRequest$outboundSchema.parse(
55
+ getTransactionCaptureRequest,
56
+ ),
57
+ );
58
+ }
@@ -60,6 +60,7 @@ export * from "./getreport.js";
60
60
  export * from "./getreportexecution.js";
61
61
  export * from "./getthreedsscenario.js";
62
62
  export * from "./gettransaction.js";
63
+ export * from "./gettransactioncapture.js";
63
64
  export * from "./gettransactionrefund.js";
64
65
  export * from "./gettransactionsettlement.js";
65
66
  export * from "./listallreportexecutions.js";
@@ -85,6 +86,7 @@ export * from "./listreportexecutions.js";
85
86
  export * from "./listreports.js";
86
87
  export * from "./listthreedsconfigurations.js";
87
88
  export * from "./listtransactionactions.js";
89
+ export * from "./listtransactioncaptures.js";
88
90
  export * from "./listtransactionevents.js";
89
91
  export * from "./listtransactionrefunds.js";
90
92
  export * from "./listtransactions.js";