@paid-ai/paid-node 1.1.0 → 1.2.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 (161) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/Client.d.ts +9 -0
  3. package/dist/cjs/Client.js +29 -14
  4. package/dist/cjs/api/resources/checkouts/client/Client.d.ts +84 -0
  5. package/dist/cjs/api/resources/checkouts/client/Client.js +350 -0
  6. package/dist/cjs/api/resources/checkouts/client/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/checkouts/client/index.js +17 -0
  8. package/dist/cjs/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.d.ts +9 -0
  9. package/dist/cjs/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.js +3 -0
  10. package/dist/cjs/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.ts +23 -0
  11. package/dist/cjs/api/resources/checkouts/client/requests/CreateCheckoutRequest.js +3 -0
  12. package/dist/cjs/api/resources/checkouts/client/requests/GetCheckoutRequest.d.ts +9 -0
  13. package/dist/cjs/api/resources/checkouts/client/requests/GetCheckoutRequest.js +3 -0
  14. package/dist/cjs/api/resources/checkouts/client/requests/ListCheckoutsRequest.d.ts +10 -0
  15. package/dist/cjs/api/resources/checkouts/client/requests/ListCheckoutsRequest.js +3 -0
  16. package/dist/cjs/api/resources/checkouts/client/requests/index.d.ts +4 -0
  17. package/dist/cjs/api/resources/checkouts/client/requests/index.js +2 -0
  18. package/dist/cjs/api/resources/checkouts/index.d.ts +2 -0
  19. package/dist/cjs/api/resources/checkouts/index.js +18 -0
  20. package/dist/cjs/api/resources/checkouts/types/ListCheckoutsRequestStatus.d.ts +6 -0
  21. package/dist/cjs/api/resources/checkouts/types/ListCheckoutsRequestStatus.js +9 -0
  22. package/dist/cjs/api/resources/checkouts/types/index.d.ts +1 -0
  23. package/dist/cjs/api/resources/checkouts/types/index.js +17 -0
  24. package/dist/cjs/api/resources/credits/client/Client.d.ts +27 -0
  25. package/dist/cjs/api/resources/credits/client/Client.js +123 -0
  26. package/dist/cjs/api/resources/credits/client/index.d.ts +1 -0
  27. package/dist/cjs/api/resources/credits/client/index.js +2 -0
  28. package/dist/cjs/api/resources/credits/index.d.ts +1 -0
  29. package/dist/cjs/api/resources/credits/index.js +17 -0
  30. package/dist/cjs/api/resources/customerPortals/client/Client.d.ts +30 -0
  31. package/dist/cjs/api/resources/customerPortals/client/Client.js +133 -0
  32. package/dist/cjs/api/resources/customerPortals/client/index.d.ts +1 -0
  33. package/dist/cjs/api/resources/customerPortals/client/index.js +17 -0
  34. package/dist/cjs/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.d.ts +12 -0
  35. package/dist/cjs/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.js +3 -0
  36. package/dist/cjs/api/resources/customerPortals/client/requests/index.d.ts +1 -0
  37. package/dist/cjs/api/resources/customerPortals/client/requests/index.js +2 -0
  38. package/dist/cjs/api/resources/customerPortals/index.d.ts +1 -0
  39. package/dist/cjs/api/resources/customerPortals/index.js +17 -0
  40. package/dist/cjs/api/resources/customers/client/Client.d.ts +34 -0
  41. package/dist/cjs/api/resources/customers/client/Client.js +136 -0
  42. package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.d.ts +9 -0
  43. package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.js +3 -0
  44. package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.d.ts +9 -0
  45. package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.js +3 -0
  46. package/dist/cjs/api/resources/customers/client/requests/index.d.ts +2 -0
  47. package/dist/cjs/api/resources/index.d.ts +6 -0
  48. package/dist/cjs/api/resources/index.js +7 -1
  49. package/dist/cjs/api/resources/orders/client/requests/CreateOrderRequest.d.ts +11 -7
  50. package/dist/cjs/api/resources/orders/client/requests/UpdateOrderRequest.d.ts +10 -7
  51. package/dist/cjs/api/types/Checkout.d.ts +18 -0
  52. package/dist/cjs/api/types/Checkout.js +3 -0
  53. package/dist/cjs/api/types/CheckoutListResponse.d.ts +5 -0
  54. package/dist/cjs/api/types/CheckoutListResponse.js +3 -0
  55. package/dist/cjs/api/types/CheckoutProduct.d.ts +3 -0
  56. package/dist/cjs/api/types/CheckoutProduct.js +3 -0
  57. package/dist/cjs/api/types/CheckoutProductInput.d.ts +3 -0
  58. package/dist/cjs/api/types/CheckoutProductInput.js +3 -0
  59. package/dist/cjs/api/types/CheckoutStatus.d.ts +7 -0
  60. package/dist/cjs/api/types/CheckoutStatus.js +10 -0
  61. package/dist/cjs/api/types/CreateOrderLineAttributeRequest.d.ts +116 -1
  62. package/dist/cjs/api/types/CreateOrderLineAttributeRequest.js +70 -0
  63. package/dist/cjs/api/types/CreateOrderLineRequest.d.ts +3 -3
  64. package/dist/cjs/api/types/CreditBalance.d.ts +19 -0
  65. package/dist/cjs/api/types/CreditBalance.js +11 -0
  66. package/dist/cjs/api/types/CreditBalanceListResponse.d.ts +4 -0
  67. package/dist/cjs/api/types/CreditBalanceListResponse.js +3 -0
  68. package/dist/cjs/api/types/CreditCurrency.d.ts +9 -0
  69. package/dist/cjs/api/types/CreditCurrency.js +3 -0
  70. package/dist/cjs/api/types/CreditCurrencyListResponse.d.ts +4 -0
  71. package/dist/cjs/api/types/CreditCurrencyListResponse.js +3 -0
  72. package/dist/cjs/api/types/CustomerPortal.d.ts +10 -0
  73. package/dist/cjs/api/types/CustomerPortal.js +3 -0
  74. package/dist/cjs/api/types/CustomerPortalStatus.d.ts +5 -0
  75. package/dist/cjs/api/types/CustomerPortalStatus.js +8 -0
  76. package/dist/cjs/api/types/Order.d.ts +3 -0
  77. package/dist/cjs/api/types/index.d.ts +11 -0
  78. package/dist/cjs/api/types/index.js +11 -0
  79. package/dist/cjs/version.d.ts +1 -1
  80. package/dist/cjs/version.js +1 -1
  81. package/dist/esm/Client.d.mts +9 -0
  82. package/dist/esm/Client.mjs +17 -2
  83. package/dist/esm/api/resources/checkouts/client/Client.d.mts +84 -0
  84. package/dist/esm/api/resources/checkouts/client/Client.mjs +313 -0
  85. package/dist/esm/api/resources/checkouts/client/index.d.mts +1 -0
  86. package/dist/esm/api/resources/checkouts/client/index.mjs +1 -0
  87. package/dist/esm/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.d.mts +9 -0
  88. package/dist/esm/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.mjs +2 -0
  89. package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.mts +23 -0
  90. package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.mjs +2 -0
  91. package/dist/esm/api/resources/checkouts/client/requests/GetCheckoutRequest.d.mts +9 -0
  92. package/dist/esm/api/resources/checkouts/client/requests/GetCheckoutRequest.mjs +2 -0
  93. package/dist/esm/api/resources/checkouts/client/requests/ListCheckoutsRequest.d.mts +10 -0
  94. package/dist/esm/api/resources/checkouts/client/requests/ListCheckoutsRequest.mjs +2 -0
  95. package/dist/esm/api/resources/checkouts/client/requests/index.d.mts +4 -0
  96. package/dist/esm/api/resources/checkouts/client/requests/index.mjs +1 -0
  97. package/dist/esm/api/resources/checkouts/index.d.mts +2 -0
  98. package/dist/esm/api/resources/checkouts/index.mjs +2 -0
  99. package/dist/esm/api/resources/checkouts/types/ListCheckoutsRequestStatus.d.mts +6 -0
  100. package/dist/esm/api/resources/checkouts/types/ListCheckoutsRequestStatus.mjs +6 -0
  101. package/dist/esm/api/resources/checkouts/types/index.d.mts +1 -0
  102. package/dist/esm/api/resources/checkouts/types/index.mjs +1 -0
  103. package/dist/esm/api/resources/credits/client/Client.d.mts +27 -0
  104. package/dist/esm/api/resources/credits/client/Client.mjs +86 -0
  105. package/dist/esm/api/resources/credits/client/index.d.mts +1 -0
  106. package/dist/esm/api/resources/credits/client/index.mjs +1 -0
  107. package/dist/esm/api/resources/credits/index.d.mts +1 -0
  108. package/dist/esm/api/resources/credits/index.mjs +1 -0
  109. package/dist/esm/api/resources/customerPortals/client/Client.d.mts +30 -0
  110. package/dist/esm/api/resources/customerPortals/client/Client.mjs +96 -0
  111. package/dist/esm/api/resources/customerPortals/client/index.d.mts +1 -0
  112. package/dist/esm/api/resources/customerPortals/client/index.mjs +1 -0
  113. package/dist/esm/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.d.mts +12 -0
  114. package/dist/esm/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.mjs +2 -0
  115. package/dist/esm/api/resources/customerPortals/client/requests/index.d.mts +1 -0
  116. package/dist/esm/api/resources/customerPortals/client/requests/index.mjs +1 -0
  117. package/dist/esm/api/resources/customerPortals/index.d.mts +1 -0
  118. package/dist/esm/api/resources/customerPortals/index.mjs +1 -0
  119. package/dist/esm/api/resources/customers/client/Client.d.mts +34 -0
  120. package/dist/esm/api/resources/customers/client/Client.mjs +136 -0
  121. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.d.mts +9 -0
  122. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.mjs +2 -0
  123. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.d.mts +9 -0
  124. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.mjs +2 -0
  125. package/dist/esm/api/resources/customers/client/requests/index.d.mts +2 -0
  126. package/dist/esm/api/resources/index.d.mts +6 -0
  127. package/dist/esm/api/resources/index.mjs +6 -0
  128. package/dist/esm/api/resources/orders/client/requests/CreateOrderRequest.d.mts +11 -7
  129. package/dist/esm/api/resources/orders/client/requests/UpdateOrderRequest.d.mts +10 -7
  130. package/dist/esm/api/types/Checkout.d.mts +18 -0
  131. package/dist/esm/api/types/Checkout.mjs +2 -0
  132. package/dist/esm/api/types/CheckoutListResponse.d.mts +5 -0
  133. package/dist/esm/api/types/CheckoutListResponse.mjs +2 -0
  134. package/dist/esm/api/types/CheckoutProduct.d.mts +3 -0
  135. package/dist/esm/api/types/CheckoutProduct.mjs +2 -0
  136. package/dist/esm/api/types/CheckoutProductInput.d.mts +3 -0
  137. package/dist/esm/api/types/CheckoutProductInput.mjs +2 -0
  138. package/dist/esm/api/types/CheckoutStatus.d.mts +7 -0
  139. package/dist/esm/api/types/CheckoutStatus.mjs +7 -0
  140. package/dist/esm/api/types/CreateOrderLineAttributeRequest.d.mts +116 -1
  141. package/dist/esm/api/types/CreateOrderLineAttributeRequest.mjs +69 -1
  142. package/dist/esm/api/types/CreateOrderLineRequest.d.mts +3 -3
  143. package/dist/esm/api/types/CreditBalance.d.mts +19 -0
  144. package/dist/esm/api/types/CreditBalance.mjs +8 -0
  145. package/dist/esm/api/types/CreditBalanceListResponse.d.mts +4 -0
  146. package/dist/esm/api/types/CreditBalanceListResponse.mjs +2 -0
  147. package/dist/esm/api/types/CreditCurrency.d.mts +9 -0
  148. package/dist/esm/api/types/CreditCurrency.mjs +2 -0
  149. package/dist/esm/api/types/CreditCurrencyListResponse.d.mts +4 -0
  150. package/dist/esm/api/types/CreditCurrencyListResponse.mjs +2 -0
  151. package/dist/esm/api/types/CustomerPortal.d.mts +10 -0
  152. package/dist/esm/api/types/CustomerPortal.mjs +2 -0
  153. package/dist/esm/api/types/CustomerPortalStatus.d.mts +5 -0
  154. package/dist/esm/api/types/CustomerPortalStatus.mjs +5 -0
  155. package/dist/esm/api/types/Order.d.mts +3 -0
  156. package/dist/esm/api/types/index.d.mts +11 -0
  157. package/dist/esm/api/types/index.mjs +11 -0
  158. package/dist/esm/version.d.mts +1 -1
  159. package/dist/esm/version.mjs +1 -1
  160. package/package.json +3 -3
  161. package/reference.md +512 -0
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CustomerPortalStatus = void 0;
5
+ exports.CustomerPortalStatus = {
6
+ Active: "active",
7
+ Expired: "expired",
8
+ };
@@ -23,5 +23,8 @@ export interface Order {
23
23
  metadata: Record<string, unknown> | null;
24
24
  showPaymentLink: boolean | null;
25
25
  showBankDetails: boolean | null;
26
+ autoPostInvoices: boolean | null;
27
+ autoSendBillingEmails: boolean | null;
28
+ autoSendPaymentEmails: boolean | null;
26
29
  version: number;
27
30
  }
