@gr4vy/sdk 1.7.1 → 1.9.0

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 (110) hide show
  1. package/examples/package-lock.json +1 -1
  2. package/funcs/transactionsEventsList.d.ts +5 -2
  3. package/funcs/transactionsEventsList.d.ts.map +1 -1
  4. package/funcs/transactionsEventsList.js +30 -7
  5. package/funcs/transactionsEventsList.js.map +1 -1
  6. package/jsr.json +1 -1
  7. package/lib/config.d.ts +3 -3
  8. package/lib/config.js +3 -3
  9. package/lib/encodings.d.ts +1 -0
  10. package/lib/encodings.d.ts.map +1 -1
  11. package/lib/encodings.js +9 -0
  12. package/lib/encodings.js.map +1 -1
  13. package/models/components/accountsreceivablesreportspec.d.ts +1 -1
  14. package/models/components/accountsreceivablesreportspec.d.ts.map +1 -1
  15. package/models/components/accountsreceivablesreportspec.js +1 -1
  16. package/models/components/accountsreceivablesreportspec.js.map +1 -1
  17. package/models/components/accountupdateroptions.d.ts +1 -1
  18. package/models/components/accountupdateroptions.d.ts.map +1 -1
  19. package/models/components/accountupdateroptions.js +1 -1
  20. package/models/components/accountupdateroptions.js.map +1 -1
  21. package/models/components/applepaypaymentmethodcreate.d.ts +1 -1
  22. package/models/components/applepaypaymentmethodcreate.d.ts.map +1 -1
  23. package/models/components/clicktopayfpanpaymentmethodcreate.d.ts +1 -1
  24. package/models/components/clicktopayfpanpaymentmethodcreate.d.ts.map +1 -1
  25. package/models/components/clicktopaypaymentmethodcreate.d.ts +1 -1
  26. package/models/components/clicktopaypaymentmethodcreate.d.ts.map +1 -1
  27. package/models/components/detailedsettlementreportspec.d.ts +1 -1
  28. package/models/components/detailedsettlementreportspec.d.ts.map +1 -1
  29. package/models/components/detailedsettlementreportspec.js +1 -1
  30. package/models/components/detailedsettlementreportspec.js.map +1 -1
  31. package/models/components/googlepayfpanpaymentmethodcreate.d.ts +1 -1
  32. package/models/components/googlepayfpanpaymentmethodcreate.d.ts.map +1 -1
  33. package/models/components/googlepaypaymentmethodcreate.d.ts +1 -1
  34. package/models/components/googlepaypaymentmethodcreate.d.ts.map +1 -1
  35. package/models/components/index.d.ts +0 -1
  36. package/models/components/index.d.ts.map +1 -1
  37. package/models/components/index.js +0 -1
  38. package/models/components/index.js.map +1 -1
  39. package/models/components/networktokenpaymentmethodcreate.d.ts +1 -1
  40. package/models/components/networktokenpaymentmethodcreate.d.ts.map +1 -1
  41. package/models/components/paymentlink.d.ts +8 -0
  42. package/models/components/paymentlink.d.ts.map +1 -1
  43. package/models/components/paymentlink.js +3 -0
  44. package/models/components/paymentlink.js.map +1 -1
  45. package/models/components/paymentlinkcreate.d.ts +10 -0
  46. package/models/components/paymentlinkcreate.d.ts.map +1 -1
  47. package/models/components/paymentlinkcreate.js +3 -0
  48. package/models/components/paymentlinkcreate.js.map +1 -1
  49. package/models/components/reportcreate.d.ts +4 -36
  50. package/models/components/reportcreate.d.ts.map +1 -1
  51. package/models/components/reportcreate.js +8 -8
  52. package/models/components/reportcreate.js.map +1 -1
  53. package/models/components/transactionevent.d.ts +3 -2
  54. package/models/components/transactionevent.d.ts.map +1 -1
  55. package/models/components/transactionevent.js +1 -2
  56. package/models/components/transactionevent.js.map +1 -1
  57. package/models/components/transactionretriesreportspec.d.ts +1 -1
  58. package/models/components/transactionretriesreportspec.d.ts.map +1 -1
  59. package/models/components/transactionretriesreportspec.js +1 -1
  60. package/models/components/transactionretriesreportspec.js.map +1 -1
  61. package/models/components/transactionsreportspec.d.ts +1 -1
  62. package/models/components/transactionsreportspec.d.ts.map +1 -1
  63. package/models/components/transactionsreportspec.js +1 -1
  64. package/models/components/transactionsreportspec.js.map +1 -1
  65. package/models/operations/listbuyerpaymentmethods.d.ts +1 -1
  66. package/models/operations/listbuyerpaymentmethods.d.ts.map +1 -1
  67. package/models/operations/listbuyerpaymentmethods.js +1 -1
  68. package/models/operations/listbuyerpaymentmethods.js.map +1 -1
  69. package/models/operations/listtransactionevents.d.ts +9 -0
  70. package/models/operations/listtransactionevents.d.ts.map +1 -1
  71. package/models/operations/listtransactionevents.js +15 -1
  72. package/models/operations/listtransactionevents.js.map +1 -1
  73. package/package.json +1 -1
  74. package/sdk/events.d.ts +5 -2
  75. package/sdk/events.d.ts.map +1 -1
  76. package/sdk/events.js +2 -2
  77. package/sdk/events.js.map +1 -1
  78. package/src/funcs/transactionsEventsList.ts +127 -53
  79. package/src/lib/config.ts +3 -3
  80. package/src/lib/encodings.ts +13 -0
  81. package/src/models/components/accountsreceivablesreportspec.ts +2 -4
  82. package/src/models/components/accountupdateroptions.ts +2 -2
  83. package/src/models/components/applepaypaymentmethodcreate.ts +1 -1
  84. package/src/models/components/clicktopayfpanpaymentmethodcreate.ts +1 -1
  85. package/src/models/components/clicktopaypaymentmethodcreate.ts +1 -1
  86. package/src/models/components/detailedsettlementreportspec.ts +2 -4
  87. package/src/models/components/googlepayfpanpaymentmethodcreate.ts +1 -1
  88. package/src/models/components/googlepaypaymentmethodcreate.ts +1 -1
  89. package/src/models/components/index.ts +0 -1
  90. package/src/models/components/networktokenpaymentmethodcreate.ts +1 -1
  91. package/src/models/components/paymentlink.ts +11 -0
  92. package/src/models/components/paymentlinkcreate.ts +13 -0
  93. package/src/models/components/reportcreate.ts +24 -42
  94. package/src/models/components/transactionevent.ts +2 -6
  95. package/src/models/components/transactionretriesreportspec.ts +2 -4
  96. package/src/models/components/transactionsreportspec.ts +2 -2
  97. package/src/models/operations/listbuyerpaymentmethods.ts +2 -2
  98. package/src/models/operations/listtransactionevents.ts +31 -0
  99. package/src/sdk/events.ts +6 -4
  100. package/src/types/unrecognized.ts +9 -1
  101. package/tsconfig.json +1 -2
  102. package/types/unrecognized.d.ts +7 -1
  103. package/types/unrecognized.d.ts.map +1 -1
  104. package/types/unrecognized.js +9 -1
  105. package/types/unrecognized.js.map +1 -1
  106. package/models/components/transactioneventcontext.d.ts +0 -14
  107. package/models/components/transactioneventcontext.d.ts.map +0 -1
  108. package/models/components/transactioneventcontext.js +0 -57
  109. package/models/components/transactioneventcontext.js.map +0 -1
  110. package/src/models/components/transactioneventcontext.ts +0 -47
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { Gr4vyCore } from "../core.js";
6
+ import { dlv } from "../lib/dlv.js";
6
7
  import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
