@paid-ai/paid-node 1.0.1 → 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 (181) hide show
  1. package/README.md +6 -2
  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/contacts/client/Client.d.ts +0 -2
  25. package/dist/cjs/api/resources/contacts/client/Client.js +0 -2
  26. package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.d.ts +13 -4
  27. package/dist/cjs/api/resources/contacts/client/requests/CreateContactRequest.js +11 -0
  28. package/dist/cjs/api/resources/credits/client/Client.d.ts +27 -0
  29. package/dist/cjs/api/resources/credits/client/Client.js +123 -0
  30. package/dist/cjs/api/resources/credits/client/index.d.ts +1 -0
  31. package/dist/cjs/api/resources/credits/client/index.js +2 -0
  32. package/dist/cjs/api/resources/credits/index.d.ts +1 -0
  33. package/dist/cjs/api/resources/credits/index.js +17 -0
  34. package/dist/cjs/api/resources/customerPortals/client/Client.d.ts +30 -0
  35. package/dist/cjs/api/resources/customerPortals/client/Client.js +133 -0
  36. package/dist/cjs/api/resources/customerPortals/client/index.d.ts +1 -0
  37. package/dist/cjs/api/resources/customerPortals/client/index.js +17 -0
  38. package/dist/cjs/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.d.ts +12 -0
  39. package/dist/cjs/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.js +3 -0
  40. package/dist/cjs/api/resources/customerPortals/client/requests/index.d.ts +1 -0
  41. package/dist/cjs/api/resources/customerPortals/client/requests/index.js +2 -0
  42. package/dist/cjs/api/resources/customerPortals/index.d.ts +1 -0
  43. package/dist/cjs/api/resources/customerPortals/index.js +17 -0
  44. package/dist/cjs/api/resources/customers/client/Client.d.ts +34 -0
  45. package/dist/cjs/api/resources/customers/client/Client.js +136 -0
  46. package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.d.ts +9 -0
  47. package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.js +3 -0
  48. package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.d.ts +9 -0
  49. package/dist/cjs/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.js +3 -0
  50. package/dist/cjs/api/resources/customers/client/requests/index.d.ts +2 -0
  51. package/dist/cjs/api/resources/index.d.ts +6 -0
  52. package/dist/cjs/api/resources/index.js +7 -1
  53. package/dist/cjs/api/resources/orders/client/requests/CreateOrderRequest.d.ts +12 -7
  54. package/dist/cjs/api/resources/orders/client/requests/UpdateOrderRequest.d.ts +10 -7
  55. package/dist/cjs/api/types/Checkout.d.ts +18 -0
  56. package/dist/cjs/api/types/Checkout.js +3 -0
  57. package/dist/cjs/api/types/CheckoutListResponse.d.ts +5 -0
  58. package/dist/cjs/api/types/CheckoutListResponse.js +3 -0
  59. package/dist/cjs/api/types/CheckoutProduct.d.ts +3 -0
  60. package/dist/cjs/api/types/CheckoutProduct.js +3 -0
  61. package/dist/cjs/api/types/CheckoutProductInput.d.ts +3 -0
  62. package/dist/cjs/api/types/CheckoutProductInput.js +3 -0
  63. package/dist/cjs/api/types/CheckoutStatus.d.ts +7 -0
  64. package/dist/cjs/api/types/CheckoutStatus.js +10 -0
  65. package/dist/cjs/api/types/Contact.d.ts +11 -0
  66. package/dist/cjs/api/types/Contact.js +11 -0
  67. package/dist/cjs/api/types/CreateOrderLineAttributeRequest.d.ts +120 -0
  68. package/dist/cjs/api/types/CreateOrderLineAttributeRequest.js +73 -0
  69. package/dist/cjs/api/types/CreateOrderLineRequest.d.ts +9 -0
  70. package/dist/cjs/api/types/CreateOrderLineRequest.js +3 -0
  71. package/dist/cjs/api/types/CreditBalance.d.ts +19 -0
  72. package/dist/cjs/api/types/CreditBalance.js +11 -0
  73. package/dist/cjs/api/types/CreditBalanceListResponse.d.ts +4 -0
  74. package/dist/cjs/api/types/CreditBalanceListResponse.js +3 -0
  75. package/dist/cjs/api/types/CreditCurrency.d.ts +9 -0
  76. package/dist/cjs/api/types/CreditCurrency.js +3 -0
  77. package/dist/cjs/api/types/CreditCurrencyListResponse.d.ts +4 -0
  78. package/dist/cjs/api/types/CreditCurrencyListResponse.js +3 -0
  79. package/dist/cjs/api/types/CustomerPortal.d.ts +10 -0
  80. package/dist/cjs/api/types/CustomerPortal.js +3 -0
  81. package/dist/cjs/api/types/CustomerPortalStatus.d.ts +5 -0
  82. package/dist/cjs/api/types/CustomerPortalStatus.js +8 -0
  83. package/dist/cjs/api/types/Order.d.ts +3 -0
  84. package/dist/cjs/api/types/Signal.d.ts +2 -0
  85. package/dist/cjs/api/types/UpdateContactRequest.d.ts +11 -0
  86. package/dist/cjs/api/types/UpdateContactRequest.js +11 -0
  87. package/dist/cjs/api/types/index.d.ts +13 -0
  88. package/dist/cjs/api/types/index.js +13 -0
  89. package/dist/cjs/version.d.ts +1 -1
  90. package/dist/cjs/version.js +1 -1
  91. package/dist/esm/Client.d.mts +9 -0
  92. package/dist/esm/Client.mjs +17 -2
  93. package/dist/esm/api/resources/checkouts/client/Client.d.mts +84 -0
  94. package/dist/esm/api/resources/checkouts/client/Client.mjs +313 -0
  95. package/dist/esm/api/resources/checkouts/client/index.d.mts +1 -0
  96. package/dist/esm/api/resources/checkouts/client/index.mjs +1 -0
  97. package/dist/esm/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.d.mts +9 -0
  98. package/dist/esm/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.mjs +2 -0
  99. package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.mts +23 -0
  100. package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.mjs +2 -0
  101. package/dist/esm/api/resources/checkouts/client/requests/GetCheckoutRequest.d.mts +9 -0
  102. package/dist/esm/api/resources/checkouts/client/requests/GetCheckoutRequest.mjs +2 -0
  103. package/dist/esm/api/resources/checkouts/client/requests/ListCheckoutsRequest.d.mts +10 -0
  104. package/dist/esm/api/resources/checkouts/client/requests/ListCheckoutsRequest.mjs +2 -0
  105. package/dist/esm/api/resources/checkouts/client/requests/index.d.mts +4 -0
  106. package/dist/esm/api/resources/checkouts/client/requests/index.mjs +1 -0
  107. package/dist/esm/api/resources/checkouts/index.d.mts +2 -0
  108. package/dist/esm/api/resources/checkouts/index.mjs +2 -0
  109. package/dist/esm/api/resources/checkouts/types/ListCheckoutsRequestStatus.d.mts +6 -0
  110. package/dist/esm/api/resources/checkouts/types/ListCheckoutsRequestStatus.mjs +6 -0
  111. package/dist/esm/api/resources/checkouts/types/index.d.mts +1 -0
  112. package/dist/esm/api/resources/checkouts/types/index.mjs +1 -0
  113. package/dist/esm/api/resources/contacts/client/Client.d.mts +0 -2
  114. package/dist/esm/api/resources/contacts/client/Client.mjs +0 -2
  115. package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.d.mts +13 -4
  116. package/dist/esm/api/resources/contacts/client/requests/CreateContactRequest.mjs +10 -1
  117. package/dist/esm/api/resources/credits/client/Client.d.mts +27 -0
  118. package/dist/esm/api/resources/credits/client/Client.mjs +86 -0
  119. package/dist/esm/api/resources/credits/client/index.d.mts +1 -0
  120. package/dist/esm/api/resources/credits/client/index.mjs +1 -0
  121. package/dist/esm/api/resources/credits/index.d.mts +1 -0
  122. package/dist/esm/api/resources/credits/index.mjs +1 -0
  123. package/dist/esm/api/resources/customerPortals/client/Client.d.mts +30 -0
  124. package/dist/esm/api/resources/customerPortals/client/Client.mjs +96 -0
  125. package/dist/esm/api/resources/customerPortals/client/index.d.mts +1 -0
  126. package/dist/esm/api/resources/customerPortals/client/index.mjs +1 -0
  127. package/dist/esm/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.d.mts +12 -0
  128. package/dist/esm/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.mjs +2 -0
  129. package/dist/esm/api/resources/customerPortals/client/requests/index.d.mts +1 -0
  130. package/dist/esm/api/resources/customerPortals/client/requests/index.mjs +1 -0
  131. package/dist/esm/api/resources/customerPortals/index.d.mts +1 -0
  132. package/dist/esm/api/resources/customerPortals/index.mjs +1 -0
  133. package/dist/esm/api/resources/customers/client/Client.d.mts +34 -0
  134. package/dist/esm/api/resources/customers/client/Client.mjs +136 -0
  135. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.d.mts +9 -0
  136. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.mjs +2 -0
  137. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.d.mts +9 -0
  138. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.mjs +2 -0
  139. package/dist/esm/api/resources/customers/client/requests/index.d.mts +2 -0
  140. package/dist/esm/api/resources/index.d.mts +6 -0
  141. package/dist/esm/api/resources/index.mjs +6 -0
  142. package/dist/esm/api/resources/orders/client/requests/CreateOrderRequest.d.mts +12 -7
  143. package/dist/esm/api/resources/orders/client/requests/UpdateOrderRequest.d.mts +10 -7
  144. package/dist/esm/api/types/Checkout.d.mts +18 -0
  145. package/dist/esm/api/types/Checkout.mjs +2 -0
  146. package/dist/esm/api/types/CheckoutListResponse.d.mts +5 -0
  147. package/dist/esm/api/types/CheckoutListResponse.mjs +2 -0
  148. package/dist/esm/api/types/CheckoutProduct.d.mts +3 -0
  149. package/dist/esm/api/types/CheckoutProduct.mjs +2 -0
  150. package/dist/esm/api/types/CheckoutProductInput.d.mts +3 -0
  151. package/dist/esm/api/types/CheckoutProductInput.mjs +2 -0
  152. package/dist/esm/api/types/CheckoutStatus.d.mts +7 -0
  153. package/dist/esm/api/types/CheckoutStatus.mjs +7 -0
  154. package/dist/esm/api/types/Contact.d.mts +11 -0
  155. package/dist/esm/api/types/Contact.mjs +10 -1
  156. package/dist/esm/api/types/CreateOrderLineAttributeRequest.d.mts +120 -0
  157. package/dist/esm/api/types/CreateOrderLineAttributeRequest.mjs +70 -0
  158. package/dist/esm/api/types/CreateOrderLineRequest.d.mts +9 -0
  159. package/dist/esm/api/types/CreateOrderLineRequest.mjs +2 -0
  160. package/dist/esm/api/types/CreditBalance.d.mts +19 -0
  161. package/dist/esm/api/types/CreditBalance.mjs +8 -0
  162. package/dist/esm/api/types/CreditBalanceListResponse.d.mts +4 -0
  163. package/dist/esm/api/types/CreditBalanceListResponse.mjs +2 -0
  164. package/dist/esm/api/types/CreditCurrency.d.mts +9 -0
  165. package/dist/esm/api/types/CreditCurrency.mjs +2 -0
  166. package/dist/esm/api/types/CreditCurrencyListResponse.d.mts +4 -0
  167. package/dist/esm/api/types/CreditCurrencyListResponse.mjs +2 -0
  168. package/dist/esm/api/types/CustomerPortal.d.mts +10 -0
  169. package/dist/esm/api/types/CustomerPortal.mjs +2 -0
  170. package/dist/esm/api/types/CustomerPortalStatus.d.mts +5 -0
  171. package/dist/esm/api/types/CustomerPortalStatus.mjs +5 -0
  172. package/dist/esm/api/types/Order.d.mts +3 -0
  173. package/dist/esm/api/types/Signal.d.mts +2 -0
  174. package/dist/esm/api/types/UpdateContactRequest.d.mts +11 -0
  175. package/dist/esm/api/types/UpdateContactRequest.mjs +10 -1
  176. package/dist/esm/api/types/index.d.mts +13 -0
  177. package/dist/esm/api/types/index.mjs +13 -0
  178. package/dist/esm/version.d.mts +1 -1
  179. package/dist/esm/version.mjs +1 -1
  180. package/package.json +215 -215
  181. package/reference.md +512 -2