@@ -1,10 +1,19 @@
1
1
  export * from "./Attribution.js";
2
2
  export * from "./BulkSignalsResponse.js";
3
+ export * from "./Checkout.js";
4
+ export * from "./CheckoutListResponse.js";
5
+ export * from "./CheckoutProduct.js";
6
+ export * from "./CheckoutProductInput.js";
7
+ export * from "./CheckoutStatus.js";
3
8
  export * from "./Contact.js";
4
9
  export * from "./ContactBillingAddress.js";
5
10
  export * from "./ContactListResponse.js";
6
11
  export * from "./CreateOrderLineAttributeRequest.js";
7
12
  export * from "./CreateOrderLineRequest.js";
13
+ export * from "./CreditBalance.js";
14
+ export * from "./CreditBalanceListResponse.js";
15
+ export * from "./CreditCurrency.js";
16
+ export * from "./CreditCurrencyListResponse.js";
8
17
  export * from "./Customer.js";
9
18
  export * from "./CustomerAttribution.js";
10
19
  export * from "./CustomerBillingAddress.js";
@@ -12,6 +21,8 @@ export * from "./CustomerByExternalId.js";
12
21
  export * from "./CustomerById.js";
13
22
  export * from "./CustomerCreationState.js";
14
23
  export * from "./CustomerListResponse.js";