@@ -10,7 +11,6 @@ import { safeParse } from "../lib/schemas.js";
10
11
  import { RequestOptions } from "../lib/sdks.js";
11
12
  import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
13
  import { pathToFunc } from "../lib/url.js";
13
- import * as components from "../models/components/index.js";
14
14
  import { Gr4vyError } from "../models/errors/gr4vyerror.js";
15
15
  import {
16
16
  ConnectionError,
@@ -25,6 +25,12 @@ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
25
  import * as operations from "../models/operations/index.js";
26
26
  import { APICall, APIPromise } from "../types/async.js";
27
27
  import { Result } from "../types/fp.js";
28
+ import {
29
+ createPageIterator,
30
+ haltIterator,
31
+ PageIterator,
32
+ Paginator,
33
+ } from "../types/operations.js";
28
34
 
29
35
  /**
30
36
  * List transaction events
@@ -40,51 +46,9 @@ export function transactionsEventsList(
40
46
  merchantAccountId?: string | null | undefined,
41
47
  options?: RequestOptions,
42
48
  ): APIPromise<
43
- Result<
44
- components.TransactionEvents,
45
- | errors.Error400
46
- | errors.Error401
47
- | errors.Error403
48
- | errors.Error404
49
- | errors.Error405
50
- | errors.Error409
51
- | errors.HTTPValidationError
52
- | errors.Error425
53
- | errors.Error429
54
- | errors.Error500
55
- | errors.Error502
56
- | errors.Error504
57
- | Gr4vyError
58
- | ResponseValidationError
59
- | ConnectionError
60
- | RequestAbortedError
61
- | RequestTimeoutError
62
- | InvalidRequestError
63
- | UnexpectedClientError
64
- | SDKValidationError
65
- >
66
- > {
67
- return new APIPromise($do(
68
- client,
69
- transactionId,
70
- cursor,
71
- limit,
72
- merchantAccountId,
73
- options,
74
- ));
75
- }
76
-
77
- async function $do(
78
- client: Gr4vyCore,
79
- transactionId: string,
80
- cursor?: string | null | undefined,
81
- limit?: number | undefined,
82
- merchantAccountId?: string | null | undefined,
83
- options?: RequestOptions,
84
- ): Promise<
85
- [
49
+ PageIterator<
86
50
  Result<
87
- components.TransactionEvents,
51
+ operations.ListTransactionEventsResponse,
88
52
  | errors.Error400
89
53
  | errors.Error401
90
54
  | errors.Error403
@@ -106,6 +70,54 @@ async function $do(
106
70
  | UnexpectedClientError
107
71
  | SDKValidationError
108
72
  >,
73
+ { cursor: string }
74
+ >
75
+ > {
76
+ return new APIPromise($do(
77
+ client,
78
+ transactionId,
79
+ cursor,
80
+ limit,
81
+ merchantAccountId,
82
+ options,
83
+ ));
84
+ }
85
+
86
+ async function $do(
87
+ client: Gr4vyCore,
88
+ transactionId: string,
89
+ cursor?: string | null | undefined,
90
+ limit?: number | undefined,
91
+ merchantAccountId?: string | null | undefined,
92
+ options?: RequestOptions,
93
+ ): Promise<
94
+ [
95
+ PageIterator<
96
+ Result<
97
+ operations.ListTransactionEventsResponse,
98
+ | errors.Error400
99
+ | errors.Error401
100
+ | errors.Error403
101
+ | errors.Error404
102
+ | errors.Error405
103
+ | errors.Error409
104
+ | errors.HTTPValidationError
105
+ | errors.Error425
106
+ | errors.Error429
107
+ | errors.Error500
108
+ | errors.Error502
109
+ | errors.Error504
110
+ | Gr4vyError
111
+ | ResponseValidationError
112
+ | ConnectionError
113
+ | RequestAbortedError
114
+ | RequestTimeoutError
115
+ | InvalidRequestError
116
+ | UnexpectedClientError
117
+ | SDKValidationError
118
+ >,
119
+ { cursor: string }
120
+ >,
109
121
  APICall,
110
122
  ]
111
123
  > {
@@ -123,7 +135,7 @@ async function $do(
123
135
  "Input validation failed",
124
136
  );
125
137
  if (!parsed.ok) {
126
- return [parsed, { status: "invalid" }];
138
+ return [haltIterator(parsed), { status: "invalid" }];
127
139
  }
128
140
  const payload = parsed.value;
129
141
  const body = null;
@@ -192,7 +204,7 @@ async function $do(
192
204
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
193
205
  }, options);
194
206
  if (!requestRes.ok) {
195
- return [requestRes, { status: "invalid" }];
207
+ return [haltIterator(requestRes), { status: "invalid" }];
196
208
  }
197
209
  const req = requestRes.value;
198
210
 
@@ -218,7 +230,7 @@ async function $do(
218
230
  retryCodes: context.retryCodes,
219
231
  });
220
232
  if (!doResult.ok) {
221
- return [doResult, { status: "request-error", request: req }];
233
+ return [haltIterator(doResult), { status: "request-error", request: req }];
222
234
  }
223
235
  const response = doResult.value;
224
236
 
@@ -226,8 +238,8 @@ async function $do(
226
238
  HttpMeta: { Response: response, Request: req },
227
239
  };
228
240
 
229
- const [result] = await M.match<
230
- components.TransactionEvents,
241
+ const [result, raw] = await M.match<
242
+ operations.ListTransactionEventsResponse,
231
243
  | errors.Error400
232
244
  | errors.Error401
233
245
  | errors.Error403
@@ -249,7 +261,9 @@ async function $do(
249
261
  | UnexpectedClientError
250
262
  | SDKValidationError
251
263
  >(
252
- M.json(200, components.TransactionEvents$inboundSchema),
264
+ M.json(200, operations.ListTransactionEventsResponse$inboundSchema, {
265
+ key: "Result",
266
+ }),
253
267
  M.jsonErr(400, errors.Error400$inboundSchema),
254
268
  M.jsonErr(401, errors.Error401$inboundSchema),
255
269
  M.jsonErr(403, errors.Error403$inboundSchema),
@@ -266,8 +280,68 @@ async function $do(
266
280
  M.fail("5XX"),
267
281
  )(response, req, { extraFields: responseFields });
268
282
  if (!result.ok) {
269
- return [result, { status: "complete", request: req, response }];
283
+ return [haltIterator(result), {
284
+ status: "complete",
285
+ request: req,
286
+ response,
287
+ }];
270
288
  }
271
289
 
272
- return [result, { status: "complete", request: req, response }];
290
+ const nextFunc = (
291
+ responseData: unknown,
292
+ ): {
293
+ next: Paginator<
294
+ Result<
295
+ operations.ListTransactionEventsResponse,
296
+ | errors.Error400
297
+ | errors.Error401
298
+ | errors.Error403
299
+ | errors.Error404
300
+ | errors.Error405
301
+ | errors.Error409
302
+ | errors.HTTPValidationError
303
+ | errors.Error425
304
+ | errors.Error429
305
+ | errors.Error500
306
+ | errors.Error502
307
+ | errors.Error504
308
+ | Gr4vyError
309
+ | ResponseValidationError
310
+ | ConnectionError
311
+ | RequestAbortedError
312
+ | RequestTimeoutError
313
+ | InvalidRequestError
314
+ | UnexpectedClientError
315
+ | SDKValidationError
316
+ >
317
+ >;
318
+ "~next"?: { cursor: string };
319
+ } => {
320
+ const nextCursor = dlv(responseData, "next_cursor");
321
+ if (typeof nextCursor !== "string") {
322
+ return { next: () => null };
323
+ }
324
+ if (nextCursor.trim() === "") {
325
+ return { next: () => null };
326
+ }
327
+
328
+ const nextVal = () =>
329
+ transactionsEventsList(
330
+ client,
331
+ transactionId,
332
+ nextCursor,
333
+ limit,
334
+ merchantAccountId,
335
+ options,
336
+ );
337
+
338
+ return { next: nextVal, "~next": { cursor: nextCursor } };
339
+ };
340
+
341
+ const page = { ...result, ...nextFunc(raw) };
342
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
343
+ status: "complete",
344
+ request: req,
345
+ response,
346
+ }];
273
347
  }
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: "1.7.1",
81
- genVersion: "2.763.3",
82
- userAgent: "speakeasy-sdk/typescript 1.7.1 2.763.3 1.0.0 @gr4vy/sdk",
80
+ sdkVersion: "1.9.0",
81
+ genVersion: "2.770.0",
82
+ userAgent: "speakeasy-sdk/typescript 1.9.0 2.770.0 1.0.0 @gr4vy/sdk",
83
83
  } as const;
@@ -427,6 +427,7 @@ export function queryJoin(...args: (string | undefined)[]): string {
427
427
  type QueryEncoderOptions = {
428
428
  explode?: boolean;
429
429
  charEncoding?: "percent" | "none";
430
+ allowEmptyValue?: string[];
430
431
  };
431
432
 
432
433
  type QueryEncoder = (
@@ -451,7 +452,19 @@ export function queryEncoder(f: QueryEncoder): BulkQueryEncoder {
451
452
  charEncoding: options?.charEncoding ?? "percent",
452
453
  };
453
454
 
455
+ const allowEmptySet = new Set(options?.allowEmptyValue ?? []);
456
+
454
457
  const encoded = Object.entries(values).map(([key, value]) => {
458
+ if (allowEmptySet.has(key)) {
459
+ if (
460
+ value === undefined
461
+ || value === null
462
+ || value === ""
463
+ || (Array.isArray(value) && value.length === 0)
464
+ ) {
465
+ return `${encodeURIComponent(key)}=`;
466
+ }
467
+ }
455
468
  return f(key, value, opts);
456
469
  });
457
470
  return queryJoin(...encoded);
@@ -8,7 +8,7 @@ export type AccountsReceivablesReportSpec = {
8
8
  /**
9
9
  * The report model type.
10
10
  */
11
- model?: "accounts_receivables" | undefined;
11
+ model: "accounts_receivables";
12
12
  /**
13
13
  * The parameters for the accounts receivables report model.
14
14
  */
@@ -27,9 +27,7 @@ export const AccountsReceivablesReportSpec$outboundSchema: z.ZodType<
27
27
  z.ZodTypeDef,
28
28
  AccountsReceivablesReportSpec
29
29
  > = z.object({
30
- model: z.literal("accounts_receivables").default(
31
- "accounts_receivables" as const,
32
- ),
30
+ model: z.literal("accounts_receivables"),
33
31
  params: z.record(z.any()),
34
32
  });
35
33
 
@@ -30,7 +30,7 @@ export type AccountUpdaterOptions = {
30
30
 
31
31
  /** @internal */
32
32
  export type AccountUpdaterOptions$Outbound = {
33
- response_code: "updated" | null;
33
+ response_code?: "updated" | null | undefined;
34
34
  account_number?: string | null | undefined;
35
35
  expiration_month?: string | null | undefined;
36
36
  expiration_year?: string | null | undefined;
@@ -43,7 +43,7 @@ export const AccountUpdaterOptions$outboundSchema: z.ZodType<
43
43
  z.ZodTypeDef,
44
44
  AccountUpdaterOptions
45
45
  > = z.object({
46
- responseCode: z.nullable(z.literal("updated")),
46
+ responseCode: z.nullable(z.literal("updated")).optional(),
47
47
  accountNumber: z.nullable(z.string()).optional(),
48
48
  expirationMonth: z.nullable(z.string()).optional(),
49
49
  expirationYear: z.nullable(z.string()).optional(),
@@ -40,7 +40,7 @@ export type ApplePayPaymentMethodCreate = {
40
40
  /**
41
41
  * Always `applepay`
42
42
  */
43
- method?: "applepay" | undefined;
43
+ method: "applepay";
44
44
  /**
45
45
  * The opaque token as received from the Apple Pay JS library. This format may change between JS library versions.
46
46
  */
@@ -36,7 +36,7 @@ export type ClickToPayFPANPaymentMethodCreate = {
36
36
  /**
37
37
  * Aways `click-to-pay`.
38
38
  */
39
- method?: "click-to-pay" | undefined;
39
+ method: "click-to-pay";
40
40
  /**
41
41
  * The URL to redirect a user back to after the complete 3DS in browser.
42
42
  */
@@ -16,7 +16,7 @@ export type ClickToPayPaymentMethodCreate = {
16
16
  /**
17
17
  * Aways `click-to-pay`.
18
18
  */
19
- method?: "click-to-pay" | undefined;
19
+ method: "click-to-pay";
20
20
  /**
21
21
  * The device token.
22
22
  */
@@ -8,7 +8,7 @@ export type DetailedSettlementReportSpec = {
8
8
  /**
9
9
  * The report model type.
10
10
  */
11
- model?: "detailed_settlement" | undefined;
11
+ model: "detailed_settlement";
12
12
  /**
13
13
  * The parameters for the detailed settlement report model.
14
14
  */
@@ -27,9 +27,7 @@ export const DetailedSettlementReportSpec$outboundSchema: z.ZodType<
27
27
  z.ZodTypeDef,
28
28
  DetailedSettlementReportSpec
29
29
  > = z.object({
30
- model: z.literal("detailed_settlement").default(
31
- "detailed_settlement" as const,
32
- ),
30
+ model: z.literal("detailed_settlement"),
33
31
  params: z.record(z.any()),
34
32
  });
35
33
 
@@ -36,7 +36,7 @@ export type GooglePayFPANPaymentMethodCreate = {
36
36
  /**
37
37
  * Aways `googlepay_pan_only`.
38
38
  */
39
- method?: "googlepay_pan_only" | undefined;
39
+ method: "googlepay_pan_only";
40
40
  /**
41
41
  * The URL to redirect a user back to after the complete 3DS in browser.
42
42
  */
@@ -50,7 +50,7 @@ export type GooglePayPaymentMethodCreate = {
50
50
  /**
51
51
  * Always `googlepay`
52
52
  */
53
- method?: "googlepay" | undefined;
53
+ method: "googlepay";
54
54
  /**
55
55
  * The opaque token as received from the Google Pay JS library. This format may change between JS library versions.
56
56
  */
@@ -237,7 +237,6 @@ export * from "./transactioncapturecreate.js";
237
237
  export * from "./transactionconnectionoptions.js";
238
238
  export * from "./transactioncreate.js";
239
239
  export * from "./transactionevent.js";
240
- export * from "./transactioneventcontext.js";
241
240
  export * from "./transactionevents.js";
242
241
  export * from "./transactiongiftcard.js";
243
242
  export * from "./transactionintent.js";
@@ -18,7 +18,7 @@ export type NetworkTokenPaymentMethodCreate = {
18
18
  /**
19
19
  * Always `network-token`.
20
20
  */
21
- method?: "network-token" | undefined;
21
+ method: "network-token";
22
22
  /**
23
23
  * The scheme token.
24
24
  */
@@ -140,6 +140,14 @@ export type PaymentLink = {
140
140
  * The connection options for the payment link.
141
141
  */
142
142
  connectionOptions?: { [k: string]: { [k: string]: any } } | null | undefined;
143
+ /**
144
+ * Whether the payment method was stored.
145
+ */
146
+ store?: boolean | undefined;
147
+ /**
148
+ * The ID of the buyer to associate with the stored payment method.
149
+ */
150
+ buyerId?: string | null | undefined;
143
151
  };
144
152
 
145
153
  /** @internal */
@@ -179,6 +187,8 @@ export const PaymentLink$inboundSchema: z.ZodType<
179
187
  buyer: z.nullable(TransactionBuyer$inboundSchema).optional(),
180
188
  shipping_details: z.nullable(ShippingDetails$inboundSchema).optional(),
181
189
  connection_options: z.nullable(z.record(z.record(z.any()))).optional(),
190
+ store: z.boolean().default(false),
191
+ buyer_id: z.nullable(z.string()).optional(),
182
192
  }).transform((v) => {
183
193
  return remap$(v, {
184
194
  "expires_at": "expiresAt",
@@ -198,6 +208,7 @@ export const PaymentLink$inboundSchema: z.ZodType<
198
208
  "updated_at": "updatedAt",
199
209
  "shipping_details": "shippingDetails",
200
210
  "connection_options": "connectionOptions",
211
+ "buyer_id": "buyerId",
201
212
  });
202
213
  });
203
214
 
@@ -115,6 +115,14 @@ export type PaymentLinkCreate = {
115
115
  * The way payment method information made it to this transaction.
116
116
  */
117
117
  paymentSource?: TransactionPaymentSource | undefined;
118
+ /**
119
+ * Whether to store the payment method for future use.
120
+ */
121
+ store?: boolean | undefined;
122
+ /**
123
+ * The ID of the buyer to associate the payment method with. Note: When `buyer_id` is provided, the payment link should be treated as a secret as it will allow the user to manage payment methods for the associated buyer.
124
+ */
125
+ buyerId?: string | null | undefined;
118
126
  };
119
127
 
120
128
  /** @internal */
@@ -140,6 +148,8 @@ export type PaymentLinkCreate$Outbound = {
140
148
  cart_items?: Array<CartItem$Outbound> | null | undefined;
141
149
  metadata?: { [k: string]: any } | null | undefined;
142
150
  payment_source?: string | undefined;
151
+ store: boolean;
152
+ buyer_id?: string | null | undefined;
143
153
  };
144
154
 
145
155
  /** @internal */
@@ -171,6 +181,8 @@ export const PaymentLinkCreate$outboundSchema: z.ZodType<
171
181
  cartItems: z.nullable(z.array(CartItem$outboundSchema)).optional(),
172
182
  metadata: z.nullable(z.record(z.any())).optional(),
173
183
  paymentSource: TransactionPaymentSource$outboundSchema.optional(),
184
+ store: z.boolean().default(false),
185
+ buyerId: z.nullable(z.string()).optional(),
174
186
  }).transform((v) => {
175
187
  return remap$(v, {
176
188
  expiresAt: "expires_at",
@@ -187,6 +199,7 @@ export const PaymentLinkCreate$outboundSchema: z.ZodType<
187
199
  returnUrl: "return_url",
188
200
  cartItems: "cart_items",
189
201
  paymentSource: "payment_source",
202
+ buyerId: "buyer_id",
190
203
  });
191
204
  });
192
205
 
@@ -33,10 +33,10 @@ import {
33
33
  * The report specification.
34
34
  */
35
35
  export type Spec =
36
- | (AccountsReceivablesReportSpec & { model: "accounts_receivables" })
37
- | (DetailedSettlementReportSpec & { model: "detailed_settlement" })
38
- | (TransactionRetriesReportSpec & { model: "transaction_retries" })
39
- | (TransactionsReportSpec & { model: "transactions" });
36
+ | AccountsReceivablesReportSpec
37
+ | DetailedSettlementReportSpec
38
+ | TransactionRetriesReportSpec
39
+ | TransactionsReportSpec;
40
40
 
41
41
  export type ReportCreate = {
42
42
  /**
@@ -60,34 +60,26 @@ export type ReportCreate = {
60
60
  * The report specification.
61
61
  */
62
62
  spec:
63
- | (AccountsReceivablesReportSpec & { model: "accounts_receivables" })
64
- | (DetailedSettlementReportSpec & { model: "detailed_settlement" })
65
- | (TransactionRetriesReportSpec & { model: "transaction_retries" })
66
- | (TransactionsReportSpec & { model: "transactions" });
63
+ | AccountsReceivablesReportSpec
64
+ | DetailedSettlementReportSpec
65
+ | TransactionRetriesReportSpec
66
+ | TransactionsReportSpec;
67
67
  };
68
68
 
69
69
  /** @internal */
70
70
  export type Spec$Outbound =
71
- | (AccountsReceivablesReportSpec$Outbound & { model: "accounts_receivables" })
72
- | (DetailedSettlementReportSpec$Outbound & { model: "detailed_settlement" })
73
- | (TransactionRetriesReportSpec$Outbound & { model: "transaction_retries" })
74
- | (TransactionsReportSpec$Outbound & { model: "transactions" });
71
+ | AccountsReceivablesReportSpec$Outbound
72
+ | DetailedSettlementReportSpec$Outbound
73
+ | TransactionRetriesReportSpec$Outbound
74
+ | TransactionsReportSpec$Outbound;
75
75
 
76
76
  /** @internal */
77
77
  export const Spec$outboundSchema: z.ZodType<Spec$Outbound, z.ZodTypeDef, Spec> =
78
78
  z.union([
79
- AccountsReceivablesReportSpec$outboundSchema.and(
80
- z.object({ model: z.literal("accounts_receivables") }),
81
- ),
82
- DetailedSettlementReportSpec$outboundSchema.and(
83
- z.object({ model: z.literal("detailed_settlement") }),
84
- ),
85
- TransactionRetriesReportSpec$outboundSchema.and(
86
- z.object({ model: z.literal("transaction_retries") }),
87
- ),
88
- TransactionsReportSpec$outboundSchema.and(
89
- z.object({ model: z.literal("transactions") }),
90
- ),
79
+ AccountsReceivablesReportSpec$outboundSchema,
80
+ DetailedSettlementReportSpec$outboundSchema,
81
+ TransactionRetriesReportSpec$outboundSchema,
82
+ TransactionsReportSpec$outboundSchema,
91
83
  ]);
92
84
 
93
85
  export function specToJSON(spec: Spec): string {
@@ -102,12 +94,10 @@ export type ReportCreate$Outbound = {
102
94
  schedule_enabled: boolean;
103
95
  schedule_timezone: string;
104
96
  spec:
105
- | (AccountsReceivablesReportSpec$Outbound & {
106
- model: "accounts_receivables";
107
- })
108
- | (DetailedSettlementReportSpec$Outbound & { model: "detailed_settlement" })
109
- | (TransactionRetriesReportSpec$Outbound & { model: "transaction_retries" })
110
- | (TransactionsReportSpec$Outbound & { model: "transactions" });
97
+ | AccountsReceivablesReportSpec$Outbound
98
+ | DetailedSettlementReportSpec$Outbound
99
+ | TransactionRetriesReportSpec$Outbound
100
+ | TransactionsReportSpec$Outbound;
111
101
  };
112
102
 
113
103
  /** @internal */
@@ -122,18 +112,10 @@ export const ReportCreate$outboundSchema: z.ZodType<
122
112
  scheduleEnabled: z.boolean(),
123
113
  scheduleTimezone: z.string().default("Etc/UTC"),
124
114
  spec: z.union([
125
- AccountsReceivablesReportSpec$outboundSchema.and(
126
- z.object({ model: z.literal("accounts_receivables") }),
127
- ),
128
- DetailedSettlementReportSpec$outboundSchema.and(
129
- z.object({ model: z.literal("detailed_settlement") }),
130
- ),
131
- TransactionRetriesReportSpec$outboundSchema.and(
132
- z.object({ model: z.literal("transaction_retries") }),
133
- ),
134
- TransactionsReportSpec$outboundSchema.and(
135
- z.object({ model: z.literal("transactions") }),
136
- ),
115
+ AccountsReceivablesReportSpec$outboundSchema,
116
+ DetailedSettlementReportSpec$outboundSchema,
117
+ TransactionRetriesReportSpec$outboundSchema,
118
+ TransactionsReportSpec$outboundSchema,
137
119
  ]),
138
120
  }).transform((v) => {
139
121
  return remap$(v, {
@@ -9,10 +9,6 @@ import * as openEnums from "../../types/enums.js";
9
9
  import { OpenEnum } from "../../types/enums.js";
10
10
  import { Result as SafeParseResult } from "../../types/fp.js";
11
11
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
- import {
13
- TransactionEventContext,
14
- TransactionEventContext$inboundSchema,
15
- } from "./transactioneventcontext.js";
16
12
 
17
13
  /**
18
14
  * The specific event name.
@@ -115,7 +111,7 @@ export type TransactionEvent = {
115
111
  * The date this event was created at.
116
112
  */
117
113
  createdAt: Date;
118
- context: TransactionEventContext;
114
+ context: { [k: string]: any };
119
115
  };
120
116
 
121
117
  /** @internal */
@@ -132,7 +128,7 @@ export const TransactionEvent$inboundSchema: z.ZodType<
132
128
  id: z.string(),
133
129
  name: Name$inboundSchema,
134
130
  created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
135
- context: TransactionEventContext$inboundSchema,
131
+ context: z.record(z.any()),
136
132
  }).transform((v) => {
137
133
  return remap$(v, {
138
134
  "created_at": "createdAt",
@@ -8,7 +8,7 @@ export type TransactionRetriesReportSpec = {
8
8
  /**
9
9
  * The report model type.
10
10
  */
11
- model?: "transaction_retries" | undefined;
11
+ model: "transaction_retries";
12
12
  /**
13
13
  * The parameters for the transaction retries report model.
14
14
  */
@@ -27,9 +27,7 @@ export const TransactionRetriesReportSpec$outboundSchema: z.ZodType<
27
27
  z.ZodTypeDef,
28
28
  TransactionRetriesReportSpec
29
29
  > = z.object({
30
- model: z.literal("transaction_retries").default(
31
- "transaction_retries" as const,
32
- ),
30
+ model: z.literal("transaction_retries"),
33
31
  params: z.record(z.any()),
34
32
  });
35
33
 
@@ -8,7 +8,7 @@ export type TransactionsReportSpec = {
8
8
  /**
9
9
  * The report model type.
10
10
  */
11
- model?: "transactions" | undefined;
11
+ model: "transactions";
12
12
  /**
13
13
  * The parameters for the transactions report model.
14
14
  */
@@ -27,7 +27,7 @@ export const TransactionsReportSpec$outboundSchema: z.ZodType<
27
27
  z.ZodTypeDef,
28
28
  TransactionsReportSpec
29
29
  > = z.object({
30
- model: z.literal("transactions").default("transactions" as const),
30
+ model: z.literal("transactions"),
31
31
  params: z.record(z.any()),
32
32
  });
33
33