@greensecurity/javascript-sdk 0.47.0-beta.7 → 0.47.0-beta.9

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 (114) hide show
  1. package/dist/commonjs/__tests__/doAdmin.test.js +26 -0
  2. package/dist/commonjs/__tests__/doAdmin.test.js.map +1 -1
  3. package/dist/commonjs/__tests__/vendors.test.js +1 -1
  4. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  5. package/dist/commonjs/__tests__/webhooks.test.js +4 -5
  6. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  7. package/dist/commonjs/__tests__/zoneDevicesCreate.test.js +12 -1
  8. package/dist/commonjs/__tests__/zoneDevicesCreate.test.js.map +1 -1
  9. package/dist/commonjs/__tests__/zoneDevicesList.test.js +13 -1
  10. package/dist/commonjs/__tests__/zoneDevicesList.test.js.map +1 -1
  11. package/dist/commonjs/__tests__/zones.test.js +16 -10
  12. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  13. package/dist/commonjs/admin-funcs/doAdmin.d.ts +3 -1
  14. package/dist/commonjs/admin-funcs/doAdmin.d.ts.map +1 -1
  15. package/dist/commonjs/admin-funcs/doAdmin.js +11 -3
  16. package/dist/commonjs/admin-funcs/doAdmin.js.map +1 -1
  17. package/dist/commonjs/admin-funcs/vendorCredentialCreateFormQuote.d.ts +18 -1
  18. package/dist/commonjs/admin-funcs/vendorCredentialCreateFormQuote.d.ts.map +1 -1
  19. package/dist/commonjs/admin-funcs/vendorCredentialCreateFormQuote.js +18 -2
  20. package/dist/commonjs/admin-funcs/vendorCredentialCreateFormQuote.js.map +1 -1
  21. package/dist/commonjs/admin-funcs/vendorCredentialGetFormLineItems.d.ts +5 -1
  22. package/dist/commonjs/admin-funcs/vendorCredentialGetFormLineItems.d.ts.map +1 -1
  23. package/dist/commonjs/admin-funcs/vendorCredentialGetFormLineItems.js +5 -2
  24. package/dist/commonjs/admin-funcs/vendorCredentialGetFormLineItems.js.map +1 -1
  25. package/dist/commonjs/admin-funcs/zoneDevicesDelete.d.ts +3 -0
  26. package/dist/commonjs/admin-funcs/zoneDevicesDelete.d.ts.map +1 -0
  27. package/dist/commonjs/admin-funcs/zoneDevicesDelete.js +11 -0
  28. package/dist/commonjs/admin-funcs/zoneDevicesDelete.js.map +1 -0
  29. package/dist/commonjs/admin-funcs/zoneDevicesList.d.ts +1 -0
  30. package/dist/commonjs/admin-funcs/zoneDevicesList.d.ts.map +1 -1
  31. package/dist/commonjs/admin-funcs/zoneDevicesList.js +3 -0
  32. package/dist/commonjs/admin-funcs/zoneDevicesList.js.map +1 -1
  33. package/dist/commonjs/admin-funcs/zoneDevicesProvisioning.d.ts +3 -0
  34. package/dist/commonjs/admin-funcs/zoneDevicesProvisioning.d.ts.map +1 -0
  35. package/dist/commonjs/admin-funcs/zoneDevicesProvisioning.js +15 -0
  36. package/dist/commonjs/admin-funcs/zoneDevicesProvisioning.js.map +1 -0
  37. package/dist/commonjs/admin-funcs/zoneDevicesUpdate.js +2 -2
  38. package/dist/commonjs/admin-funcs/zoneDevicesUpdate.js.map +1 -1
  39. package/dist/commonjs/index.extras.d.ts +4 -0
  40. package/dist/commonjs/index.extras.d.ts.map +1 -1
  41. package/dist/commonjs/index.extras.js +4 -0
  42. package/dist/commonjs/index.extras.js.map +1 -1
  43. package/dist/commonjs/lib/config.d.ts +2 -2
  44. package/dist/commonjs/lib/config.js +2 -2
  45. package/dist/commonjs/models/operations/createinvoice.d.ts +25 -0
  46. package/dist/commonjs/models/operations/createinvoice.d.ts.map +1 -1
  47. package/dist/commonjs/models/operations/createinvoice.js +10 -0
  48. package/dist/commonjs/models/operations/createinvoice.js.map +1 -1
  49. package/dist/esm/__tests__/doAdmin.test.js +27 -1
  50. package/dist/esm/__tests__/doAdmin.test.js.map +1 -1
  51. package/dist/esm/__tests__/vendors.test.js +1 -1
  52. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  53. package/dist/esm/__tests__/webhooks.test.js +4 -5
  54. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  55. package/dist/esm/__tests__/zoneDevicesCreate.test.js +12 -1
  56. package/dist/esm/__tests__/zoneDevicesCreate.test.js.map +1 -1
  57. package/dist/esm/__tests__/zoneDevicesList.test.js +13 -1
  58. package/dist/esm/__tests__/zoneDevicesList.test.js.map +1 -1
  59. package/dist/esm/__tests__/zones.test.js +16 -10
  60. package/dist/esm/__tests__/zones.test.js.map +1 -1
  61. package/dist/esm/admin-funcs/doAdmin.d.ts +3 -1
  62. package/dist/esm/admin-funcs/doAdmin.d.ts.map +1 -1
  63. package/dist/esm/admin-funcs/doAdmin.js +10 -3
  64. package/dist/esm/admin-funcs/doAdmin.js.map +1 -1
  65. package/dist/esm/admin-funcs/vendorCredentialCreateFormQuote.d.ts +18 -1
  66. package/dist/esm/admin-funcs/vendorCredentialCreateFormQuote.d.ts.map +1 -1
  67. package/dist/esm/admin-funcs/vendorCredentialCreateFormQuote.js +18 -2
  68. package/dist/esm/admin-funcs/vendorCredentialCreateFormQuote.js.map +1 -1
  69. package/dist/esm/admin-funcs/vendorCredentialGetFormLineItems.d.ts +5 -1
  70. package/dist/esm/admin-funcs/vendorCredentialGetFormLineItems.d.ts.map +1 -1
  71. package/dist/esm/admin-funcs/vendorCredentialGetFormLineItems.js +5 -2
  72. package/dist/esm/admin-funcs/vendorCredentialGetFormLineItems.js.map +1 -1
  73. package/dist/esm/admin-funcs/zoneDevicesDelete.d.ts +3 -0
  74. package/dist/esm/admin-funcs/zoneDevicesDelete.d.ts.map +1 -0
  75. package/dist/esm/admin-funcs/zoneDevicesDelete.js +8 -0
  76. package/dist/esm/admin-funcs/zoneDevicesDelete.js.map +1 -0
  77. package/dist/esm/admin-funcs/zoneDevicesList.d.ts +1 -0
  78. package/dist/esm/admin-funcs/zoneDevicesList.d.ts.map +1 -1
  79. package/dist/esm/admin-funcs/zoneDevicesList.js +3 -0
  80. package/dist/esm/admin-funcs/zoneDevicesList.js.map +1 -1
  81. package/dist/esm/admin-funcs/zoneDevicesProvisioning.d.ts +3 -0
  82. package/dist/esm/admin-funcs/zoneDevicesProvisioning.d.ts.map +1 -0
  83. package/dist/esm/admin-funcs/zoneDevicesProvisioning.js +12 -0
  84. package/dist/esm/admin-funcs/zoneDevicesProvisioning.js.map +1 -0
  85. package/dist/esm/admin-funcs/zoneDevicesUpdate.js +2 -2
  86. package/dist/esm/admin-funcs/zoneDevicesUpdate.js.map +1 -1
  87. package/dist/esm/index.extras.d.ts +4 -0
  88. package/dist/esm/index.extras.d.ts.map +1 -1
  89. package/dist/esm/index.extras.js +4 -0
  90. package/dist/esm/index.extras.js.map +1 -1
  91. package/dist/esm/lib/config.d.ts +2 -2
  92. package/dist/esm/lib/config.js +2 -2
  93. package/dist/esm/models/operations/createinvoice.d.ts +25 -0
  94. package/dist/esm/models/operations/createinvoice.d.ts.map +1 -1
  95. package/dist/esm/models/operations/createinvoice.js +10 -0
  96. package/dist/esm/models/operations/createinvoice.js.map +1 -1
  97. package/jsr.json +1 -1
  98. package/package.json +1 -1
  99. package/src/__tests__/doAdmin.test.ts +35 -0
  100. package/src/__tests__/vendors.test.ts +1 -1
  101. package/src/__tests__/webhooks.test.ts +4 -5
  102. package/src/__tests__/zoneDevicesCreate.test.ts +16 -1
  103. package/src/__tests__/zoneDevicesList.test.ts +15 -1
  104. package/src/__tests__/zones.test.ts +16 -10
  105. package/src/admin-funcs/doAdmin.ts +20 -3
  106. package/src/admin-funcs/vendorCredentialCreateFormQuote.ts +20 -1
  107. package/src/admin-funcs/vendorCredentialGetFormLineItems.ts +5 -0
  108. package/src/admin-funcs/zoneDevicesDelete.ts +8 -0
  109. package/src/admin-funcs/zoneDevicesList.ts +4 -0
  110. package/src/admin-funcs/zoneDevicesProvisioning.ts +12 -0
  111. package/src/admin-funcs/zoneDevicesUpdate.ts +2 -2
  112. package/src/index.extras.ts +4 -0
  113. package/src/lib/config.ts +2 -2
  114. package/src/models/operations/createinvoice.ts +35 -0
