@gr4vy/sdk 2.4.6 → 2.4.8

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/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@gr4vy/sdk",
5
- "version": "2.4.6",
5
+ "version": "2.4.8",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/lib/auth.d.ts CHANGED
@@ -64,12 +64,16 @@ export declare enum JWTScope {
64
64
  AntiFraudServiceDefinitionsWrite = "anti-fraud-service-definitions.write",
65
65
  AntiFraudServicesRead = "anti-fraud-services.read",
66
66
  AntiFraudServicesWrite = "anti-fraud-services.write",
67
+ ApiKeyPairsRead = "api-key-pairs.read",
68
+ ApiKeyPairsWrite = "api-key-pairs.write",
67
69
  ApiLogsRead = "api-logs.read",
68
70
  ApiLogsWrite = "api-logs.write",
69
71
  ApplePayCertificatesRead = "apple-pay-certificates.read",
70
72
  ApplePayCertificatesWrite = "apple-pay-certificates.write",
71
73
  AuditLogsRead = "audit-logs.read",
72
74
  AuditLogsWrite = "audit-logs.write",
75
+ BinCheckerRead = "bin-checker.read",
76
+ BinCheckerWrite = "bin-checker.write",
73
77
  BuyersRead = "buyers.read",
74
78
  BuyersWrite = "buyers.write",
75
79
  BuyersBillingDetailsRead = "buyers.billing-details.read",
@@ -110,6 +114,8 @@ export declare enum JWTScope {
110
114
  ReportsWrite = "reports.write",
111
115
  RolesRead = "roles.read",
112
116
  RolesWrite = "roles.write",
117
+ ThreeDSScenariosRead = "three-ds-scenarios.read",
118
+ ThreeDSScenariosWrite = "three-ds-scenarios.write",
113
119
  TransactionsRead = "transactions.read",
114
120
  TransactionsWrite = "transactions.write",
115
121
  UsersMeRead = "users.me.read",
package/lib/auth.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/lib/auth.ts"],"names":[],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3C,mBAAmB,0BAA0B;IAC7C,6BAA6B,qCAAqC;IAClE,8BAA8B,sCAAsC;IACpE,mBAAmB,0BAA0B;IAC7C,oBAAoB,2BAA2B;IAC/C,WAAW,iBAAiB;IAC5B,YAAY,kBAAkB;IAC9B,WAAW,iBAAiB;IAC5B,YAAY,kBAAkB;IAC9B,SAAS,eAAe;IACxB,UAAU,gBAAgB;IAC1B,oBAAoB,4BAA4B;IAChD,qBAAqB,6BAA6B;IAClD,gBAAgB,sBAAsB;IACtC,iBAAiB,uBAAuB;IACxC,WAAW,kBAAkB;IAC7B,YAAY,mBAAmB;IAC/B,gBAAgB,uBAAuB;IACvC,iBAAiB,wBAAwB;IACzC,+BAA+B,uCAAuC;IACtE,gCAAgC,wCAAwC;IACxE,uBAAuB,+BAA+B;IACtD,wBAAwB,gCAAgC;IACxD,2BAA2B,mCAAmC;IAC9D,4BAA4B,oCAAoC;IAChE,wBAAwB,+BAA+B;IACvD,yBAAyB,gCAAgC;CAC1D;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,SAAS,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACzC,CAAC"}
package/lib/auth.js CHANGED
@@ -105,12 +105,16 @@ var JWTScope;
105
105
  JWTScope["AntiFraudServiceDefinitionsWrite"] = "anti-fraud-service-definitions.write";
106
106
  JWTScope["AntiFraudServicesRead"] = "anti-fraud-services.read";
107
107
  JWTScope["AntiFraudServicesWrite"] = "anti-fraud-services.write";
108
+ JWTScope["ApiKeyPairsRead"] = "api-key-pairs.read";
109
+ JWTScope["ApiKeyPairsWrite"] = "api-key-pairs.write";
108
110
  JWTScope["ApiLogsRead"] = "api-logs.read";
109
111
  JWTScope["ApiLogsWrite"] = "api-logs.write";
110
112
  JWTScope["ApplePayCertificatesRead"] = "apple-pay-certificates.read";
111
113
  JWTScope["ApplePayCertificatesWrite"] = "apple-pay-certificates.write";
112
114
  JWTScope["AuditLogsRead"] = "audit-logs.read";
113
115
  JWTScope["AuditLogsWrite"] = "audit-logs.write";
116
+ JWTScope["BinCheckerRead"] = "bin-checker.read";
117
+ JWTScope["BinCheckerWrite"] = "bin-checker.write";
114
118
  JWTScope["BuyersRead"] = "buyers.read";
115
119
  JWTScope["BuyersWrite"] = "buyers.write";
116
120
  JWTScope["BuyersBillingDetailsRead"] = "buyers.billing-details.read";
@@ -151,6 +155,8 @@ var JWTScope;
151
155
  JWTScope["ReportsWrite"] = "reports.write";
152
156
  JWTScope["RolesRead"] = "roles.read";
153
157
  JWTScope["RolesWrite"] = "roles.write";
158
+ JWTScope["ThreeDSScenariosRead"] = "three-ds-scenarios.read";
159
+ JWTScope["ThreeDSScenariosWrite"] = "three-ds-scenarios.write";
154
160
  JWTScope["TransactionsRead"] = "transactions.read";
155
161
  JWTScope["TransactionsWrite"] = "transactions.write";
156
162
  JWTScope["UsersMeRead"] = "users.me.read";
package/lib/auth.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/lib/auth.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAyC;AACzC,gEAA+C;AAE/C,oEAA2C;AAG3C,qCAAwC;AACxC,uCAAqC;AAIrC;;GAEG;AACI,MAAM,SAAS,GAAG,CAAC,OAIzB,EAA2B,EAAE;IAC5B,MAAM,EACJ,UAAU,EACV,MAAM,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,EAC9C,SAAS,GAAG,KAAK,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AA8B,CAAA;IAC9B,wCAA4B,CAAA;IAC5B,0CAA8B,CAAA;IAC9B,oCAAwB,CAAA;IACxB,sCAA0B,CAAA;IAC1B,4DAAgD,CAAA;IAChD,8DAAkD,CAAA;IAClD,kDAAsC,CAAA;IACtC,oDAAwC,CAAA;IACxC,yCAA6B,CAAA;IAC7B,2CAA+B,CAAA;IAC/B,mDAAuC,CAAA;IACvC,qDAAyC,CAAA;IACzC,kFAAsE,CAAA;IACtE,oFAAwE,CAAA;IACxE,kEAAsD,CAAA;IACtD,oEAAwD,CAAA;IACxD,0EAA8D,CAAA;IAC9D,4EAAgE,CAAA;IAChE,mEAAuD,CAAA;IACvD,qEAAyD,CAAA;AAC3D,CAAC,EA1EW,QAAQ,wBAAR,QAAQ,QA0EnB"}
package/lib/config.d.ts CHANGED
@@ -44,8 +44,8 @@ export declare function serverURLFromOptions(options: SDKOptions): URL | null;
44
44
  export declare const SDK_METADATA: {
45
45
  readonly language: "typescript";
46
46
  readonly openapiDocVersion: "1.0.0";
47
- readonly sdkVersion: "2.4.6";
48
- readonly genVersion: "2.927.0";
49
- readonly userAgent: "speakeasy-sdk/typescript 2.4.6 2.927.0 1.0.0 @gr4vy/sdk";
47
+ readonly sdkVersion: "2.4.8";
48
+ readonly genVersion: "2.928.0";
49
+ readonly userAgent: "speakeasy-sdk/typescript 2.4.8 2.928.0 1.0.0 @gr4vy/sdk";
50
50
  };
51
51
  //# sourceMappingURL=config.d.ts.map
package/lib/config.js CHANGED
@@ -37,8 +37,8 @@ function serverURLFromOptions(options) {
37
37
  exports.SDK_METADATA = {
38
38
  language: "typescript",
39
39
  openapiDocVersion: "1.0.0",
40
- sdkVersion: "2.4.6",
41
- genVersion: "2.927.0",
42
- userAgent: "speakeasy-sdk/typescript 2.4.6 2.927.0 1.0.0 @gr4vy/sdk",
40
+ sdkVersion: "2.4.8",
41
+ genVersion: "2.928.0",
42
+ userAgent: "speakeasy-sdk/typescript 2.4.8 2.928.0 1.0.0 @gr4vy/sdk",
43
43
  };
44
44
  //# sourceMappingURL=config.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gr4vy/sdk",
3
- "version": "2.4.6",
3
+ "version": "2.4.8",
4
4
  "author": "Gr4vy",
5
5
  "main": "./index.js",
6
6
  "sideEffects": false,
package/src/lib/auth.ts CHANGED
@@ -166,12 +166,16 @@ export enum JWTScope {
166
166
  AntiFraudServiceDefinitionsWrite = "anti-fraud-service-definitions.write",
167
167
  AntiFraudServicesRead = "anti-fraud-services.read",
168
168
  AntiFraudServicesWrite = "anti-fraud-services.write",
169
+ ApiKeyPairsRead = "api-key-pairs.read",
170
+ ApiKeyPairsWrite = "api-key-pairs.write",
169
171
  ApiLogsRead = "api-logs.read",
170
172
  ApiLogsWrite = "api-logs.write",
171
173
  ApplePayCertificatesRead = "apple-pay-certificates.read",
172
174
  ApplePayCertificatesWrite = "apple-pay-certificates.write",
173
175
  AuditLogsRead = "audit-logs.read",
174
176
  AuditLogsWrite = "audit-logs.write",
177
+ BinCheckerRead = "bin-checker.read",
178
+ BinCheckerWrite = "bin-checker.write",
175
179
  BuyersRead = "buyers.read",
176
180
  BuyersWrite = "buyers.write",
177
181
  BuyersBillingDetailsRead = "buyers.billing-details.read",
@@ -212,6 +216,8 @@ export enum JWTScope {
212
216
  ReportsWrite = "reports.write",
213
217
  RolesRead = "roles.read",
214
218
  RolesWrite = "roles.write",
219
+ ThreeDSScenariosRead = "three-ds-scenarios.read",
220
+ ThreeDSScenariosWrite = "three-ds-scenarios.write",
215
221
  TransactionsRead = "transactions.read",
216
222
  TransactionsWrite = "transactions.write",
217
223
  UsersMeRead = "users.me.read",
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.4.6",
81
- genVersion: "2.927.0",
82
- userAgent: "speakeasy-sdk/typescript 2.4.6 2.927.0 1.0.0 @gr4vy/sdk",
80
+ sdkVersion: "2.4.8",
81
+ genVersion: "2.928.0",
82
+ userAgent: "speakeasy-sdk/typescript 2.4.8 2.928.0 1.0.0 @gr4vy/sdk",
83
83
  } as const;
@@ -1,6 +1,7 @@
1
- import { beforeAll, describe, expect, test } from "vitest";
1
+ import { beforeAll, describe, test } from "vitest";
2
2
  import { Gr4vy } from "../../src";
3
3
  import { cardPaymentMethod } from "../utils/fixtures";
4
+ import { reaches } from "../utils/reach";
4
5
  import { setupMerchant } from "../utils/setup";
5
6
 
6
7
  let gr4vy: Gr4vy;
@@ -17,8 +18,9 @@ describe("Account Updater", () => {
17
18
  test("creating a job is exercised at the request level", async () => {
18
19
  const method = await gr4vy.paymentMethods.create(cardPaymentMethod());
19
20
 
20
- await expect(
21
- gr4vy.accountUpdater.jobs.create({ paymentMethodIds: [method.id] })
22
- ).rejects.toThrow();
21
+ await reaches(
22
+ () => gr4vy.accountUpdater.jobs.create({ paymentMethodIds: [method.id] }),
23
+ "accountUpdater.jobs.create"
24
+ );
23
25
  });
24
26
  });
@@ -1,5 +1,6 @@
1
1
  import { beforeAll, describe, expect, test } from "vitest";
2
2
  import { Gr4vy } from "../../src";
3
+ import { reaches } from "../utils/reach";
3
4
  import { createGr4vyClient, setupMerchant } from "../utils/setup";
4
5
 
5
6
  let admin: Gr4vy;
@@ -27,26 +28,32 @@ describe("API Key Pairs", () => {
27
28
  // still serialises the payload and reaches the server (which rejects it with a
28
29
  // 4xx), so the operation counts as reached by the HTTP-coverage check.
29
30
  test("create is exercised at the request level", async () => {
30
- await expect(
31
- admin.apiKeyPairs.create({
32
- displayName: "E2E API key pair",
33
- roleIds: [MISSING_ID],
34
- })
35
- ).rejects.toThrow();
31
+ await reaches(
32
+ () =>
33
+ admin.apiKeyPairs.create({
34
+ displayName: "E2E API key pair",
35
+ roleIds: [MISSING_ID],
36
+ }),
37
+ "apiKeyPairs.create"
38
+ );
36
39
  });
37
40
 
38
41
  test("fetching a missing API key pair is exercised at the request level", async () => {
39
- await expect(admin.apiKeyPairs.get(MISSING_ID)).rejects.toThrow();
42
+ await reaches(() => admin.apiKeyPairs.get(MISSING_ID), "apiKeyPairs.get");
40
43
  });
41
44
 
42
45
  test("updating a missing API key pair is exercised at the request level", async () => {
43
46
  // Note the argument order: the update body comes first, then the id.
44
- await expect(
45
- admin.apiKeyPairs.update({ displayName: "Renamed" }, MISSING_ID)
46
- ).rejects.toThrow();
47
+ await reaches(
48
+ () => admin.apiKeyPairs.update({ displayName: "Renamed" }, MISSING_ID),
49
+ "apiKeyPairs.update"
50
+ );
47
51
  });
48
52
 
49
53
  test("deleting a missing API key pair is exercised at the request level", async () => {
50
- await expect(admin.apiKeyPairs.delete(MISSING_ID)).rejects.toThrow();
54
+ await reaches(
55
+ () => admin.apiKeyPairs.delete(MISSING_ID),
56
+ "apiKeyPairs.delete"
57
+ );
51
58
  });
52
59
  });
@@ -1,6 +1,7 @@
1
1
  import { beforeAll, describe, expect, test } from "vitest";
2
2
  import { Gr4vy } from "../../src";
3
3
  import { PaymentServiceCreate } from "../../src/models/components";
4
+ import { reaches, rejectsClientError } from "../utils/reach";
4
5
  import { setupMerchant } from "../utils/setup";
5
6
 
6
7
  let gr4vy: Gr4vy;
@@ -39,26 +40,32 @@ describe("Payment Services", () => {
39
40
  expect(updated.displayName).toBe("Renamed service");
40
41
 
41
42
  await gr4vy.paymentServices.delete(created.id!);
42
- await expect(() => gr4vy.paymentServices.get(created.id!)).rejects.toThrow();
43
+ await rejectsClientError(
44
+ () => gr4vy.paymentServices.get(created.id!),
45
+ "paymentServices.get after delete"
46
+ );
43
47
  });
44
48
 
45
49
  // Credential verification and session creation are not meaningfully supported
46
50
  // by the mock-card connector (verify returns a non-JSON body; session is
47
51
  // explicitly unsupported), so both are exercised at the request level.
48
52
  test("verify is exercised at the request level", async () => {
49
- await expect(
50
- gr4vy.paymentServices.verify({
51
- paymentServiceDefinitionId: "mock-card",
52
- fields: [{ key: "merchant_id", value: "test" }],
53
- })
54
- ).rejects.toThrow();
53
+ await reaches(
54
+ () =>
55
+ gr4vy.paymentServices.verify({
56
+ paymentServiceDefinitionId: "mock-card",
57
+ fields: [{ key: "merchant_id", value: "test" }],
58
+ }),
59
+ "paymentServices.verify"
60
+ );
55
61
  });
56
62
 
57
63
  test("create a session is exercised at the request level", async () => {
58
64
  const created = await gr4vy.paymentServices.create(mockCardService());
59
- await expect(
60
- gr4vy.paymentServices.session({}, created.id!)
61
- ).rejects.toThrow();
65
+ await reaches(
66
+ () => gr4vy.paymentServices.session({}, created.id!),
67
+ "paymentServices.session"
68
+ );
62
69
  });
63
70
 
64
71
  describe("definitions, options and card schemes", () => {
@@ -73,9 +80,10 @@ describe("Payment Services", () => {
73
80
 
74
81
  test("create a session for a definition is exercised at the request level", async () => {
75
82
  // Session creation is not supported for the mock-card definition.
76
- await expect(
77
- gr4vy.paymentServiceDefinitions.session({}, "mock-card")
78
- ).rejects.toThrow();
83
+ await reaches(
84
+ () => gr4vy.paymentServiceDefinitions.session({}, "mock-card"),
85
+ "paymentServiceDefinitions.session"
86
+ );
79
87
  });
80
88
 
81
89
  test("list payment options for a cart", async () => {
@@ -1,6 +1,7 @@
1
1
  import { beforeAll, describe, expect, test } from "vitest";
2
2
  import { Gr4vy } from "../../src";
3
3
  import { APPROVING_CARD } from "../utils/fixtures";
4
+ import { reaches } from "../utils/reach";
4
5
  import { setupMerchant } from "../utils/setup";
5
6
 
6
7
  let gr4vy: Gr4vy;
@@ -27,23 +28,26 @@ describe("Payouts", () => {
27
28
  fields: [{ key: "merchant_id", value: "test" }],
28
29
  });
29
30
 
30
- await expect(
31
- gr4vy.payouts.create({
32
- amount: 1299,
33
- currency: "USD",
34
- paymentServiceId: service.id,
35
- paymentMethod: {
36
- method: "card",
37
- number: APPROVING_CARD.number,
38
- expirationDate: APPROVING_CARD.expiration_date,
39
- },
40
- })
41
- ).rejects.toThrow();
31
+ await reaches(
32
+ () =>
33
+ gr4vy.payouts.create({
34
+ amount: 1299,
35
+ currency: "USD",
36
+ paymentServiceId: service.id,
37
+ paymentMethod: {
38
+ method: "card",
39
+ number: APPROVING_CARD.number,
40
+ expirationDate: APPROVING_CARD.expiration_date,
41
+ },
42
+ }),
43
+ "payouts.create"
44
+ );
42
45
  });
43
46
 
44
47
  test("fetching a missing payout is exercised at the request level", async () => {
45
- await expect(
46
- gr4vy.payouts.get("00000000-0000-0000-0000-000000000000")
47
- ).rejects.toThrow();
48
+ await reaches(
49
+ () => gr4vy.payouts.get("00000000-0000-0000-0000-000000000000"),
50
+ "payouts.get"
51
+ );
48
52
  });
49
53
  });
@@ -2,6 +2,7 @@ import { beforeAll, describe, expect, test } from "vitest";
2
2
  import { Gr4vy } from "../../src";
3
3
  import { ReportCreate } from "../../src/models/components";
4
4
  import { uniqueId } from "../utils/fixtures";
5
+ import { reaches } from "../utils/reach";
5
6
  import { setupMerchant } from "../utils/setup";
6
7
 
7
8
  let gr4vy: Gr4vy;
@@ -61,9 +62,13 @@ describe("Reports", () => {
61
62
  const created = await gr4vy.reports.create(reportCreate());
62
63
  const bogus = "00000000-0000-0000-0000-000000000000";
63
64
 
64
- await expect(gr4vy.reports.executions.get(bogus)).rejects.toThrow();
65
- await expect(
66
- gr4vy.reports.executions.url(created.id, bogus)
67
- ).rejects.toThrow();
65
+ await reaches(
66
+ () => gr4vy.reports.executions.get(bogus),
67
+ "reports.executions.get"
68
+ );
69
+ await reaches(
70
+ () => gr4vy.reports.executions.url(created.id, bogus),
71
+ "reports.executions.url"
72
+ );
68
73
  });
69
74
  });
@@ -7,6 +7,7 @@ import {
7
7
  cardPaymentMethod,
8
8
  uniqueId,
9
9
  } from "../utils/fixtures";
10
+ import { rejectsClientError } from "../utils/reach";
10
11
  import { setupMerchant } from "../utils/setup";
11
12
 
12
13
  let gr4vy: Gr4vy;
@@ -69,6 +70,9 @@ describe("Buyer lifecycle", () => {
69
70
  expect(created.billingDetails?.firstName).toBe("Grace");
70
71
 
71
72
  await gr4vy.buyers.delete(created.id!);
72
- await expect(() => gr4vy.buyers.get(created.id!)).rejects.toThrow();
73
+ await rejectsClientError(
74
+ () => gr4vy.buyers.get(created.id!),
75
+ "buyers.get after delete"
76
+ );
73
77
  });
74
78
  });
@@ -9,6 +9,7 @@ import {
9
9
  } from "../utils/fixtures";
10
10
  import { putCheckoutSessionCard } from "../utils/fields";
11
11
  import { pollUntil } from "../utils/poll";
12
+ import { reaches } from "../utils/reach";
12
13
  import { setupMerchant } from "../utils/setup";
13
14
 
14
15
  let gr4vy: Gr4vy;
@@ -140,7 +141,10 @@ describe("Transaction lifecycle", () => {
140
141
  // rejects it with a clear "not supported" error.
141
142
  test("authorize → cancel is exercised at the request level", async () => {
142
143
  const transaction = await authorize(1500);
143
- await expect(gr4vy.transactions.cancel(transaction.id)).rejects.toThrow();
144
+ await reaches(
145
+ () => gr4vy.transactions.cancel(transaction.id),
146
+ "transactions.cancel"
147
+ );
144
148
  });
145
149
 
146
150
  test("intent=capture authorizes and captures in one step", async () => {
@@ -164,18 +168,23 @@ describe("Transaction lifecycle", () => {
164
168
 
165
169
  // No settlement exists yet for a freshly captured transaction in the mock
166
170
  // env, so fetching one by id is exercised at the request level.
167
- await expect(
168
- gr4vy.transactions.settlements.get(
169
- transaction.id,
170
- "00000000-0000-0000-0000-000000000000"
171
- )
172
- ).rejects.toThrow();
171
+ await reaches(
172
+ () =>
173
+ gr4vy.transactions.settlements.get(
174
+ transaction.id,
175
+ "00000000-0000-0000-0000-000000000000"
176
+ ),
177
+ "transactions.settlements.get"
178
+ );
173
179
  });
174
180
 
175
181
  // `sync` is not supported by the mock-card connector; exercise the call shape
176
182
  // and assert the API rejects it rather than skipping the endpoint.
177
183
  test("sync is exercised at the request level", async () => {
178
184
  const transaction = await authorize(1700);
179
- await expect(gr4vy.transactions.sync(transaction.id)).rejects.toThrow();
185
+ await reaches(
186
+ () => gr4vy.transactions.sync(transaction.id),
187
+ "transactions.sync"
188
+ );
180
189
  });
181
190
  });
@@ -3,6 +3,7 @@ import { beforeAll, describe, expect, test } from "vitest";
3
3
  import { Gr4vy } from "../../src";
4
4
  import { address, billingDetails, buyer, uniqueId } from "../utils/fixtures";
5
5
  import { fcParams, name } from "../utils/arbitraries";
6
+ import { rejectsClientError } from "../utils/reach";
6
7
  import { setupMerchant } from "../utils/setup";
7
8
 
8
9
  let gr4vy: Gr4vy;
@@ -23,7 +24,10 @@ describe("Buyers", () => {
23
24
  expect(page).toBeDefined();
24
25
 
25
26
  await gr4vy.buyers.delete(created.id!);
26
- await expect(() => gr4vy.buyers.get(created.id!)).rejects.toThrow();
27
+ await rejectsClientError(
28
+ () => gr4vy.buyers.get(created.id!),
29
+ "buyers.get after delete"
30
+ );
27
31
  });
28
32
 
29
33
  test("can be looked up by external identifier", async () => {
@@ -10,6 +10,7 @@ import {
10
10
  putCheckoutSessionCard,
11
11
  putCheckoutSessionStoredMethod,
12
12
  } from "../utils/fields";
13
+ import { rejectsClientError } from "../utils/reach";
13
14
  import { setupMerchant } from "../utils/setup";
14
15
 
15
16
  let gr4vy: Gr4vy;
@@ -94,6 +95,9 @@ describe("Checkout Sessions", () => {
94
95
  expect(updated.metadata?.["source"]).toBe("updated");
95
96
 
96
97
  await gr4vy.checkoutSessions.delete(created.id);
97
- await expect(() => gr4vy.checkoutSessions.get(created.id)).rejects.toThrow();
98
+ await rejectsClientError(
99
+ () => gr4vy.checkoutSessions.get(created.id),
100
+ "checkoutSessions.get after delete"
101
+ );
98
102
  });
99
103
  });
@@ -2,6 +2,7 @@ import { beforeAll, describe, expect, test } from "vitest";
2
2
  import { Gr4vy } from "../../src";
3
3
  import { DigitalWallet } from "../../src/models/components";
4
4
  import { uniqueId } from "../utils/fixtures";
5
+ import { reaches, rejectsClientError } from "../utils/reach";
5
6
  import { setupMerchant } from "../utils/setup";
6
7
 
7
8
  let gr4vy: Gr4vy;
@@ -51,7 +52,10 @@ describe("Digital Wallets", () => {
51
52
  expect(updated.merchantDisplayName).toBe("Renamed Display");
52
53
 
53
54
  await gr4vy.digitalWallets.delete(created.id);
54
- await expect(() => gr4vy.digitalWallets.get(created.id)).rejects.toThrow();
55
+ await rejectsClientError(
56
+ () => gr4vy.digitalWallets.get(created.id),
57
+ "digitalWallets.get after delete"
58
+ );
55
59
  });
56
60
 
57
61
  // A Google Pay session can be minted server-side from an origin domain; assert
@@ -69,58 +73,71 @@ describe("Digital Wallets", () => {
69
73
  // shape is covered and the API rejects it for a real reason.
70
74
  describe("sessions exercised at the request level", () => {
71
75
  test("apple pay session", async () => {
72
- await expect(
73
- gr4vy.digitalWallets.sessions.applePay({
74
- validationUrl: "https://apple-pay-gateway.apple.com/paymentservices",
75
- domainName: "not-a-registered-domain.example.com",
76
- })
77
- ).rejects.toThrow();
76
+ await reaches(
77
+ () =>
78
+ gr4vy.digitalWallets.sessions.applePay({
79
+ validationUrl:
80
+ "https://apple-pay-gateway.apple.com/paymentservices",
81
+ domainName: "not-a-registered-domain.example.com",
82
+ }),
83
+ "digitalWallets.sessions.applePay"
84
+ );
78
85
  });
79
86
 
80
87
  test("click to pay session", async () => {
81
- await expect(
82
- gr4vy.digitalWallets.sessions.clickToPay({
83
- checkoutSessionId: "00000000-0000-0000-0000-000000000000",
84
- })
85
- ).rejects.toThrow();
88
+ await reaches(
89
+ () =>
90
+ gr4vy.digitalWallets.sessions.clickToPay({
91
+ checkoutSessionId: "00000000-0000-0000-0000-000000000000",
92
+ }),
93
+ "digitalWallets.sessions.clickToPay"
94
+ );
86
95
  });
87
96
 
88
97
  test("paze session", async () => {
89
- await expect(
90
- gr4vy.digitalWallets.sessions.paze({
91
- source: "web",
92
- domainName: "not-a-registered-domain.example.com",
93
- })
94
- ).rejects.toThrow();
98
+ await reaches(
99
+ () =>
100
+ gr4vy.digitalWallets.sessions.paze({
101
+ source: "web",
102
+ domainName: "not-a-registered-domain.example.com",
103
+ }),
104
+ "digitalWallets.sessions.paze"
105
+ );
95
106
  });
96
107
 
97
108
  test("paze mobile session create / review / complete", async () => {
98
- await expect(
99
- gr4vy.digitalWallets.sessions.pazeMobileSessionCreate({
100
- client: { id: "client-id" },
101
- sessionId: "session-id",
102
- accessToken: "access-token",
103
- callbackURLScheme: "gr4vy",
104
- intent: "EXPRESS_CHECKOUT",
105
- })
106
- ).rejects.toThrow();
107
-
108
- await expect(
109
- gr4vy.digitalWallets.sessions.pazeMobileSessionReview({
110
- sessionId: "session-id",
111
- code: "code",
112
- accessToken: "access-token",
113
- })
114
- ).rejects.toThrow();
115
-
116
- await expect(
117
- gr4vy.digitalWallets.sessions.pazeMobileSessionComplete({
118
- sessionId: "session-id",
119
- code: "code",
120
- accessToken: "access-token",
121
- transactionType: "PURCHASE",
122
- })
123
- ).rejects.toThrow();
109
+ await reaches(
110
+ () =>
111
+ gr4vy.digitalWallets.sessions.pazeMobileSessionCreate({
112
+ client: { id: "client-id" },
113
+ sessionId: "session-id",
114
+ accessToken: "access-token",
115
+ callbackURLScheme: "gr4vy",
116
+ intent: "EXPRESS_CHECKOUT",
117
+ }),
118
+ "digitalWallets.sessions.pazeMobileSessionCreate"
119
+ );
120
+
121
+ await reaches(
122
+ () =>
123
+ gr4vy.digitalWallets.sessions.pazeMobileSessionReview({
124
+ sessionId: "session-id",
125
+ code: "code",
126
+ accessToken: "access-token",
127
+ }),
128
+ "digitalWallets.sessions.pazeMobileSessionReview"
129
+ );
130
+
131
+ await reaches(
132
+ () =>
133
+ gr4vy.digitalWallets.sessions.pazeMobileSessionComplete({
134
+ sessionId: "session-id",
135
+ code: "code",
136
+ accessToken: "access-token",
137
+ transactionType: "PURCHASE",
138
+ }),
139
+ "digitalWallets.sessions.pazeMobileSessionComplete"
140
+ );
124
141
  });
125
142
  });
126
143
 
@@ -130,12 +147,14 @@ describe("Digital Wallets", () => {
130
147
  describe("domains exercised at the request level", () => {
131
148
  test("domain registration is rejected", async () => {
132
149
  await withWallet(async (wallet) => {
133
- await expect(
134
- gr4vy.digitalWallets.domains.create(
135
- { domainName: "example.com" },
136
- wallet.id
137
- )
138
- ).rejects.toThrow();
150
+ await reaches(
151
+ () =>
152
+ gr4vy.digitalWallets.domains.create(
153
+ { domainName: "example.com" },
154
+ wallet.id
155
+ ),
156
+ "digitalWallets.domains.create"
157
+ );
139
158
  });
140
159
  });
141
160
 
@@ -1,5 +1,6 @@
1
1
  import { beforeAll, describe, expect, test } from "vitest";
2
2
  import { Gr4vy } from "../../src";
3
+ import { reaches } from "../utils/reach";
3
4
  import { setupMerchant } from "../utils/setup";
4
5
 
5
6
  let gr4vy: Gr4vy;
@@ -19,27 +20,58 @@ describe("Gift Cards", () => {
19
20
  // is provisioned only with `mock-card`, so these calls are exercised at the
20
21
  // request level and the API is expected to reject them for a real reason.
21
22
  test("create is exercised at the request level", async () => {
22
- await expect(
23
- gr4vy.giftCards.create({
24
- number: "4111111111111111",
25
- pin: "1234",
26
- })
27
- ).rejects.toThrow();
23
+ await reaches(
24
+ () =>
25
+ gr4vy.giftCards.create({
26
+ number: "4111111111111111",
27
+ pin: "1234",
28
+ }),
29
+ "giftCards.create"
30
+ );
28
31
  });
29
32
 
30
33
  test("balance lookup is exercised at the request level", async () => {
31
- await expect(
32
- gr4vy.giftCards.balances.list({
33
- items: [{ number: "4111111111111111", pin: "1234" }],
34
- })
35
- ).rejects.toThrow();
34
+ await reaches(
35
+ () =>
36
+ gr4vy.giftCards.balances.list({
37
+ items: [{ number: "4111111111111111", pin: "1234" }],
38
+ }),
39
+ "giftCards.balances.list"
40
+ );
36
41
  });
37
42
 
38
43
  // No gift card exists to fetch/delete on the mock merchant, so get/delete are
39
44
  // exercised against a non-existent id and expected to be rejected.
40
45
  test("get and delete are exercised at the request level", async () => {
41
46
  const bogus = "00000000-0000-0000-0000-000000000000";
42
- await expect(gr4vy.giftCards.get(bogus)).rejects.toThrow();
43
- await expect(gr4vy.giftCards.delete(bogus)).rejects.toThrow();
47
+ await reaches(() => gr4vy.giftCards.get(bogus), "giftCards.get");
48
+ await reaches(() => gr4vy.giftCards.delete(bogus), "giftCards.delete");
49
+ });
50
+
51
+ // Activation and issuance both need a configured gift-card service, so they
52
+ // are asserted via `reaches` — a 2xx or a clean 4xx passes, a 5xx fails.
53
+ test("activation is exercised at the request level", async () => {
54
+ await reaches(
55
+ () =>
56
+ gr4vy.giftCards.activations.create({
57
+ number: "4111111111111111",
58
+ pin: "1234",
59
+ amount: 1299,
60
+ currency: "USD",
61
+ }),
62
+ "giftCards.activations.create"
63
+ );
64
+ });
65
+
66
+ test("issuance is exercised at the request level", async () => {
67
+ await reaches(
68
+ () =>
69
+ gr4vy.giftCards.issuances.create({
70
+ theme: "default",
71
+ amount: 1299,
72
+ currency: "USD",
73
+ }),
74
+ "giftCards.issuances.create"
75
+ );
44
76
  });
45
77
  });
@@ -1,6 +1,7 @@
1
1
  import { beforeAll, describe, expect, test } from "vitest";
2
2
  import { Gr4vy } from "../../src";
3
3
  import { buyer, cardPaymentMethod } from "../utils/fixtures";
4
+ import { reaches, rejectsClientError } from "../utils/reach";
4
5
  import { setupMerchant } from "../utils/setup";
5
6
 
6
7
  let gr4vy: Gr4vy;
@@ -24,7 +25,10 @@ describe("Payment Methods", () => {
24
25
  expect(page).toBeDefined();
25
26
 
26
27
  await gr4vy.paymentMethods.delete(created.id);
27
- await expect(() => gr4vy.paymentMethods.get(created.id)).rejects.toThrow();
28
+ await rejectsClientError(
29
+ () => gr4vy.paymentMethods.get(created.id),
30
+ "paymentMethods.get after delete"
31
+ );
28
32
  });
29
33
 
30
34
  test("update changes only the expiration date (partial)", async () => {
@@ -62,29 +66,36 @@ describe("Payment Methods", () => {
62
66
  const card = await storeCard();
63
67
  const bogusToken = "00000000-0000-0000-0000-000000000000";
64
68
 
65
- await expect(
66
- gr4vy.paymentMethods.networkTokens.create(
67
- { merchantInitiated: true, isSubsequentPayment: false },
68
- card.id
69
- )
70
- ).rejects.toThrow();
69
+ await reaches(
70
+ () =>
71
+ gr4vy.paymentMethods.networkTokens.create(
72
+ { merchantInitiated: true, isSubsequentPayment: false },
73
+ card.id
74
+ ),
75
+ "paymentMethods.networkTokens.create"
76
+ );
71
77
 
72
- await expect(
73
- gr4vy.paymentMethods.networkTokens.suspend(card.id, bogusToken)
74
- ).rejects.toThrow();
75
- await expect(
76
- gr4vy.paymentMethods.networkTokens.resume(card.id, bogusToken)
77
- ).rejects.toThrow();
78
- await expect(
79
- gr4vy.paymentMethods.networkTokens.delete(card.id, bogusToken)
80
- ).rejects.toThrow();
81
- await expect(
82
- gr4vy.paymentMethods.networkTokens.cryptogram.create(
83
- { merchantInitiated: true },
84
- card.id,
85
- bogusToken
86
- )
87
- ).rejects.toThrow();
78
+ await reaches(
79
+ () => gr4vy.paymentMethods.networkTokens.suspend(card.id, bogusToken),
80
+ "paymentMethods.networkTokens.suspend"
81
+ );
82
+ await reaches(
83
+ () => gr4vy.paymentMethods.networkTokens.resume(card.id, bogusToken),
84
+ "paymentMethods.networkTokens.resume"
85
+ );
86
+ await reaches(
87
+ () => gr4vy.paymentMethods.networkTokens.delete(card.id, bogusToken),
88
+ "paymentMethods.networkTokens.delete"
89
+ );
90
+ await reaches(
91
+ () =>
92
+ gr4vy.paymentMethods.networkTokens.cryptogram.create(
93
+ { merchantInitiated: true },
94
+ card.id,
95
+ bogusToken
96
+ ),
97
+ "paymentMethods.networkTokens.cryptogram.create"
98
+ );
88
99
  });
89
100
  });
90
101
 
@@ -101,21 +112,25 @@ describe("Payment Methods", () => {
101
112
  // which mock-card is not; exercise the call shape at the request level.
102
113
  test("create and delete are exercised at the request level", async () => {
103
114
  const card = await storeCard();
104
- await expect(
105
- gr4vy.paymentMethods.paymentServiceTokens.create(
106
- {
107
- paymentServiceId: "00000000-0000-0000-0000-000000000000",
108
- redirectUrl: "https://example.com/return",
109
- },
110
- card.id
111
- )
112
- ).rejects.toThrow();
113
- await expect(
114
- gr4vy.paymentMethods.paymentServiceTokens.delete(
115
- card.id,
116
- "00000000-0000-0000-0000-000000000000"
117
- )
118
- ).rejects.toThrow();
115
+ await reaches(
116
+ () =>
117
+ gr4vy.paymentMethods.paymentServiceTokens.create(
118
+ {
119
+ paymentServiceId: "00000000-0000-0000-0000-000000000000",
120
+ redirectUrl: "https://example.com/return",
121
+ },
122
+ card.id
123
+ ),
124
+ "paymentMethods.paymentServiceTokens.create"
125
+ );
126
+ await reaches(
127
+ () =>
128
+ gr4vy.paymentMethods.paymentServiceTokens.delete(
129
+ card.id,
130
+ "00000000-0000-0000-0000-000000000000"
131
+ ),
132
+ "paymentMethods.paymentServiceTokens.delete"
133
+ );
119
134
  });
120
135
  });
121
136
  });
@@ -3,6 +3,7 @@ import { beforeAll, describe, expect, test } from "vitest";
3
3
  import { Gr4vy } from "../../src";
4
4
  import { amount, currency, fcParams, metadata } from "../utils/arbitraries";
5
5
  import { buyer, cardPaymentMethod, uniqueId } from "../utils/fixtures";
6
+ import { reaches } from "../utils/reach";
6
7
  import { authorizeViaCheckoutSession } from "../utils/transactions";
7
8
  import { setupMerchant } from "../utils/setup";
8
9
 
@@ -139,8 +140,23 @@ describe("Transaction refund settlements", () => {
139
140
  test("fetching a missing refund settlement is exercised at the request level", async () => {
140
141
  const created = await authorizeViaCheckoutSession(gr4vy, 1299);
141
142
 
142
- await expect(
143
- gr4vy.transactions.refundSettlements.get(created.id, MISSING_ID)
144
- ).rejects.toThrow();
143
+ await reaches(
144
+ () => gr4vy.transactions.refundSettlements.get(created.id, MISSING_ID),
145
+ "transactions.refundSettlements.get"
146
+ );
147
+ });
148
+ });
149
+
150
+ // Incremental authorization is a PSP capability the mock connector does not
151
+ // offer. We authorize for real first so the increment is attempted against a
152
+ // genuinely authorized transaction, then accept a clean rejection.
153
+ describe("Transaction authorization increment", () => {
154
+ test("incrementing an authorization is exercised at the request level", async () => {
155
+ const created = await authorizeViaCheckoutSession(gr4vy, 1299);
156
+
157
+ await reaches(
158
+ () => gr4vy.transactions.incrementAuthorization({ amount: 500 }, created.id),
159
+ "transactions.incrementAuthorization"
160
+ );
145
161
  });
146
162
  });
@@ -0,0 +1,82 @@
1
+ import { Gr4vyError } from "../../src/models/errors";
2
+
3
+ /**
4
+ * Assert that an operation *reaches the server* — the point being that the
5
+ * endpoint-reach report counts operations by observed HTTP calls, so the value
6
+ * of these tests is proving a well-formed request went out over the wire.
7
+ *
8
+ * Some operations cannot be driven to a 2xx in the mock-card sandbox (a
9
+ * configured gift-card service, a PSP that supports incremental authorization),
10
+ * so a clean 4xx is an acceptable outcome alongside a 2xx.
11
+ *
12
+ * A **5xx fails**: that means we sent something the API could not handle, which
13
+ * is a real defect worth surfacing. A failure that never hit the wire (local
14
+ * validation, serialization, connection refused) also fails — plain
15
+ * `rejects.toThrow()` would silently accept those and prove nothing.
16
+ */
17
+ export const reaches = async (
18
+ action: () => Promise<unknown>,
19
+ description: string
20
+ ): Promise<void> => {
21
+ try {
22
+ await action();
23
+ return; // reached + succeeded (2xx)
24
+ } catch (error) {
25
+ if (error instanceof Gr4vyError) {
26
+ const { statusCode } = error;
27
+ if (statusCode >= 500) {
28
+ throw new Error(
29
+ `[reach] ${description}: server error (${statusCode}): ${error.message}`
30
+ );
31
+ }
32
+ // 4xx, or a response the SDK could not fully parse — either way the
33
+ // endpoint was reached.
34
+ return;
35
+ }
36
+ throw new Error(
37
+ `[reach] ${description}: the call failed before reaching the server: ` +
38
+ `${(error as Error)?.name} — ${(error as Error)?.message}`
39
+ );
40
+ }
41
+ };
42
+
43
+ /**
44
+ * Assert that an operation reached the server and the server *rejected* it with
45
+ * a client error (4xx).
46
+ *
47
+ * Use this where the rejection is the behaviour under test rather than an
48
+ * accepted side effect — "after delete, reading it back must 404", "this
49
+ * payload must be refused". Unlike {@link reaches}, a **2xx fails**: if a
50
+ * deleted resource is still readable, that is exactly the bug the test exists
51
+ * to catch, and it must not pass.
52
+ *
53
+ * Like {@link reaches}, this also fails on a 5xx and on any failure that never
54
+ * hit the wire — the gap in a plain `rejects.toThrow()`, which passes on a
55
+ * local serialization error and so can go green without the API ever being
56
+ * asked.
57
+ */
58
+ export const rejectsClientError = async (
59
+ action: () => Promise<unknown>,
60
+ description: string
61
+ ): Promise<void> => {
62
+ try {
63
+ await action();
64
+ } catch (error) {
65
+ if (error instanceof Gr4vyError) {
66
+ const { statusCode } = error;
67
+ if (statusCode >= 400 && statusCode < 500) {
68
+ return; // reached + cleanly rejected, as expected
69
+ }
70
+ throw new Error(
71
+ `[reject] ${description}: expected a 4xx, got ${statusCode}: ${error.message}`
72
+ );
73
+ }
74
+ throw new Error(
75
+ `[reject] ${description}: the call failed before reaching the server: ` +
76
+ `${(error as Error)?.name} — ${(error as Error)?.message}`
77
+ );
78
+ }
79
+ throw new Error(
80
+ `[reject] ${description}: expected the API to reject this, but it succeeded.`
81
+ );
82
+ };