@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.
- package/examples/accountUpdaterJobsCreate.example.ts +1 -1
- package/examples/package-lock.json +1 -1
- package/funcs/auditLogsList.js +3 -0
- package/funcs/auditLogsList.js.map +1 -1
- package/funcs/buyersList.js +3 -0
- package/funcs/buyersList.js.map +1 -1
- package/funcs/giftCardsList.js +3 -0
- package/funcs/giftCardsList.js.map +1 -1
- package/funcs/merchantAccountsList.js +3 -0
- package/funcs/merchantAccountsList.js.map +1 -1
- package/funcs/paymentLinksList.js +3 -0
- package/funcs/paymentLinksList.js.map +1 -1
- package/funcs/paymentMethodsList.js +3 -0
- package/funcs/paymentMethodsList.js.map +1 -1
- package/funcs/paymentServiceDefinitionsList.js +3 -0
- package/funcs/paymentServiceDefinitionsList.js.map +1 -1
- package/funcs/paymentServicesList.js +3 -0
- package/funcs/paymentServicesList.js.map +1 -1
- package/funcs/payoutsList.js +3 -0
- package/funcs/payoutsList.js.map +1 -1
- package/funcs/reportExecutionsList.js +3 -0
- package/funcs/reportExecutionsList.js.map +1 -1
- package/funcs/reportsExecutionsList.js +3 -0
- package/funcs/reportsExecutionsList.js.map +1 -1
- package/funcs/reportsList.js +3 -0
- package/funcs/reportsList.js.map +1 -1
- package/funcs/transactionsList.js +4 -0
- package/funcs/transactionsList.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/models/components/auditlogaction.d.ts +1 -0
- package/models/components/auditlogaction.d.ts.map +1 -1
- package/models/components/auditlogaction.js +1 -0
- package/models/components/auditlogaction.js.map +1 -1
- package/models/components/transaction.d.ts +5 -0
- package/models/components/transaction.d.ts.map +1 -1
- package/models/components/transaction.js +2 -0
- package/models/components/transaction.js.map +1 -1
- package/models/components/transactionsummary.d.ts +5 -0
- package/models/components/transactionsummary.d.ts.map +1 -1
- package/models/components/transactionsummary.js +2 -0
- package/models/components/transactionsummary.js.map +1 -1
- package/models/operations/listtransactions.d.ts +5 -0
- package/models/operations/listtransactions.d.ts.map +1 -1
- package/models/operations/listtransactions.js +2 -0
- package/models/operations/listtransactions.js.map +1 -1
- package/package.json +1 -1
- package/src/funcs/auditLogsList.ts +3 -0
- package/src/funcs/buyersList.ts +3 -0
- package/src/funcs/giftCardsList.ts +3 -0
- package/src/funcs/merchantAccountsList.ts +3 -0
- package/src/funcs/paymentLinksList.ts +3 -0
- package/src/funcs/paymentMethodsList.ts +3 -0
- package/src/funcs/paymentServiceDefinitionsList.ts +3 -0
- package/src/funcs/paymentServicesList.ts +3 -0
- package/src/funcs/payoutsList.ts +3 -0
- package/src/funcs/reportExecutionsList.ts +3 -0
- package/src/funcs/reportsExecutionsList.ts +3 -0
- package/src/funcs/reportsList.ts +3 -0
- package/src/funcs/transactionsList.ts +4 -0
- package/src/lib/config.ts +3 -3
- package/src/models/components/auditlogaction.ts +1 -0
- package/src/models/components/transaction.ts +7 -0
- package/src/models/components/transactionsummary.ts +7 -0
- package/src/models/operations/listtransactions.ts +7 -0
- 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) => {
|
package/tests/utils/setup.ts
CHANGED
|
@@ -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,
|