@gr4vy/sdk 1.1.41 → 1.1.43

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 (67) hide show
  1. package/examples/accountUpdaterJobsCreate.example.ts +1 -1
  2. package/examples/package-lock.json +1 -1
  3. package/funcs/auditLogsList.js +3 -0
  4. package/funcs/auditLogsList.js.map +1 -1
  5. package/funcs/buyersList.js +3 -0
  6. package/funcs/buyersList.js.map +1 -1
  7. package/funcs/giftCardsList.js +3 -0
  8. package/funcs/giftCardsList.js.map +1 -1
  9. package/funcs/merchantAccountsList.js +3 -0
  10. package/funcs/merchantAccountsList.js.map +1 -1
  11. package/funcs/paymentLinksList.js +3 -0
  12. package/funcs/paymentLinksList.js.map +1 -1
  13. package/funcs/paymentMethodsList.js +3 -0
  14. package/funcs/paymentMethodsList.js.map +1 -1
  15. package/funcs/paymentServiceDefinitionsList.js +3 -0
  16. package/funcs/paymentServiceDefinitionsList.js.map +1 -1
  17. package/funcs/paymentServicesList.js +3 -0
  18. package/funcs/paymentServicesList.js.map +1 -1
  19. package/funcs/payoutsList.js +3 -0
  20. package/funcs/payoutsList.js.map +1 -1
  21. package/funcs/reportExecutionsList.js +3 -0
  22. package/funcs/reportExecutionsList.js.map +1 -1
  23. package/funcs/reportsExecutionsList.js +3 -0
  24. package/funcs/reportsExecutionsList.js.map +1 -1
  25. package/funcs/reportsList.js +3 -0
  26. package/funcs/reportsList.js.map +1 -1
  27. package/funcs/transactionsList.js +4 -0
  28. package/funcs/transactionsList.js.map +1 -1
  29. package/jsr.json +1 -1
  30. package/lib/config.d.ts +3 -3
  31. package/lib/config.js +3 -3
  32. package/models/components/auditlogaction.d.ts +1 -0
  33. package/models/components/auditlogaction.d.ts.map +1 -1
  34. package/models/components/auditlogaction.js +1 -0
  35. package/models/components/auditlogaction.js.map +1 -1
  36. package/models/components/transaction.d.ts +5 -0
  37. package/models/components/transaction.d.ts.map +1 -1
  38. package/models/components/transaction.js +2 -0
  39. package/models/components/transaction.js.map +1 -1
  40. package/models/components/transactionsummary.d.ts +5 -0
  41. package/models/components/transactionsummary.d.ts.map +1 -1
  42. package/models/components/transactionsummary.js +2 -0
  43. package/models/components/transactionsummary.js.map +1 -1
  44. package/models/operations/listtransactions.d.ts +5 -0
  45. package/models/operations/listtransactions.d.ts.map +1 -1
  46. package/models/operations/listtransactions.js +2 -0
  47. package/models/operations/listtransactions.js.map +1 -1
  48. package/package.json +1 -1
  49. package/src/funcs/auditLogsList.ts +3 -0
  50. package/src/funcs/buyersList.ts +3 -0
  51. package/src/funcs/giftCardsList.ts +3 -0
  52. package/src/funcs/merchantAccountsList.ts +3 -0
  53. package/src/funcs/paymentLinksList.ts +3 -0
  54. package/src/funcs/paymentMethodsList.ts +3 -0
  55. package/src/funcs/paymentServiceDefinitionsList.ts +3 -0
  56. package/src/funcs/paymentServicesList.ts +3 -0
  57. package/src/funcs/payoutsList.ts +3 -0
  58. package/src/funcs/reportExecutionsList.ts +3 -0
  59. package/src/funcs/reportsExecutionsList.ts +3 -0
  60. package/src/funcs/reportsList.ts +3 -0
  61. package/src/funcs/transactionsList.ts +4 -0
  62. package/src/lib/config.ts +3 -3
  63. package/src/models/components/auditlogaction.ts +1 -0
  64. package/src/models/components/transaction.ts +7 -0
  65. package/src/models/components/transactionsummary.ts +7 -0
  66. package/src/models/operations/listtransactions.ts +7 -0
  67. package/tests/utils/setup.ts +37 -0
@@ -186,6 +186,10 @@ export type TransactionSummary = {
186
186
  * The date and time when the transaction was last updated, in ISO 8601 format.
187
187
  */
188
188
  updatedAt: Date;
189
+ /**
190
+ * Indicates whether this transaction has been disputed.
191
+ */
192
+ disputed: boolean;
189
193
  };
190
194
 
191
195
  /** @internal */
@@ -226,6 +230,7 @@ export const TransactionSummary$inboundSchema: z.ZodType<
226
230
  gift_card_service: z.nullable(GiftCardService$inboundSchema).optional(),
227
231
  created_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
228
232
  updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v)),