24
+ export * from "./CustomerPortal.js";
25
+ export * from "./CustomerPortalStatus.js";
15
26
  export * from "./EmptyResponse.js";
16
27
  export * from "./ErrorResponse.js";
17
28
  export * from "./Invoice.js";
@@ -16,11 +16,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Attribution.js"), exports);
18
18
  __exportStar(require("./BulkSignalsResponse.js"), exports);
19
+ __exportStar(require("./Checkout.js"), exports);
20
+ __exportStar(require("./CheckoutListResponse.js"), exports);
21
+ __exportStar(require("./CheckoutProduct.js"), exports);
22
+ __exportStar(require("./CheckoutProductInput.js"), exports);
23
+ __exportStar(require("./CheckoutStatus.js"), exports);
19
24
  __exportStar(require("./Contact.js"), exports);
20
25
  __exportStar(require("./ContactBillingAddress.js"), exports);
21
26
  __exportStar(require("./ContactListResponse.js"), exports);
22
27
  __exportStar(require("./CreateOrderLineAttributeRequest.js"), exports);
23
28
  __exportStar(require("./CreateOrderLineRequest.js"), exports);
29
+ __exportStar(require("./CreditBalance.js"), exports);
30
+ __exportStar(require("./CreditBalanceListResponse.js"), exports);
31
+ __exportStar(require("./CreditCurrency.js"), exports);
32
+ __exportStar(require("./CreditCurrencyListResponse.js"), exports);
24
33
  __exportStar(require("./Customer.js"), exports);