@@ -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";
@@ -0,0 +1,6 @@
1
+ export declare const ListCheckoutsRequestStatus: {
2
+ readonly Active: "active";
3
+ readonly Completed: "completed";
4
+ readonly Archived: "archived";
5
+ };
6
+ export type ListCheckoutsRequestStatus = (typeof ListCheckoutsRequestStatus)[keyof typeof ListCheckoutsRequestStatus];
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const ListCheckoutsRequestStatus = {
3
+ Active: "active",
4
+ Completed: "completed",
5
+ Archived: "archived",
6
+ };
@@ -0,0 +1 @@
1
+ export * from "./ListCheckoutsRequestStatus.mjs";
@@ -0,0 +1 @@
1
+ export * from "./ListCheckoutsRequestStatus.mjs";
@@ -38,8 +38,6 @@ export declare class Contacts {
38
38
  * @example
39
39
  * await client.contacts.createContact({
40
40
  * customerId: "customerId",
41
- * firstName: "firstName",
42
- * lastName: "lastName",
43
41
  * email: "email"
44
42
  * })
45
43
  */
@@ -103,8 +103,6 @@ export class Contacts {
103
103
  * @example
104
104
  * await client.contacts.createContact({
105
105
  * customerId: "customerId",
106
- * firstName: "firstName",
107
- * lastName: "lastName",
108
106
  * email: "email"
109
107
  * })
110
108
  */
@@ -3,17 +3,26 @@ import type * as Paid from "../../../../index.mjs";
3
3
  * @example
4
4
  * {
5
5
  * customerId: "customerId",
6
- * firstName: "firstName",
7
- * lastName: "lastName",
8
6
  * email: "email"
9
7
  * }
10
8
  */
11
9
  export interface CreateContactRequest {
12
10
  customerId: string;
13
- firstName: string;
14
- lastName: string;
11
+ firstName?: string;
12
+ lastName?: string;
15
13
  email: string;
16
14
  phone?: string | null;
17
15
  billingAddress?: Paid.ContactBillingAddress | null;
18
16
  externalId?: string | null;
17
+ roles?: CreateContactRequest.Roles.Item[];
18
+ }
19
+ export declare namespace CreateContactRequest {
20
+ type Roles = Roles.Item[];
21
+ namespace Roles {
22
+ const Item: {
23
+ readonly Billing: "BILLING";
24
+ readonly AccountsPayable: "ACCOUNTS_PAYABLE";
25
+ };
26
+ type Item = (typeof Item)[keyof typeof Item];
27
+ }
19
28
  }
@@ -1,2 +1,11 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- export {};
2
+ export var CreateContactRequest;
3
+ (function (CreateContactRequest) {
4
+ let Roles;
5
+ (function (Roles) {
6
+ Roles.Item = {
7
+ Billing: "BILLING",
8
+ AccountsPayable: "ACCOUNTS_PAYABLE",
9
+ };
10
+ })(Roles = CreateContactRequest.Roles || (CreateContactRequest.Roles = {}));
11
+ })(CreateContactRequest || (CreateContactRequest = {}));
@@ -0,0 +1,27 @@
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 Credits {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class Credits {
11
+ protected readonly _options: Credits.Options;
12
+ constructor(_options: Credits.Options);
13
+ /**
14
+ * List credit currencies for the organization
15
+ *
16
+ * @param {Credits.RequestOptions} requestOptions - Request-specific configuration.
17
+ *
18
+ * @throws {@link Paid.ForbiddenError}
19
+ * @throws {@link Paid.InternalServerError}
20
+ *
21
+ * @example
22
+ * await client.credits.listCreditCurrencies()
23
+ */
24
+ listCreditCurrencies(requestOptions?: Credits.RequestOptions): core.HttpResponsePromise<Paid.CreditCurrencyListResponse>;
25
+ private __listCreditCurrencies;
26
+ protected _getAuthorizationHeader(): Promise<string>;
27
+ }
@@ -0,0 +1,86 @@
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 Credits {
17
+ constructor(_options) {
18
+ this._options = _options;
19
+ }
20
+ /**
21
+ * List credit currencies for the organization
22
+ *
23
+ * @param {Credits.RequestOptions} requestOptions - Request-specific configuration.
24
+ *
25
+ * @throws {@link Paid.ForbiddenError}
26
+ * @throws {@link Paid.InternalServerError}
27
+ *
28
+ * @example
29
+ * await client.credits.listCreditCurrencies()
30
+ */
31
+ listCreditCurrencies(requestOptions) {
32
+ return core.HttpResponsePromise.fromPromise(this.__listCreditCurrencies(requestOptions));
33
+ }
34
+ __listCreditCurrencies(requestOptions) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ var _a, _b, _c, _d, _e, _f, _g, _h;
37
+ 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);
38
+ const _response = yield core.fetcher({
39
+ 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, "credits/currencies"),
40
+ method: "GET",
41
+ headers: _headers,
42
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
43
+ 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,
44
+ 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,
45
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
46
+ });
47
+ if (_response.ok) {
48
+ return { data: _response.body, rawResponse: _response.rawResponse };
49
+ }
50
+ if (_response.error.reason === "status-code") {
51
+ switch (_response.error.statusCode) {
52
+ case 403:
53
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
54
+ case 500:
55
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
56
+ default:
57
+ throw new errors.PaidError({
58
+ statusCode: _response.error.statusCode,
59
+ body: _response.error.body,
60
+ rawResponse: _response.rawResponse,
61
+ });
62
+ }
63
+ }
64
+ switch (_response.error.reason) {
65
+ case "non-json":
66
+ throw new errors.PaidError({
67
+ statusCode: _response.error.statusCode,
68
+ body: _response.error.rawBody,
69
+ rawResponse: _response.rawResponse,
70
+ });
71
+ case "timeout":
72
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /credits/currencies.");
73
+ case "unknown":
74
+ throw new errors.PaidError({
75
+ message: _response.error.errorMessage,
76
+ rawResponse: _response.rawResponse,
77
+ });
78
+ }
79
+ });
80
+ }
81
+ _getAuthorizationHeader() {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
84
+ });
85
+ }
86
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1,30 @@
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 CustomerPortals {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class CustomerPortals {
11
+ protected readonly _options: CustomerPortals.Options;
12
+ constructor(_options: CustomerPortals.Options);
13
+ /**
14
+ * Creates a portal session for the customer. Returns a short-lived URL to the customer portal.
15
+ *
16
+ * @param {Paid.CreateCustomerPortalRequest} request
17
+ * @param {CustomerPortals.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link Paid.BadRequestError}
20
+ * @throws {@link Paid.ForbiddenError}
21
+ * @throws {@link Paid.NotFoundError}
22
+ * @throws {@link Paid.InternalServerError}
23
+ *
24
+ * @example
25
+ * await client.customerPortals.createCustomerPortal()
26
+ */
27
+ createCustomerPortal(request?: Paid.CreateCustomerPortalRequest, requestOptions?: CustomerPortals.RequestOptions): core.HttpResponsePromise<Paid.CustomerPortal>;
28
+ private __createCustomerPortal;
29
+ protected _getAuthorizationHeader(): Promise<string>;
30
+ }
@@ -0,0 +1,96 @@
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 CustomerPortals {
17
+ constructor(_options) {
18
+ this._options = _options;
19
+ }
20
+ /**
21
+ * Creates a portal session for the customer. Returns a short-lived URL to the customer portal.
22
+ *
23
+ * @param {Paid.CreateCustomerPortalRequest} request
24
+ * @param {CustomerPortals.RequestOptions} requestOptions - Request-specific configuration.
25
+ *
26
+ * @throws {@link Paid.BadRequestError}
27
+ * @throws {@link Paid.ForbiddenError}
28
+ * @throws {@link Paid.NotFoundError}
29
+ * @throws {@link Paid.InternalServerError}
30
+ *
31
+ * @example
32
+ * await client.customerPortals.createCustomerPortal()
33
+ */
34
+ createCustomerPortal(request = {}, requestOptions) {
35
+ return core.HttpResponsePromise.fromPromise(this.__createCustomerPortal(request, requestOptions));
36
+ }
37
+ __createCustomerPortal() {
38
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
39
+ var _a, _b, _c, _d, _e, _f, _g, _h;
40
+ 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);
41
+ const _response = yield core.fetcher({
42
+ 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, "customer-portals/"),
43
+ method: "POST",
44
+ headers: _headers,
45
+ contentType: "application/json",
46
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
47
+ requestType: "json",
48
+ body: request,
49
+ 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,
50
+ 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,
51
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
52
+ });
53
+ if (_response.ok) {
54
+ return { data: _response.body, rawResponse: _response.rawResponse };
55
+ }
56
+ if (_response.error.reason === "status-code") {
57
+ switch (_response.error.statusCode) {
58
+ case 400:
59
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
60
+ case 403:
61
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
62
+ case 404:
63
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
64
+ case 500:
65
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
66
+ default:
67
+ throw new errors.PaidError({
68
+ statusCode: _response.error.statusCode,
69
+ body: _response.error.body,
70
+ rawResponse: _response.rawResponse,
71
+ });
72
+ }
73
+ }
74
+ switch (_response.error.reason) {
75
+ case "non-json":
76
+ throw new errors.PaidError({
77
+ statusCode: _response.error.statusCode,
78
+ body: _response.error.rawBody,
79
+ rawResponse: _response.rawResponse,
80
+ });
81
+ case "timeout":
82
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /customer-portals/.");
83
+ case "unknown":
84
+ throw new errors.PaidError({
85
+ message: _response.error.errorMessage,
86
+ rawResponse: _response.rawResponse,
87
+ });
88
+ }
89
+ });
90
+ }
91
+ _getAuthorizationHeader() {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
94
+ });
95
+ }
96
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface CreateCustomerPortalRequest {
6
+ /** The Paid customer ID (display ID or UUID). Either this or externalCustomerId must be provided. */
7
+ customerId?: string;
8
+ /** Your external customer ID. Either this or customerId must be provided. */
9
+ externalCustomerId?: string;
10
+ returnUrl?: string;
11
+ expiresAt?: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { CreateCustomerPortalRequest } from "./CreateCustomerPortalRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -148,5 +148,39 @@ export declare class Customers {
148
148
  */
149
149
  deleteCustomerByExternalId(request: Paid.DeleteCustomerByExternalIdRequest, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.EmptyResponse>;
150
150
  private __deleteCustomerByExternalId;
151
+ /**
152
+ * Get current customer credit balances grouped by currency
153
+ *
154
+ * @param {Paid.GetCustomerCreditBalancesRequest} request
155
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
156
+ *
157
+ * @throws {@link Paid.ForbiddenError}
158
+ * @throws {@link Paid.NotFoundError}
159
+ * @throws {@link Paid.InternalServerError}
160
+ *
161
+ * @example
162
+ * await client.customers.getCustomerCreditBalances({
163
+ * id: "id"
164
+ * })
165
+ */
166
+ getCustomerCreditBalances(request: Paid.GetCustomerCreditBalancesRequest, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.CreditBalanceListResponse>;
167
+ private __getCustomerCreditBalances;
168
+ /**
169
+ * Get current customer credit balances grouped by currency, looked up by external ID
170
+ *
171
+ * @param {Paid.GetCustomerCreditBalancesByExternalIdRequest} request
172
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
173
+ *
174
+ * @throws {@link Paid.ForbiddenError}
175
+ * @throws {@link Paid.NotFoundError}
176
+ * @throws {@link Paid.InternalServerError}
177
+ *
178
+ * @example
179
+ * await client.customers.getCustomerCreditBalancesByExternalId({
180
+ * externalId: "externalId"
181
+ * })
182
+ */
183
+ getCustomerCreditBalancesByExternalId(request: Paid.GetCustomerCreditBalancesByExternalIdRequest, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.CreditBalanceListResponse>;
184
+ private __getCustomerCreditBalancesByExternalId;
151
185
  protected _getAuthorizationHeader(): Promise<string>;
152
186
  }
@@ -582,6 +582,142 @@ export class Customers {
582
582
  }
583
583
  });
584
584
  }