233
+ disputed: z.boolean(),
229
234
  }).transform((v) => {
230
235
  return remap$(v, {
231
236
  "reconciliation_id": "reconciliationId",
@@ -285,6 +290,7 @@ export type TransactionSummary$Outbound = {
285
290
  gift_card_service?: GiftCardService$Outbound | null | undefined;
286
291
  created_at: string;
287
292
  updated_at: string;
293
+ disputed: boolean;
288
294
  };
289
295
 
290
296
  /** @internal */
@@ -325,6 +331,7 @@ export const TransactionSummary$outboundSchema: z.ZodType<
325
331
  giftCardService: z.nullable(GiftCardService$outboundSchema).optional(),
326
332
  createdAt: z.date().transform(v => v.toISOString()),
327
333
  updatedAt: z.date().transform(v => v.toISOString()),
334
+ disputed: z.boolean(),
328
335
  }).transform((v) => {
329
336
  return remap$(v, {
330
337
  reconciliationId: "reconciliation_id",
@@ -149,6 +149,10 @@ export type ListTransactionsRequest = {
149
149
  * Filters for transactions that attempted 3DS authentication or not.
150
150
  */
151
151
  used3ds?: boolean | null | undefined;
152
+ /**
153
+ * Filters for transactions that have been disputed.
154
+ */
155
+ disputed?: boolean | null | undefined;
152
156
  /**
153
157
  * Filters the results to only get the items for which some of the buyer data contains exactly the provided `buyer_search` values.
154
158
  */
@@ -276,6 +280,7 @@ export const ListTransactionsRequest$inboundSchema: z.ZodType<
276
280
  is_subsequent_payment: z.nullable(z.boolean()).optional(),
277
281
  merchant_initiated: z.nullable(z.boolean()).optional(),
278
282
  used_3ds: z.nullable(z.boolean()).optional(),
283
+ disputed: z.nullable(z.boolean()).optional(),
279
284
  buyer_search: z.nullable(z.array(z.string())).optional(),
280
285
  merchantAccountId: z.nullable(z.string()).optional(),
281
286
  }).transform((v) => {
@@ -361,6 +366,7 @@ export type ListTransactionsRequest$Outbound = {
361
366
  is_subsequent_payment?: boolean | null | undefined;
362
367
  merchant_initiated?: boolean | null | undefined;
363
368
  used_3ds?: boolean | null | undefined;
369
+ disputed?: boolean | null | undefined;
364
370
  buyer_search?: Array<string> | null | undefined;
365
371
  merchantAccountId?: string | null | undefined;
366
372
  };
@@ -416,6 +422,7 @@ export const ListTransactionsRequest$outboundSchema: z.ZodType<
416
422
  isSubsequentPayment: z.nullable(z.boolean()).optional(),
417
423
  merchantInitiated: z.nullable(z.boolean()).optional(),
418
424
  used3ds: z.nullable(z.boolean()).optional(),
425
+ disputed: z.nullable(z.boolean()).optional(),
419
426
  buyerSearch: z.nullable(z.array(z.string())).optional(),
420
427
  merchantAccountId: z.nullable(z.string()).optional(),
421
428
  }).transform((v) => {
@@ -2,6 +2,7 @@ import crypto from "crypto";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
4
  import { Gr4vy, withToken } from "../../src";
5
+ import { HTTPClient } from "../../src/lib/http";
5
6
 
6
7
  const loadPrivateKey = (): string => {
7
8
  let privateKey = process.env.PRIVATE_KEY;
@@ -14,11 +15,47 @@ const loadPrivateKey = (): string => {
14
15
  return privateKey;
15
16
  };
16
17
 
18
+ const httpClient = new HTTPClient({
19
+ /**
20
+ * Adds a custom HTTP client that inserts random fields in the response,
21
+ * ensuring we test for forward compatibility.
22
+ */
23
+ fetcher: async (request) => {
24
+ const originalResponse = await fetch(request);
25
+ const contentType = originalResponse.headers.get("content-type");
26
+ if (!contentType || !contentType.includes("application/json")) {
27
+ return originalResponse;
28
+ }
29
+
30
+ try {
31
+ const data = await originalResponse.clone().json();
32
+ const randomKey = `unexpected_field_${Math.floor(Math.random() * 1000)}`;
33
+ data[randomKey] = "this is an injected test value";
34
+
35
+ const modifiedBody = new Blob([JSON.stringify(data, null, 2)], {
36
+ type: 'application/json',
37
+ });
38
+
39
+ const modifiedResponse = new Response(modifiedBody, {
40
+ status: originalResponse.status,
41
+ statusText: originalResponse.statusText,
42
+ headers: originalResponse.headers,
43
+ });
44
+
45
+ return modifiedResponse;
46
+ } catch (error) {
47
+ console.error("Failed to parse JSON, returning original response:", error);
48
+ return originalResponse;
49
+ }
50
+ },
51
+ });
52
+
17
53
  const createGr4vyClient = (
18
54
  privateKey: string,
19
55
  merchantAccountId?: string
20
56
  ): Gr4vy => {
21
57
  return new Gr4vy({
58
+ httpClient: httpClient,
22
59
  server: "sandbox",
23
60
  id: "e2e",
24
61
  merchantAccountId,