25
34
  __exportStar(require("./CustomerAttribution.js"), exports);
26
35
  __exportStar(require("./CustomerBillingAddress.js"), exports);
@@ -28,6 +37,8 @@ __exportStar(require("./CustomerByExternalId.js"), exports);
28
37
  __exportStar(require("./CustomerById.js"), exports);
29
38
  __exportStar(require("./CustomerCreationState.js"), exports);
30
39
  __exportStar(require("./CustomerListResponse.js"), exports);
40
+ __exportStar(require("./CustomerPortal.js"), exports);
41
+ __exportStar(require("./CustomerPortalStatus.js"), exports);
31
42
  __exportStar(require("./EmptyResponse.js"), exports);
32
43
  __exportStar(require("./ErrorResponse.js"), exports);
33
44
  __exportStar(require("./Invoice.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.1.0";
1
+ export declare const SDK_VERSION = "1.2.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.1.0";
4
+ exports.SDK_VERSION = "1.2.0";
@@ -1,4 +1,7 @@
1
+ import { Checkouts } from "./api/resources/checkouts/client/Client.mjs";
1
2
  import { Contacts } from "./api/resources/contacts/client/Client.mjs";
3
+ import { Credits } from "./api/resources/credits/client/Client.mjs";
4
+ import { CustomerPortals } from "./api/resources/customerPortals/client/Client.mjs";
2
5
  import { Customers } from "./api/resources/customers/client/Client.mjs";
3
6
  import { Invoices } from "./api/resources/invoices/client/Client.mjs";
4
7
  import { Orders } from "./api/resources/orders/client/Client.mjs";
@@ -19,6 +22,9 @@ export declare class PaidClient {
19
22
  protected _orders: Orders | undefined;
20
23
  protected _invoices: Invoices | undefined;
21
24
  protected _signals: Signals | undefined;
25
+ protected _credits: Credits | undefined;
26
+ protected _checkouts: Checkouts | undefined;
27
+ protected _customerPortals: CustomerPortals | undefined;
22
28
  constructor(_options: PaidClient.Options);
23
29
  get products(): Products;
24
30
  get customers(): Customers;
@@ -26,4 +32,7 @@ export declare class PaidClient {
26
32
  get orders(): Orders;
27
33
  get invoices(): Invoices;
28
34
  get signals(): Signals;
35
+ get credits(): Credits;
36
+ get checkouts(): Checkouts;
37
+ get customerPortals(): CustomerPortals;
29
38
  }
@@ -1,5 +1,8 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
+ import { Checkouts } from "./api/resources/checkouts/client/Client.mjs";
2
3
  import { Contacts } from "./api/resources/contacts/client/Client.mjs";
4
+ import { Credits } from "./api/resources/credits/client/Client.mjs";
5
+ import { CustomerPortals } from "./api/resources/customerPortals/client/Client.mjs";
3
6
  import { Customers } from "./api/resources/customers/client/Client.mjs";
4
7
  import { Invoices } from "./api/resources/invoices/client/Client.mjs";
5
8
  import { Orders } from "./api/resources/orders/client/Client.mjs";
@@ -12,8 +15,8 @@ export class PaidClient {
12
15
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
13
16
  "X-Fern-Language": "JavaScript",
14
17
  "X-Fern-SDK-Name": "@paid-ai/paid-node",
15
- "X-Fern-SDK-Version": "1.1.0",
16
- "User-Agent": "@paid-ai/paid-node/1.1.0",
18
+ "X-Fern-SDK-Version": "1.2.0",
19
+ "User-Agent": "@paid-ai/paid-node/1.2.0",
17
20
  "X-Fern-Runtime": core.RUNTIME.type,
18
21
  "X-Fern-Runtime-Version": core.RUNTIME.version,
19
22
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -42,4 +45,16 @@ export class PaidClient {
42
45
  var _a;
43
46
  return ((_a = this._signals) !== null && _a !== void 0 ? _a : (this._signals = new Signals(this._options)));
44
47
  }
48
+ get credits() {
49
+ var _a;
50
+ return ((_a = this._credits) !== null && _a !== void 0 ? _a : (this._credits = new Credits(this._options)));
51
+ }
52
+ get checkouts() {
53
+ var _a;
54
+ return ((_a = this._checkouts) !== null && _a !== void 0 ? _a : (this._checkouts = new Checkouts(this._options)));
55
+ }
56
+ get customerPortals() {
57
+ var _a;
58
+ return ((_a = this._customerPortals) !== null && _a !== void 0 ? _a : (this._customerPortals = new CustomerPortals(this._options)));
59
+ }
45
60
  }
@@ -0,0 +1,84 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
+ import * as core from "../../../../core/index.mjs";
3
+ import * as Paid from "../../../index.mjs";
4
+ export declare namespace Checkouts {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class Checkouts {
11
+ protected readonly _options: Checkouts.Options;
12
+ constructor(_options: Checkouts.Options);
13
+ /**
14
+ * Get a list of checkouts for the organization
15
+ *
16
+ * @param {Paid.ListCheckoutsRequest} request
17
+ * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link Paid.BadRequestError}
20
+ * @throws {@link Paid.ForbiddenError}
21
+ * @throws {@link Paid.InternalServerError}
22
+ *
23
+ * @example
24
+ * await client.checkouts.listCheckouts()
25
+ */
26
+ listCheckouts(request?: Paid.ListCheckoutsRequest, requestOptions?: Checkouts.RequestOptions): core.HttpResponsePromise<Paid.CheckoutListResponse>;
27
+ private __listCheckouts;
28
+ /**
29
+ * Creates a checkout link that generates a URL for a customer to complete a purchase
30
+ *
31
+ * @param {Paid.CreateCheckoutRequest} request
32
+ * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
33
+ *
34
+ * @throws {@link Paid.BadRequestError}
35
+ * @throws {@link Paid.ForbiddenError}
36
+ * @throws {@link Paid.NotFoundError}
37
+ * @throws {@link Paid.InternalServerError}
38
+ *
39
+ * @example
40
+ * await client.checkouts.createCheckout({
41
+ * products: [{
42
+ * id: "id"
43
+ * }],
44
+ * successUrl: "successUrl"
45
+ * })
46
+ */
47
+ createCheckout(request: Paid.CreateCheckoutRequest, requestOptions?: Checkouts.RequestOptions): core.HttpResponsePromise<Paid.Checkout>;
48
+ private __createCheckout;
49
+ /**
50
+ * Get a checkout by ID
51
+ *
52
+ * @param {Paid.GetCheckoutRequest} request
53
+ * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
54
+ *
55
+ * @throws {@link Paid.ForbiddenError}
56
+ * @throws {@link Paid.NotFoundError}
57
+ * @throws {@link Paid.InternalServerError}
58
+ *
59
+ * @example
60
+ * await client.checkouts.getCheckout({
61
+ * id: "id"
62
+ * })
63
+ */
64
+ getCheckout(request: Paid.GetCheckoutRequest, requestOptions?: Checkouts.RequestOptions): core.HttpResponsePromise<Paid.Checkout>;
65
+ private __getCheckout;
66
+ /**
67
+ * Archive a checkout by ID
68
+ *
69
+ * @param {Paid.ArchiveCheckoutRequest} request
70
+ * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
71
+ *
72
+ * @throws {@link Paid.ForbiddenError}
73
+ * @throws {@link Paid.NotFoundError}
74
+ * @throws {@link Paid.InternalServerError}
75
+ *
76
+ * @example
77
+ * await client.checkouts.archiveCheckout({
78
+ * id: "id"
79
+ * })
80
+ */
81
+ archiveCheckout(request: Paid.ArchiveCheckoutRequest, requestOptions?: Checkouts.RequestOptions): core.HttpResponsePromise<Paid.EmptyResponse>;
82
+ private __archiveCheckout;
83
+ protected _getAuthorizationHeader(): Promise<string>;
84
+ }
@@ -0,0 +1,313 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
12
+ import * as core from "../../../../core/index.mjs";
13
+ import * as environments from "../../../../environments.mjs";
14
+ import * as errors from "../../../../errors/index.mjs";
15
+ import * as Paid from "../../../index.mjs";
16
+ export class Checkouts {
17
+ constructor(_options) {
18
+ this._options = _options;
19
+ }
20
+ /**
21
+ * Get a list of checkouts for the organization
22
+ *
23
+ * @param {Paid.ListCheckoutsRequest} request
24
+ * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
25
+ *
26
+ * @throws {@link Paid.BadRequestError}
27
+ * @throws {@link Paid.ForbiddenError}
28
+ * @throws {@link Paid.InternalServerError}
29
+ *
30
+ * @example
31
+ * await client.checkouts.listCheckouts()
32
+ */
33
+ listCheckouts(request = {}, requestOptions) {
34
+ return core.HttpResponsePromise.fromPromise(this.__listCheckouts(request, requestOptions));
35
+ }
36
+ __listCheckouts() {
37
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
38
+ var _a, _b, _c, _d, _e, _f, _g, _h;
39
+ const { limit, offset, status } = request;
40
+ const _queryParams = {};
41
+ if (limit != null) {
42
+ _queryParams.limit = limit.toString();
43
+ }
44
+ if (offset != null) {
45
+ _queryParams.offset = offset.toString();
46
+ }
47
+ if (status != null) {
48
+ _queryParams.status = status;
49
+ }
50
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
51
+ const _response = yield core.fetcher({
52
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, "checkouts/"),
53
+ method: "GET",
54
+ headers: _headers,
55
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
56
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
57
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
58
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
59
+ });
60
+ if (_response.ok) {
61
+ return { data: _response.body, rawResponse: _response.rawResponse };
62
+ }
63
+ if (_response.error.reason === "status-code") {
64
+ switch (_response.error.statusCode) {
65
+ case 400:
66
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
67
+ case 403:
68
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
69
+ case 500:
70
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
71
+ default:
72
+ throw new errors.PaidError({
73
+ statusCode: _response.error.statusCode,
74
+ body: _response.error.body,
75
+ rawResponse: _response.rawResponse,
76
+ });
77
+ }
78
+ }
79
+ switch (_response.error.reason) {
80
+ case "non-json":
81
+ throw new errors.PaidError({
82
+ statusCode: _response.error.statusCode,
83
+ body: _response.error.rawBody,
84
+ rawResponse: _response.rawResponse,
85
+ });
86
+ case "timeout":
87
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /checkouts/.");
88
+ case "unknown":
89
+ throw new errors.PaidError({
90
+ message: _response.error.errorMessage,
91
+ rawResponse: _response.rawResponse,
92
+ });
93
+ }
94
+ });
95
+ }
96
+ /**
97
+ * Creates a checkout link that generates a URL for a customer to complete a purchase
98
+ *
99
+ * @param {Paid.CreateCheckoutRequest} request
100
+ * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
101
+ *
102
+ * @throws {@link Paid.BadRequestError}
103
+ * @throws {@link Paid.ForbiddenError}
104
+ * @throws {@link Paid.NotFoundError}
105
+ * @throws {@link Paid.InternalServerError}
106
+ *
107
+ * @example
108
+ * await client.checkouts.createCheckout({
109
+ * products: [{
110
+ * id: "id"
111
+ * }],
112
+ * successUrl: "successUrl"
113
+ * })
114
+ */
115
+ createCheckout(request, requestOptions) {
116
+ return core.HttpResponsePromise.fromPromise(this.__createCheckout(request, requestOptions));
117
+ }
118
+ __createCheckout(request, requestOptions) {
119
+ return __awaiter(this, void 0, void 0, function* () {
120
+ var _a, _b, _c, _d, _e, _f, _g, _h;
121
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
122
+ const _response = yield core.fetcher({
123
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, "checkouts/"),
124
+ method: "POST",
125
+ headers: _headers,
126
+ contentType: "application/json",
127
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
128
+ requestType: "json",
129
+ body: request,
130
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
131
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
132
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
133
+ });
134
+ if (_response.ok) {
135
+ return { data: _response.body, rawResponse: _response.rawResponse };
136
+ }
137
+ if (_response.error.reason === "status-code") {
138
+ switch (_response.error.statusCode) {
139
+ case 400:
140
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
141
+ case 403:
142
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
143
+ case 404:
144
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
145
+ case 500:
146
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
147
+ default:
148
+ throw new errors.PaidError({
149
+ statusCode: _response.error.statusCode,
150
+ body: _response.error.body,
151
+ rawResponse: _response.rawResponse,
152
+ });
153
+ }
154
+ }
155
+ switch (_response.error.reason) {
156
+ case "non-json":
157
+ throw new errors.PaidError({
158
+ statusCode: _response.error.statusCode,
159
+ body: _response.error.rawBody,
160
+ rawResponse: _response.rawResponse,
161
+ });
162
+ case "timeout":
163
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /checkouts/.");
164
+ case "unknown":
165
+ throw new errors.PaidError({
166
+ message: _response.error.errorMessage,
167
+ rawResponse: _response.rawResponse,
168
+ });
169
+ }
170
+ });
171
+ }
172
+ /**
173
+ * Get a checkout by ID
174
+ *
175
+ * @param {Paid.GetCheckoutRequest} request
176
+ * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
177
+ *
178
+ * @throws {@link Paid.ForbiddenError}
179
+ * @throws {@link Paid.NotFoundError}
180
+ * @throws {@link Paid.InternalServerError}
181
+ *
182
+ * @example
183
+ * await client.checkouts.getCheckout({
184
+ * id: "id"
185
+ * })
186
+ */
187
+ getCheckout(request, requestOptions) {
188
+ return core.HttpResponsePromise.fromPromise(this.__getCheckout(request, requestOptions));
189
+ }
190
+ __getCheckout(request, requestOptions) {
191
+ return __awaiter(this, void 0, void 0, function* () {
192
+ var _a, _b, _c, _d, _e, _f, _g, _h;
193
+ const { id } = request;
194
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
195
+ const _response = yield core.fetcher({
196
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `checkouts/${core.url.encodePathParam(id)}`),
197
+ method: "GET",
198
+ headers: _headers,
199
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
200
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
201
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
202
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
203
+ });
204
+ if (_response.ok) {
205
+ return { data: _response.body, rawResponse: _response.rawResponse };
206
+ }
207
+ if (_response.error.reason === "status-code") {
208
+ switch (_response.error.statusCode) {
209
+ case 403:
210
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
211
+ case 404:
212
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
213
+ case 500:
214
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
215
+ default:
216
+ throw new errors.PaidError({
217
+ statusCode: _response.error.statusCode,
218
+ body: _response.error.body,
219
+ rawResponse: _response.rawResponse,
220
+ });
221
+ }
222
+ }
223
+ switch (_response.error.reason) {
224
+ case "non-json":
225
+ throw new errors.PaidError({
226
+ statusCode: _response.error.statusCode,
227
+ body: _response.error.rawBody,
228
+ rawResponse: _response.rawResponse,
229
+ });
230
+ case "timeout":
231
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /checkouts/{id}.");
232
+ case "unknown":
233
+ throw new errors.PaidError({
234
+ message: _response.error.errorMessage,
235
+ rawResponse: _response.rawResponse,
236
+ });
237
+ }
238
+ });
239
+ }
240
+ /**
241
+ * Archive a checkout by ID
242
+ *
243
+ * @param {Paid.ArchiveCheckoutRequest} request
244
+ * @param {Checkouts.RequestOptions} requestOptions - Request-specific configuration.
245
+ *
246
+ * @throws {@link Paid.ForbiddenError}
247
+ * @throws {@link Paid.NotFoundError}
248
+ * @throws {@link Paid.InternalServerError}
249
+ *
250
+ * @example
251
+ * await client.checkouts.archiveCheckout({
252
+ * id: "id"
253
+ * })
254
+ */
255
+ archiveCheckout(request, requestOptions) {
256
+ return core.HttpResponsePromise.fromPromise(this.__archiveCheckout(request, requestOptions));
257
+ }
258
+ __archiveCheckout(request, requestOptions) {
259
+ return __awaiter(this, void 0, void 0, function* () {
260
+ var _a, _b, _c, _d, _e, _f, _g, _h;
261
+ const { id } = request;
262
+ const _headers = mergeHeaders((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
263
+ const _response = yield core.fetcher({
264
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.PaidEnvironment.Default, `checkouts/${core.url.encodePathParam(id)}`),
265
+ method: "DELETE",
266
+ headers: _headers,
267
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
268
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
269
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
270
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
271
+ });
272
+ if (_response.ok) {
273
+ return { data: _response.body, rawResponse: _response.rawResponse };
274
+ }
275
+ if (_response.error.reason === "status-code") {
276
+ switch (_response.error.statusCode) {
277
+ case 403:
278
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
279
+ case 404:
280
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
281
+ case 500:
282
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
283
+ default:
284
+ throw new errors.PaidError({
285
+ statusCode: _response.error.statusCode,
286
+ body: _response.error.body,
287
+ rawResponse: _response.rawResponse,
288
+ });
289
+ }
290
+ }
291
+ switch (_response.error.reason) {
292
+ case "non-json":
293
+ throw new errors.PaidError({
294
+ statusCode: _response.error.statusCode,
295
+ body: _response.error.rawBody,
296
+ rawResponse: _response.rawResponse,
297
+ });
298
+ case "timeout":
299
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling DELETE /checkouts/{id}.");
300
+ case "unknown":
301
+ throw new errors.PaidError({
302
+ message: _response.error.errorMessage,
303
+ rawResponse: _response.rawResponse,
304
+ });
305
+ }
306
+ });
307
+ }
308
+ _getAuthorizationHeader() {
309
+ return __awaiter(this, void 0, void 0, function* () {
310
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
311
+ });
312
+ }
313
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface ArchiveCheckoutRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,23 @@
1
+ import type * as Paid from "../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * products: [{
6
+ * id: "id"
7
+ * }],
8
+ * successUrl: "successUrl"
9
+ * }
10
+ */
11
+ export interface CreateCheckoutRequest {
12
+ products: Paid.CheckoutProductInput[];
13
+ customerId?: string;
14
+ /** External customer identifier. Creates the customer on first use, resolves to the existing customer on subsequent uses. */
15
+ externalCustomerId?: string;
16
+ successUrl: string;
17
+ cancelUrl?: string;
18
+ expiresAt?: string;
19
+ metadata?: Record<string, unknown>;
20
+ collectAddress?: boolean;
21
+ collectPhone?: boolean;
22
+ singleUse?: boolean;
23
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface GetCheckoutRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,10 @@
1
+ import type * as Paid from "../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface ListCheckoutsRequest {
7
+ limit?: number;
8
+ offset?: number;
9
+ status?: Paid.ListCheckoutsRequestStatus;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ export type { ArchiveCheckoutRequest } from "./ArchiveCheckoutRequest.mjs";
2
+ export type { CreateCheckoutRequest } from "./CreateCheckoutRequest.mjs";
3
+ export type { GetCheckoutRequest } from "./GetCheckoutRequest.mjs";
4
+ export type { ListCheckoutsRequest } from "./ListCheckoutsRequest.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";