585
+ /**
586
+ * Get current customer credit balances grouped by currency
587
+ *
588
+ * @param {Paid.GetCustomerCreditBalancesRequest} request
589
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
590
+ *
591
+ * @throws {@link Paid.ForbiddenError}
592
+ * @throws {@link Paid.NotFoundError}
593
+ * @throws {@link Paid.InternalServerError}
594
+ *
595
+ * @example
596
+ * await client.customers.getCustomerCreditBalances({
597
+ * id: "id"
598
+ * })
599
+ */
600
+ getCustomerCreditBalances(request, requestOptions) {
601
+ return core.HttpResponsePromise.fromPromise(this.__getCustomerCreditBalances(request, requestOptions));
602
+ }
603
+ __getCustomerCreditBalances(request, requestOptions) {
604
+ return __awaiter(this, void 0, void 0, function* () {
605
+ var _a, _b, _c, _d, _e, _f, _g, _h;
606
+ const { id } = request;
607
+ 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);
608
+ const _response = yield core.fetcher({
609
+ 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, `customers/${core.url.encodePathParam(id)}/credits/balances`),
610
+ method: "GET",
611
+ headers: _headers,
612
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
613
+ 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,
614
+ 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,
615
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
616
+ });
617
+ if (_response.ok) {
618
+ return { data: _response.body, rawResponse: _response.rawResponse };
619
+ }
620
+ if (_response.error.reason === "status-code") {
621
+ switch (_response.error.statusCode) {
622
+ case 403:
623
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
624
+ case 404:
625
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
626
+ case 500:
627
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
628
+ default:
629
+ throw new errors.PaidError({
630
+ statusCode: _response.error.statusCode,
631
+ body: _response.error.body,
632
+ rawResponse: _response.rawResponse,
633
+ });
634
+ }
635
+ }
636
+ switch (_response.error.reason) {
637
+ case "non-json":
638
+ throw new errors.PaidError({
639
+ statusCode: _response.error.statusCode,
640
+ body: _response.error.rawBody,
641
+ rawResponse: _response.rawResponse,
642
+ });
643
+ case "timeout":
644
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/credits/balances.");
645
+ case "unknown":
646
+ throw new errors.PaidError({
647
+ message: _response.error.errorMessage,
648
+ rawResponse: _response.rawResponse,
649
+ });
650
+ }
651
+ });
652
+ }
653
+ /**
654
+ * Get current customer credit balances grouped by currency, looked up by external ID
655
+ *
656
+ * @param {Paid.GetCustomerCreditBalancesByExternalIdRequest} request
657
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
658
+ *
659
+ * @throws {@link Paid.ForbiddenError}
660
+ * @throws {@link Paid.NotFoundError}
661
+ * @throws {@link Paid.InternalServerError}
662
+ *
663
+ * @example
664
+ * await client.customers.getCustomerCreditBalancesByExternalId({
665
+ * externalId: "externalId"
666
+ * })
667
+ */
668
+ getCustomerCreditBalancesByExternalId(request, requestOptions) {
669
+ return core.HttpResponsePromise.fromPromise(this.__getCustomerCreditBalancesByExternalId(request, requestOptions));
670
+ }
671
+ __getCustomerCreditBalancesByExternalId(request, requestOptions) {
672
+ return __awaiter(this, void 0, void 0, function* () {
673
+ var _a, _b, _c, _d, _e, _f, _g, _h;
674
+ const { externalId } = request;
675
+ 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);
676
+ const _response = yield core.fetcher({
677
+ 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, `customers/external/${core.url.encodePathParam(externalId)}/credits/balances`),
678
+ method: "GET",
679
+ headers: _headers,
680
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
681
+ 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,
682
+ 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,
683
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
684
+ });
685
+ if (_response.ok) {
686
+ return { data: _response.body, rawResponse: _response.rawResponse };
687
+ }
688
+ if (_response.error.reason === "status-code") {
689
+ switch (_response.error.statusCode) {
690
+ case 403:
691
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
692
+ case 404:
693
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
694
+ case 500:
695
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
696
+ default:
697
+ throw new errors.PaidError({
698
+ statusCode: _response.error.statusCode,
699
+ body: _response.error.body,
700
+ rawResponse: _response.rawResponse,
701
+ });
702
+ }
703
+ }
704
+ switch (_response.error.reason) {
705
+ case "non-json":
706
+ throw new errors.PaidError({
707
+ statusCode: _response.error.statusCode,
708
+ body: _response.error.rawBody,
709
+ rawResponse: _response.rawResponse,
710
+ });
711
+ case "timeout":
712
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/credits/balances.");
713
+ case "unknown":
714
+ throw new errors.PaidError({
715
+ message: _response.error.errorMessage,
716
+ rawResponse: _response.rawResponse,
717
+ });
718
+ }
719
+ });
720
+ }
585
721
  _getAuthorizationHeader() {
586
722
  return __awaiter(this, void 0, void 0, function* () {
587
723
  return `Bearer ${yield core.Supplier.get(this._options.token)}`;