@@ -1,7 +1,8 @@
1
1
  import { beforeEach, describe, expect, it, vi } from "vitest";
2
2
 
3
3
  // Typed parameters so mock.calls is the argument tuple; see smartBadgeGetPsks.test.ts.
4
- const { doPostMock, doGetSingleMock, doPutMock } = vi.hoisted(() => ({
4
+ const { doPostMock, doGetSingleMock, doPutMock, doDeleteMock } = vi.hoisted(() => ({
5
+ doDeleteMock: vi.fn((_route: string) => Promise.resolve([{ ok: true }, { status: "complete" }])),
5
6
  doPutMock: vi.fn((_route: string, _body: unknown) => Promise.resolve([{ ok: true }, { status: "complete" }])),
6
7
  doPostMock: vi.fn((_route: string, _body: unknown) => Promise.resolve([{ ok: true }, { status: "complete" }])),
7
8
  doGetSingleMock: vi.fn((_route: string, _query: unknown) =>
@@ -13,6 +14,7 @@ vi.mock("../admin-funcs/doAdmin.js", () => ({
13
14
  $doPost: doPostMock,
14
15
  $doGetSingle: doGetSingleMock,
15
16
  $doPut: doPutMock,
17
+ $doDelete: doDeleteMock,
16
18
  }));
17
19
 
18
20
  import { __internal } from "../index.extras.js";
@@ -22,6 +24,7 @@ describe("__internal.zoneDevices", () => {
22
24
  doPostMock.mockClear();
23
25
  doGetSingleMock.mockClear();
24
26
  doPutMock.mockClear();
27
+ doDeleteMock.mockClear();
25
28
  });
26
29
 
27
30
  it("puts only the changed fields to /zone-devices/:id", () => {
@@ -30,6 +33,18 @@ describe("__internal.zoneDevices", () => {
30
33
  expect(doPutMock).toHaveBeenCalledWith("/zone-devices/42", { zone_id: 7, connection_type: "wifi" });
31
34
  });
32
35
 
36
+ it("deletes /zone-devices/:id", () => {
37
+ __internal.zoneDevices.delete(42);
38
+
39
+ expect(doDeleteMock).toHaveBeenCalledWith("/zone-devices/42");
40
+ });
41
+
42
+ it("posts to /zone-devices/:id/provisioning", () => {
43
+ __internal.zoneDevices.provisioning(42);
44
+
45
+ expect(doPostMock).toHaveBeenCalledWith("/zone-devices/42/provisioning", {});
46
+ });
47
+
33
48
  it("posts the gateway body verbatim to /zone-devices", () => {
34
49
  const body = {
35
50
  zone_id: 7,
@@ -28,10 +28,24 @@ describe("zoneDevicesList", () => {
28
28
  expect(doGetSingleMock).toHaveBeenCalledWith("/zone-devices", { zone_id: 7, items_per_page: 1 });
29
29
  });
30
30
 
31
+ it("sends the network filter as network_id", () => {
32
+ zoneDevicesList({ networkId: 3 });
33
+
34
+ expect(doGetSingleMock).toHaveBeenCalledWith("/zone-devices", { network_id: 3 });
35
+ });
36
+
31
37
  // Gatekeeper's Networks and Devices tabs call these; dropping them from `__internal` once
32
38
  // broke both without failing a build here.
33
39
  it("keeps the gatekeeper funcs on __internal", () => {
34
- expect(__internal.zoneDevices).toEqual({ list: zoneDevicesList, get: zoneDevicesGet });
40
+ expect(__internal.zoneDevices).toEqual({
41
+ list: zoneDevicesList,
42
+ get: zoneDevicesGet,
43
+ create: expect.any(Function),
44
+ update: expect.any(Function),
45
+ macAvailability: expect.any(Function),
46
+ provisioning: expect.any(Function),
47
+ delete: expect.any(Function),
48
+ });
35
49
  expect(__internal.networks).toEqual({ list: networksList, get: networksGet, create: networksCreate });
36
50
  });
37
51
  });
@@ -35,34 +35,40 @@ test("Zones List Or Search Security Zones", async () => {
35
35
  useUrlParams: false,
36
36
  },
37
37
  items: [
38
+ {
39
+ facility: {},
40
+ },
38
41
  {
39
42
  facility: {
40
43
  contacts: {
41
44
  contact: {
45
+ status: "Inactive",
46
+ department: 123,
47
+ },
48
+ adminContact: {
42
49
  status: "Deleted",
43
50
  department: 123,
44
51
  },
45
- adminContact: null,
46
52
  techContact: {
47
- status: "Active",
48
- department: null,
53
+ status: "Inactive",
54
+ department: 123,
49
55
  },
50
56
  greenSecurityCsm: {
51
57
  status: "Active",
52
58
  department: 123,
53
59
  },
54
- accountManager: null,
60
+ accountManager: {
61
+ status: "Inactive",
62
+ department: 123,
63
+ },
55
64
  },
56
65
  vendorGuestPolicy: {
57
- enabled: true,
66
+ enabled: false,
58
67
  vendorGuestLimitAndOr: "and",
59
- vendorGuestRequireEmail: false,
68
+ vendorGuestRequireEmail: true,
60
69
  },
61
70
  },
62
71
  },
63
- {
64
- facility: {},
65
- },
66
72
  ],
67
73
  });
68
74
  });
@@ -80,7 +86,7 @@ test("Zones Security Zone Checkin", async () => {
80
86
 
81
87
  const result = await greenSecurity.zones.securityZoneCheckin({
82
88
  qrCode: "<value>",
83
- zoneId: 705379,
89
+ zoneId: 931795,
84
90
  });
85
91
  expect(result).toBeDefined();
86
92
  expect(result).toEqual({});
@@ -341,10 +341,27 @@ export async function $doPostForm(
341
341
  return $doPostBody(route, form, {}, options);
342
342
  }
343
343
 
344
- export async function $doPut<T extends object>(
344
+ export function $doPut<T extends object>(
345
345
  route: string,
346
346
  putData: T,
347
347
  options?: RequestOptions,
348
+ ): ReturnType<typeof $doJsonRequest> {
349
+ return $doJsonRequest("PUT", route, putData, options);
350
+ }
351
+
352
+ export function $doDelete(
353
+ route: string,
354
+ options?: RequestOptions,
355
+ ): ReturnType<typeof $doJsonRequest> {
356
+ return $doJsonRequest("DELETE", route, undefined, options);
357
+ }
358
+
359
+ // PUT and DELETE share everything but the method; a DELETE sends no body.
360
+ async function $doJsonRequest(
361
+ method: "PUT" | "DELETE",
362
+ route: string,
363
+ data: object | undefined,
364
+ options?: RequestOptions,
348
365
  ): Promise<
349
366
  [
350
367
  Result<
@@ -367,7 +384,7 @@ export async function $doPut<T extends object>(
367
384
  throw new Error("GreenSecurityCore client is not initialized.");
368
385
  }
369
386
 
370
- const body = encodeJSON("body", putData, { explode: true });
387
+ const body = data === undefined ? undefined : encodeJSON("body", data, { explode: true });
371
388
 
372
389
  // Extract the path parameters from the request object
373
390
  const pathParams = {}; //extractRouteParameters(route, request);
@@ -399,7 +416,7 @@ export async function $doPut<T extends object>(
399
416
 
400
417
  const requestRes = client._createRequest(context, {
401
418
  security: requestSecurity,
402
- method: "PUT",
419
+ method,
403
420
  baseURL: options?.serverURL,
404
421
  path: path,
405
422
  headers: headers,
@@ -1,12 +1,31 @@
1
1
  import { APIPromise } from "../types/async.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
2
3
  import { $doPost, internalApiResult } from "./doAdmin.js";
3
4
 
5
+ /**
6
+ * Quotes the fee the given form answers incur on a credential.
7
+ *
8
+ * `useCredits` declares that the payer intends to settle the order from their credit balance
9
+ * before their payment method is charged. It only affects how the convenience fee is tiered --
10
+ * the fee pays for card processing, so it is assessed on what the card is left to cover, and an
11
+ * order the balance covers in full carries none. No credits are debited here, and the balance is
12
+ * read from the payer's own ledger rather than taken from this call.
13
+ *
14
+ * Answers with: `{ id, is_quote, tax, convenience_fee, total, success }`. The three money
15
+ * fields are in cents, matching what the invoice endpoints report, so the quote prices the
16
+ * order on its own and no follow-up fetch of the invoice is needed.
17
+ */
4
18
  export function vendorCredentialCreateFormQuote(
5
19
  vendorCredentialId: number,
6
20
  jsonData: string,
21
+ useCredits = false,
22
+ /** Carries the caller's AbortSignal: the form re-prices as it is filled in, so a
23
+ * superseded request has to be droppable in flight. */
24
+ options?: RequestOptions,
7
25
  ): internalApiResult {
8
26
  return new APIPromise($doPost(
9
27
  `/vendors/credentials/${vendorCredentialId}/quote`,
10
- { json_data: jsonData },
28
+ { json_data: jsonData, use_credits: useCredits },
29
+ options,
11
30
  ));
12
31
  }
@@ -1,12 +1,17 @@
1
1
  import { APIPromise } from "../types/async.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
2
3
  import { $doPost, internalApiResult } from "./doAdmin.js";
3
4
 
4
5
  export function vendorCredentialGetFormLineItems(
5
6
  vendorCredentialId: number,
6
7
  jsonData: string,
8
+ /** Carries the caller's AbortSignal: the form re-prices as it is filled in, so a
9
+ * superseded request has to be droppable in flight. */
10
+ options?: RequestOptions,
7
11
  ): internalApiResult {
8
12
  return new APIPromise($doPost(
9
13
  `/vendors/credentials/${vendorCredentialId}/line-items`,
10
14
  { json_data: jsonData },
15
+ options,
11
16
  ));
12
17
  }
@@ -0,0 +1,8 @@
1
+ import { APIPromise } from "../types/async.js";
2
+ import { $doDelete, internalApiResult } from "./doAdmin.js";
3
+
4
+ // Removes a gateway from the Gatekeeper device details screen and revokes its AWS IoT thing.
5
+ // Internal for the same reason as zoneDevicesCreate. 404 covers a gateway outside the caller's scope.
6
+ export function zoneDevicesDelete(zoneDeviceId: number): internalApiResult {
7
+ return new APIPromise($doDelete(`/zone-devices/${zoneDeviceId}`));
8
+ }
@@ -6,6 +6,7 @@ export type zoneDevicesListSortField = "id" | "name";
6
6
  export type zoneDevicesListRequest = {
7
7
  facilityId?: number;
8
8
  zoneId?: number;
9
+ networkId?: number;
9
10
  page?: number;
10
11
  itemsPerPage?: number;
11
12
  sort?: zoneDevicesListSortField;
@@ -36,6 +37,9 @@ export function zoneDevicesList(
36
37
  if (request.zoneId !== undefined) {
37
38
  query["zone_id"] = request.zoneId;
38
39
  }
40
+ if (request.networkId !== undefined) {
41
+ query["network_id"] = request.networkId;
42
+ }
39
43
  if (request.page !== undefined) {
40
44
  query["page"] = request.page;
41
45
  }
@@ -0,0 +1,12 @@
1
+ import { APIPromise } from "../types/async.js";
2
+ import { $doPost, internalApiResult } from "./doAdmin.js";
3
+
4
+ // Everything the Gatekeeper app writes to a gateway when it provisions it over the gateway's own
5
+ // Wi-Fi: the admin password, the AWS IoT certificate and broker, and the settings and
6
+ // secrets of the network it joins. The first call mints the password and certificate, hence POST.
7
+ //
8
+ // Internal for the same reason as zoneDevicesCreate. The response carries secrets: callers keep it
9
+ // in memory for the provisioning run and never persist or log it.
10
+ export function zoneDevicesProvisioning(zoneDeviceId: number): internalApiResult {
11
+ return new APIPromise($doPost(`/zone-devices/${zoneDeviceId}/provisioning`, {}));
12
+ }
@@ -11,8 +11,8 @@ export type zoneDevicesUpdateRequest = {
11
11
  name?: string;
12
12
  };
13
13
 
14
- // Edits a gateway from the Gatekeeper device details screen (GSSD-7059). Pushing a new network to
15
- // the hardware is GSSD-7061; this only updates the record.
14
+ // Edits a gateway from the Gatekeeper device details screen. This only updates the record; the
15
+ // app pushes the new network to the hardware using zoneDevicesProvisioning.
16
16
  //
17
17
  // Internal for the same reason as zoneDevicesCreate. 404 covers a gateway, zone or network outside
18
18
  // the caller's scope, and a network not linked to the zone's facility.
@@ -67,6 +67,8 @@ import { zoneDevicesGet } from "./admin-funcs/zoneDevicesGet.js";
67
67
  import { zoneDevicesCreate } from "./admin-funcs/zoneDevicesCreate.js";
68
68
  import { zoneDevicesMacAvailability } from "./admin-funcs/zoneDevicesMacAvailability.js";
69
69
  import { zoneDevicesUpdate } from "./admin-funcs/zoneDevicesUpdate.js";
70
+ import { zoneDevicesProvisioning } from "./admin-funcs/zoneDevicesProvisioning.js";
71
+ import { zoneDevicesDelete } from "./admin-funcs/zoneDevicesDelete.js";
70
72
  import { lookupsAddressValidation } from "./admin-funcs/lookupsAddressValidation.js";
71
73
  import { lookupsAddressAutocomplete } from "./admin-funcs/lookupsAddressAutocomplete.js";
72
74
  import { lookupsAddressPlace } from "./admin-funcs/lookupsAddressPlace.js";
@@ -192,6 +194,8 @@ export const __internal = {
192
194
  get: zoneDevicesGet,
193
195
  create: zoneDevicesCreate,
194
196
  update: zoneDevicesUpdate,
197
+ provisioning: zoneDevicesProvisioning,
198
+ delete: zoneDevicesDelete,
195
199
  macAvailability: zoneDevicesMacAvailability
196
200
  }
197
201
  };
package/src/lib/config.ts CHANGED
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
80
80
  export const SDK_METADATA = {
81
81
  language: "typescript",
82
82
  openapiDocVersion: "0.46.0",
83
- sdkVersion: "0.47.0-beta.7",
83
+ sdkVersion: "0.47.0-beta.9",
84
84
  genVersion: "2.948.4",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.47.0-beta.7 2.948.4 0.46.0 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.47.0-beta.9 2.948.4 0.46.0 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -58,6 +58,10 @@ export type Five = {
58
58
  * A campaign opt-in code, taken from the link that carried the offer Deliberately not an enumeration. The server decides which codes are live, what each one grants, and who qualifies for it. These decisions change as campaigns come and go. The server ignores an unrecognized code, or one the account does not qualify for, and creates the invoice as if the code were absent, never returning an error. The server adds any line item the code earns, and it appears on the quote.
59
59
  */
60
60
  promo?: string | undefined;
61
+ /**
62
+ * Set to `true` when the payer intends to settle this order from their credit balance before their payment method is charged. This affects only how the convenience fee is calculated: the fee pays for card processing, so it is assessed on the amount the card is left to cover once credits have been applied, and an order a balance covers in full carries none. No credits are debited here, and the balance is read from the payer's own ledger rather than taken from this request. Settle the credits with `POST /invoices/{id}/payment` and `use_credits: true`.
63
+ */
64
+ useCredits?: boolean | undefined;
61
65
  };
62
66
 
63
67
  export const CreateInvoiceRequestBodyInvoicesPaymentHandler = {
@@ -105,6 +109,10 @@ export type Four = {
105
109
  * A campaign opt-in code, taken from the link that carried the offer Deliberately not an enumeration. The server decides which codes are live, what each one grants, and who qualifies for it. These decisions change as campaigns come and go. The server ignores an unrecognized code, or one the account does not qualify for, and creates the invoice as if the code were absent, never returning an error. The server adds any line item the code earns, and it appears on the quote.
106
110
  */
107
111
  promo?: string | undefined;
112
+ /**
113
+ * Set to `true` when the payer intends to settle this order from their credit balance before their payment method is charged. This affects only how the convenience fee is calculated: the fee pays for card processing, so it is assessed on the amount the card is left to cover once credits have been applied, and an order a balance covers in full carries none. No credits are debited here, and the balance is read from the payer's own ledger rather than taken from this request. Settle the credits with `POST /invoices/{id}/payment` and `use_credits: true`.
114
+ */
115
+ useCredits?: boolean | undefined;
108
116
  };
109
117
 
110
118
  export const CreateInvoiceRequestBodyPaymentHandler = {
@@ -152,6 +160,10 @@ export type Three = {
152
160
  * A campaign opt-in code, taken from the link that carried the offer Deliberately not an enumeration. The server decides which codes are live, what each one grants, and who qualifies for it. These decisions change as campaigns come and go. The server ignores an unrecognized code, or one the account does not qualify for, and creates the invoice as if the code were absent, never returning an error. The server adds any line item the code earns, and it appears on the quote.
153
161
  */
154
162
  promo?: string | undefined;
163
+ /**
164
+ * Set to `true` when the payer intends to settle this order from their credit balance before their payment method is charged. This affects only how the convenience fee is calculated: the fee pays for card processing, so it is assessed on the amount the card is left to cover once credits have been applied, and an order a balance covers in full carries none. No credits are debited here, and the balance is read from the payer's own ledger rather than taken from this request. Settle the credits with `POST /invoices/{id}/payment` and `use_credits: true`.
165
+ */
166
+ useCredits?: boolean | undefined;
155
167
  };
156
168
 
157
169
  export const RequestBodyPaymentHandler = {
@@ -197,6 +209,10 @@ export type CreateInvoiceRequestBody2 = {
197
209
  * A campaign opt-in code, taken from the link that carried the offer Deliberately not an enumeration. The server decides which codes are live, what each one grants, and who qualifies for it. These decisions change as campaigns come and go. The server ignores an unrecognized code, or one the account does not qualify for, and creates the invoice as if the code were absent, never returning an error. The server adds any line item the code earns, and it appears on the quote.
198
210
  */
199
211
  promo?: string | undefined;
212
+ /**
213
+ * Set to `true` when the payer intends to settle this order from their credit balance before their payment method is charged. This affects only how the convenience fee is calculated: the fee pays for card processing, so it is assessed on the amount the card is left to cover once credits have been applied, and an order a balance covers in full carries none. No credits are debited here, and the balance is read from the payer's own ledger rather than taken from this request. Settle the credits with `POST /invoices/{id}/payment` and `use_credits: true`.
214
+ */
215
+ useCredits?: boolean | undefined;
200
216
  };
201
217
 
202
218
  export const PaymentHandler = {
@@ -240,6 +256,10 @@ export type RequestBody1 = {
240
256
  * A campaign opt-in code, taken from the link that carried the offer Deliberately not an enumeration. The server decides which codes are live, what each one grants, and who qualifies for it. These decisions change as campaigns come and go. The server ignores an unrecognized code, or one the account does not qualify for, and creates the invoice as if the code were absent, never returning an error. The server adds any line item the code earns, and it appears on the quote.
241
257
  */
242
258
  promo?: string | undefined;
259
+ /**
260
+ * Set to `true` when the payer intends to settle this order from their credit balance before their payment method is charged. This affects only how the convenience fee is calculated: the fee pays for card processing, so it is assessed on the amount the card is left to cover once credits have been applied, and an order a balance covers in full carries none. No credits are debited here, and the balance is read from the payer's own ledger rather than taken from this request. Settle the credits with `POST /invoices/{id}/payment` and `use_credits: true`.
261
+ */
262
+ useCredits?: boolean | undefined;
243
263
  };
244
264
 
245
265
  /**
@@ -336,6 +356,7 @@ export type Five$Outbound = {
336
356
  credential_pricing_ids?: Array<number> | null | undefined;
337
357
  invoice_type?: string | undefined;
338
358
  promo?: string | undefined;
359
+ use_credits: boolean;
339
360
  };
340
361
 
341
362
  /** @internal */
@@ -350,11 +371,13 @@ export const Five$outboundSchema: z.ZodType<Five$Outbound, z.ZodTypeDef, Five> =
350
371
  CreateInvoiceRequestBodyInvoicesRequestInvoiceType$outboundSchema
351
372
  .optional(),
352
373
  promo: z.string().optional(),
374
+ useCredits: z.boolean().default(false),
353
375
  }).transform((v) => {
354
376
  return remap$(v, {
355
377
  vendorCredentialId: "vendor_credential_id",
356
378
  credentialPricingIds: "credential_pricing_ids",
357
379
  invoiceType: "invoice_type",
380
+ useCredits: "use_credits",
358
381
  });
359
382
  });
360
383
 
@@ -432,6 +455,7 @@ export type Four$Outbound = {
432
455
  credential_pricing_ids?: Array<number> | null | undefined;
433
456
  invoice_type?: string | undefined;
434
457
  promo?: string | undefined;
458
+ use_credits: boolean;
435
459
  };
436
460
 
437
461
  /** @internal */
@@ -445,11 +469,13 @@ export const Four$outboundSchema: z.ZodType<Four$Outbound, z.ZodTypeDef, Four> =
445
469
  invoiceType: CreateInvoiceRequestBodyInvoicesInvoiceType$outboundSchema
446
470
  .optional(),
447
471
  promo: z.string().optional(),
472
+ useCredits: z.boolean().default(false),
448
473
  }).transform((v) => {
449
474
  return remap$(v, {
450
475
  systemId: "system_id",
451
476
  credentialPricingIds: "credential_pricing_ids",
452
477
  invoiceType: "invoice_type",
478
+ useCredits: "use_credits",
453
479
  });
454
480
  });
455
481
 
@@ -529,6 +555,7 @@ export type Three$Outbound = {
529
555
  credential_pricing_ids?: Array<number> | null | undefined;
530
556
  invoice_type?: string | undefined;
531
557
  promo?: string | undefined;
558
+ use_credits: boolean;
532
559
  };
533
560
 
534
561
  /** @internal */
@@ -543,11 +570,13 @@ export const Three$outboundSchema: z.ZodType<
543
570
  credentialPricingIds: z.nullable(z.array(z.number().int())).optional(),
544
571
  invoiceType: CreateInvoiceRequestBodyInvoiceType$outboundSchema.optional(),
545
572
  promo: z.string().optional(),
573
+ useCredits: z.boolean().default(false),
546
574
  }).transform((v) => {
547
575
  return remap$(v, {
548
576
  facilityId: "facility_id",
549
577
  credentialPricingIds: "credential_pricing_ids",
550
578
  invoiceType: "invoice_type",
579
+ useCredits: "use_credits",
551
580
  });
552
581
  });
553
582
 
@@ -622,6 +651,7 @@ export type CreateInvoiceRequestBody2$Outbound = {
622
651
  credential_pricing_ids?: Array<number> | null | undefined;
623
652
  invoice_type?: string | undefined;
624
653
  promo?: string | undefined;
654
+ use_credits: boolean;
625
655
  };
626
656
 
627
657
  /** @internal */
@@ -635,11 +665,13 @@ export const CreateInvoiceRequestBody2$outboundSchema: z.ZodType<
635
665
  credentialPricingIds: z.nullable(z.array(z.number().int())).optional(),
636
666
  invoiceType: RequestBodyInvoiceType$outboundSchema.optional(),
637
667
  promo: z.string().optional(),
668
+ useCredits: z.boolean().default(false),
638
669
  }).transform((v) => {
639
670
  return remap$(v, {
640
671
  companyId: "company_id",
641
672
  credentialPricingIds: "credential_pricing_ids",
642
673
  invoiceType: "invoice_type",
674
+ useCredits: "use_credits",
643
675
  });
644
676
  });
645
677
 
@@ -713,6 +745,7 @@ export type RequestBody1$Outbound = {
713
745
  credential_pricing_ids?: Array<number> | null | undefined;
714
746
  invoice_type?: string | undefined;
715
747
  promo?: string | undefined;
748
+ use_credits: boolean;
716
749
  };
717
750
 
718
751
  /** @internal */
@@ -726,11 +759,13 @@ export const RequestBody1$outboundSchema: z.ZodType<
726
759
  credentialPricingIds: z.nullable(z.array(z.number().int())).optional(),
727
760
  invoiceType: InvoiceType$outboundSchema.optional(),
728
761
  promo: z.string().optional(),
762
+ useCredits: z.boolean().default(false),
729
763
  }).transform((v) => {
730
764
  return remap$(v, {
731
765
  vendorId: "vendor_id",
732
766
  credentialPricingIds: "credential_pricing_ids",
733
767
  invoiceType: "invoice_type",
768
+ useCredits: "use_credits",
734
769
  });
735
770
  });
736
771