@paid-ai/paid-node 1.1.0 → 1.2.1

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 (205) hide show
  1. package/README.md +2 -0
  2. package/dist/cjs/Client.d.ts +12 -0
  3. package/dist/cjs/Client.js +34 -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 +25 -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 +36 -0
  41. package/dist/cjs/api/resources/customers/client/Client.js +142 -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 +8 -0
  48. package/dist/cjs/api/resources/index.js +9 -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/resources/valueReceipts/client/Client.d.ts +75 -0
  52. package/dist/cjs/api/resources/valueReceipts/client/Client.js +347 -0
  53. package/dist/cjs/api/resources/valueReceipts/client/index.d.ts +1 -0
  54. package/dist/cjs/api/resources/valueReceipts/client/index.js +17 -0
  55. package/dist/cjs/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.d.ts +9 -0
  56. package/dist/cjs/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.js +3 -0
  57. package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.ts +10 -0
  58. package/dist/cjs/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.js +3 -0
  59. package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.ts +10 -0
  60. package/dist/cjs/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.js +3 -0
  61. package/dist/cjs/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.d.ts +9 -0
  62. package/dist/cjs/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.js +3 -0
  63. package/dist/cjs/api/resources/valueReceipts/client/requests/index.d.ts +4 -0
  64. package/dist/cjs/api/resources/valueReceipts/client/requests/index.js +2 -0
  65. package/dist/cjs/api/resources/valueReceipts/index.d.ts +1 -0
  66. package/dist/cjs/api/resources/valueReceipts/index.js +17 -0
  67. package/dist/cjs/api/types/Checkout.d.ts +19 -0
  68. package/dist/cjs/api/types/Checkout.js +3 -0
  69. package/dist/cjs/api/types/CheckoutListResponse.d.ts +5 -0
  70. package/dist/cjs/api/types/CheckoutListResponse.js +3 -0
  71. package/dist/cjs/api/types/CheckoutProduct.d.ts +3 -0
  72. package/dist/cjs/api/types/CheckoutProduct.js +3 -0
  73. package/dist/cjs/api/types/CheckoutProductInput.d.ts +3 -0
  74. package/dist/cjs/api/types/CheckoutProductInput.js +3 -0
  75. package/dist/cjs/api/types/CheckoutStatus.d.ts +7 -0
  76. package/dist/cjs/api/types/CheckoutStatus.js +10 -0
  77. package/dist/cjs/api/types/CreateOrderLineAttributeRequest.d.ts +116 -1
  78. package/dist/cjs/api/types/CreateOrderLineAttributeRequest.js +70 -0
  79. package/dist/cjs/api/types/CreateOrderLineRequest.d.ts +3 -3
  80. package/dist/cjs/api/types/CreditBalance.d.ts +19 -0
  81. package/dist/cjs/api/types/CreditBalance.js +11 -0
  82. package/dist/cjs/api/types/CreditBalanceListResponse.d.ts +4 -0
  83. package/dist/cjs/api/types/CreditBalanceListResponse.js +3 -0
  84. package/dist/cjs/api/types/CreditCurrency.d.ts +9 -0
  85. package/dist/cjs/api/types/CreditCurrency.js +3 -0
  86. package/dist/cjs/api/types/CreditCurrencyListResponse.d.ts +4 -0
  87. package/dist/cjs/api/types/CreditCurrencyListResponse.js +3 -0
  88. package/dist/cjs/api/types/CustomerPortal.d.ts +10 -0
  89. package/dist/cjs/api/types/CustomerPortal.js +3 -0
  90. package/dist/cjs/api/types/CustomerPortalStatus.d.ts +5 -0
  91. package/dist/cjs/api/types/CustomerPortalStatus.js +8 -0
  92. package/dist/cjs/api/types/Order.d.ts +3 -0
  93. package/dist/cjs/api/types/ValueReceiptDetail.d.ts +19 -0
  94. package/dist/cjs/api/types/ValueReceiptDetail.js +3 -0
  95. package/dist/cjs/api/types/ValueReceiptListResponse.d.ts +5 -0
  96. package/dist/cjs/api/types/ValueReceiptListResponse.js +3 -0
  97. package/dist/cjs/api/types/ValueReceiptSummary.d.ts +16 -0
  98. package/dist/cjs/api/types/ValueReceiptSummary.js +3 -0
  99. package/dist/cjs/api/types/index.d.ts +14 -0
  100. package/dist/cjs/api/types/index.js +14 -0
  101. package/dist/cjs/version.d.ts +1 -1
  102. package/dist/cjs/version.js +1 -1
  103. package/dist/esm/Client.d.mts +12 -0
  104. package/dist/esm/Client.mjs +22 -2
  105. package/dist/esm/api/resources/checkouts/client/Client.d.mts +84 -0
  106. package/dist/esm/api/resources/checkouts/client/Client.mjs +313 -0
  107. package/dist/esm/api/resources/checkouts/client/index.d.mts +1 -0
  108. package/dist/esm/api/resources/checkouts/client/index.mjs +1 -0
  109. package/dist/esm/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.d.mts +9 -0
  110. package/dist/esm/api/resources/checkouts/client/requests/ArchiveCheckoutRequest.mjs +2 -0
  111. package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.d.mts +25 -0
  112. package/dist/esm/api/resources/checkouts/client/requests/CreateCheckoutRequest.mjs +2 -0
  113. package/dist/esm/api/resources/checkouts/client/requests/GetCheckoutRequest.d.mts +9 -0
  114. package/dist/esm/api/resources/checkouts/client/requests/GetCheckoutRequest.mjs +2 -0
  115. package/dist/esm/api/resources/checkouts/client/requests/ListCheckoutsRequest.d.mts +10 -0
  116. package/dist/esm/api/resources/checkouts/client/requests/ListCheckoutsRequest.mjs +2 -0
  117. package/dist/esm/api/resources/checkouts/client/requests/index.d.mts +4 -0
  118. package/dist/esm/api/resources/checkouts/client/requests/index.mjs +1 -0
  119. package/dist/esm/api/resources/checkouts/index.d.mts +2 -0
  120. package/dist/esm/api/resources/checkouts/index.mjs +2 -0
  121. package/dist/esm/api/resources/checkouts/types/ListCheckoutsRequestStatus.d.mts +6 -0
  122. package/dist/esm/api/resources/checkouts/types/ListCheckoutsRequestStatus.mjs +6 -0
  123. package/dist/esm/api/resources/checkouts/types/index.d.mts +1 -0
  124. package/dist/esm/api/resources/checkouts/types/index.mjs +1 -0
  125. package/dist/esm/api/resources/credits/client/Client.d.mts +27 -0
  126. package/dist/esm/api/resources/credits/client/Client.mjs +86 -0
  127. package/dist/esm/api/resources/credits/client/index.d.mts +1 -0
  128. package/dist/esm/api/resources/credits/client/index.mjs +1 -0
  129. package/dist/esm/api/resources/credits/index.d.mts +1 -0
  130. package/dist/esm/api/resources/credits/index.mjs +1 -0
  131. package/dist/esm/api/resources/customerPortals/client/Client.d.mts +30 -0
  132. package/dist/esm/api/resources/customerPortals/client/Client.mjs +96 -0
  133. package/dist/esm/api/resources/customerPortals/client/index.d.mts +1 -0
  134. package/dist/esm/api/resources/customerPortals/client/index.mjs +1 -0
  135. package/dist/esm/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.d.mts +12 -0
  136. package/dist/esm/api/resources/customerPortals/client/requests/CreateCustomerPortalRequest.mjs +2 -0
  137. package/dist/esm/api/resources/customerPortals/client/requests/index.d.mts +1 -0
  138. package/dist/esm/api/resources/customerPortals/client/requests/index.mjs +1 -0
  139. package/dist/esm/api/resources/customerPortals/index.d.mts +1 -0
  140. package/dist/esm/api/resources/customerPortals/index.mjs +1 -0
  141. package/dist/esm/api/resources/customers/client/Client.d.mts +36 -0
  142. package/dist/esm/api/resources/customers/client/Client.mjs +142 -0
  143. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.d.mts +9 -0
  144. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesByExternalIdRequest.mjs +2 -0
  145. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.d.mts +9 -0
  146. package/dist/esm/api/resources/customers/client/requests/GetCustomerCreditBalancesRequest.mjs +2 -0
  147. package/dist/esm/api/resources/customers/client/requests/index.d.mts +2 -0
  148. package/dist/esm/api/resources/index.d.mts +8 -0
  149. package/dist/esm/api/resources/index.mjs +8 -0
  150. package/dist/esm/api/resources/orders/client/requests/CreateOrderRequest.d.mts +11 -7
  151. package/dist/esm/api/resources/orders/client/requests/UpdateOrderRequest.d.mts +10 -7
  152. package/dist/esm/api/resources/valueReceipts/client/Client.d.mts +75 -0
  153. package/dist/esm/api/resources/valueReceipts/client/Client.mjs +310 -0
  154. package/dist/esm/api/resources/valueReceipts/client/index.d.mts +1 -0
  155. package/dist/esm/api/resources/valueReceipts/client/index.mjs +1 -0
  156. package/dist/esm/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.d.mts +9 -0
  157. package/dist/esm/api/resources/valueReceipts/client/requests/GetValueReceiptByIdRequest.mjs +2 -0
  158. package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.d.mts +10 -0
  159. package/dist/esm/api/resources/valueReceipts/client/requests/ListValueReceiptsRequest.mjs +2 -0
  160. package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.d.mts +10 -0
  161. package/dist/esm/api/resources/valueReceipts/client/requests/PublishValueReceiptBody.mjs +2 -0
  162. package/dist/esm/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.d.mts +9 -0
  163. package/dist/esm/api/resources/valueReceipts/client/requests/UnpublishValueReceiptRequest.mjs +2 -0
  164. package/dist/esm/api/resources/valueReceipts/client/requests/index.d.mts +4 -0
  165. package/dist/esm/api/resources/valueReceipts/client/requests/index.mjs +1 -0
  166. package/dist/esm/api/resources/valueReceipts/index.d.mts +1 -0
  167. package/dist/esm/api/resources/valueReceipts/index.mjs +1 -0
  168. package/dist/esm/api/types/Checkout.d.mts +19 -0
  169. package/dist/esm/api/types/Checkout.mjs +2 -0
  170. package/dist/esm/api/types/CheckoutListResponse.d.mts +5 -0
  171. package/dist/esm/api/types/CheckoutListResponse.mjs +2 -0
  172. package/dist/esm/api/types/CheckoutProduct.d.mts +3 -0
  173. package/dist/esm/api/types/CheckoutProduct.mjs +2 -0
  174. package/dist/esm/api/types/CheckoutProductInput.d.mts +3 -0
  175. package/dist/esm/api/types/CheckoutProductInput.mjs +2 -0
  176. package/dist/esm/api/types/CheckoutStatus.d.mts +7 -0
  177. package/dist/esm/api/types/CheckoutStatus.mjs +7 -0
  178. package/dist/esm/api/types/CreateOrderLineAttributeRequest.d.mts +116 -1
  179. package/dist/esm/api/types/CreateOrderLineAttributeRequest.mjs +69 -1
  180. package/dist/esm/api/types/CreateOrderLineRequest.d.mts +3 -3
  181. package/dist/esm/api/types/CreditBalance.d.mts +19 -0
  182. package/dist/esm/api/types/CreditBalance.mjs +8 -0
  183. package/dist/esm/api/types/CreditBalanceListResponse.d.mts +4 -0
  184. package/dist/esm/api/types/CreditBalanceListResponse.mjs +2 -0
  185. package/dist/esm/api/types/CreditCurrency.d.mts +9 -0
  186. package/dist/esm/api/types/CreditCurrency.mjs +2 -0
  187. package/dist/esm/api/types/CreditCurrencyListResponse.d.mts +4 -0
  188. package/dist/esm/api/types/CreditCurrencyListResponse.mjs +2 -0
  189. package/dist/esm/api/types/CustomerPortal.d.mts +10 -0
  190. package/dist/esm/api/types/CustomerPortal.mjs +2 -0
  191. package/dist/esm/api/types/CustomerPortalStatus.d.mts +5 -0
  192. package/dist/esm/api/types/CustomerPortalStatus.mjs +5 -0
  193. package/dist/esm/api/types/Order.d.mts +3 -0
  194. package/dist/esm/api/types/ValueReceiptDetail.d.mts +19 -0
  195. package/dist/esm/api/types/ValueReceiptDetail.mjs +2 -0
  196. package/dist/esm/api/types/ValueReceiptListResponse.d.mts +5 -0
  197. package/dist/esm/api/types/ValueReceiptListResponse.mjs +2 -0
  198. package/dist/esm/api/types/ValueReceiptSummary.d.mts +16 -0
  199. package/dist/esm/api/types/ValueReceiptSummary.mjs +2 -0
  200. package/dist/esm/api/types/index.d.mts +14 -0
  201. package/dist/esm/api/types/index.mjs +14 -0
  202. package/dist/esm/version.d.mts +1 -1
  203. package/dist/esm/version.mjs +1 -1
  204. package/package.json +3 -3
  205. package/reference.md +771 -0
@@ -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";
@@ -84,6 +84,7 @@ export declare class Customers {
84
84
  * @param {Paid.DeleteCustomerByIdRequest} request
85
85
  * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
86
86
  *
87
+ * @throws {@link Paid.BadRequestError}
87
88
  * @throws {@link Paid.ForbiddenError}
88
89
  * @throws {@link Paid.NotFoundError}
89
90
  * @throws {@link Paid.InternalServerError}
@@ -137,6 +138,7 @@ export declare class Customers {
137
138
  * @param {Paid.DeleteCustomerByExternalIdRequest} request
138
139
  * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
139
140
  *
141
+ * @throws {@link Paid.BadRequestError}
140
142
  * @throws {@link Paid.ForbiddenError}
141
143
  * @throws {@link Paid.NotFoundError}
142
144
  * @throws {@link Paid.InternalServerError}
@@ -148,5 +150,39 @@ export declare class Customers {
148
150
  */
149
151
  deleteCustomerByExternalId(request: Paid.DeleteCustomerByExternalIdRequest, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.EmptyResponse>;
150
152
  private __deleteCustomerByExternalId;
153
+ /**
154
+ * Get current customer credit balances grouped by currency
155
+ *
156
+ * @param {Paid.GetCustomerCreditBalancesRequest} request
157
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
158
+ *
159
+ * @throws {@link Paid.ForbiddenError}
160
+ * @throws {@link Paid.NotFoundError}
161
+ * @throws {@link Paid.InternalServerError}
162
+ *
163
+ * @example
164
+ * await client.customers.getCustomerCreditBalances({
165
+ * id: "id"
166
+ * })
167
+ */
168
+ getCustomerCreditBalances(request: Paid.GetCustomerCreditBalancesRequest, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.CreditBalanceListResponse>;
169
+ private __getCustomerCreditBalances;
170
+ /**
171
+ * Get current customer credit balances grouped by currency, looked up by external ID
172
+ *
173
+ * @param {Paid.GetCustomerCreditBalancesByExternalIdRequest} request
174
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
175
+ *
176
+ * @throws {@link Paid.ForbiddenError}
177
+ * @throws {@link Paid.NotFoundError}
178
+ * @throws {@link Paid.InternalServerError}
179
+ *
180
+ * @example
181
+ * await client.customers.getCustomerCreditBalancesByExternalId({
182
+ * externalId: "externalId"
183
+ * })
184
+ */
185
+ getCustomerCreditBalancesByExternalId(request: Paid.GetCustomerCreditBalancesByExternalIdRequest, requestOptions?: Customers.RequestOptions): core.HttpResponsePromise<Paid.CreditBalanceListResponse>;
186
+ private __getCustomerCreditBalancesByExternalId;
151
187
  protected _getAuthorizationHeader(): Promise<string>;
152
188
  }
@@ -309,6 +309,7 @@ export class Customers {
309
309
  * @param {Paid.DeleteCustomerByIdRequest} request
310
310
  * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
311
311
  *
312
+ * @throws {@link Paid.BadRequestError}
312
313
  * @throws {@link Paid.ForbiddenError}
313
314
  * @throws {@link Paid.NotFoundError}
314
315
  * @throws {@link Paid.InternalServerError}
@@ -340,6 +341,8 @@ export class Customers {
340
341
  }
341
342
  if (_response.error.reason === "status-code") {
342
343
  switch (_response.error.statusCode) {
344
+ case 400:
345
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
343
346
  case 403:
344
347
  throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
345
348
  case 404:
@@ -520,6 +523,7 @@ export class Customers {
520
523
  * @param {Paid.DeleteCustomerByExternalIdRequest} request
521
524
  * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
522
525
  *
526
+ * @throws {@link Paid.BadRequestError}
523
527
  * @throws {@link Paid.ForbiddenError}
524
528
  * @throws {@link Paid.NotFoundError}
525
529
  * @throws {@link Paid.InternalServerError}
@@ -551,6 +555,8 @@ export class Customers {
551
555
  }
552
556
  if (_response.error.reason === "status-code") {
553
557
  switch (_response.error.statusCode) {
558
+ case 400:
559
+ throw new Paid.BadRequestError(_response.error.body, _response.rawResponse);
554
560
  case 403:
555
561
  throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
556
562
  case 404:
@@ -582,6 +588,142 @@ export class Customers {
582
588
  }
583
589
  });
584
590
  }
591
+ /**
592
+ * Get current customer credit balances grouped by currency
593
+ *
594
+ * @param {Paid.GetCustomerCreditBalancesRequest} request
595
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
596
+ *
597
+ * @throws {@link Paid.ForbiddenError}
598
+ * @throws {@link Paid.NotFoundError}
599
+ * @throws {@link Paid.InternalServerError}
600
+ *
601
+ * @example
602
+ * await client.customers.getCustomerCreditBalances({
603
+ * id: "id"
604
+ * })
605
+ */
606
+ getCustomerCreditBalances(request, requestOptions) {
607
+ return core.HttpResponsePromise.fromPromise(this.__getCustomerCreditBalances(request, requestOptions));
608
+ }
609
+ __getCustomerCreditBalances(request, requestOptions) {
610
+ return __awaiter(this, void 0, void 0, function* () {
611
+ var _a, _b, _c, _d, _e, _f, _g, _h;
612
+ const { id } = request;
613
+ 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);
614
+ const _response = yield core.fetcher({
615
+ 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`),
616
+ method: "GET",
617
+ headers: _headers,
618
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
619
+ 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,
620
+ 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,
621
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
622
+ });
623
+ if (_response.ok) {
624
+ return { data: _response.body, rawResponse: _response.rawResponse };
625
+ }
626
+ if (_response.error.reason === "status-code") {
627
+ switch (_response.error.statusCode) {
628
+ case 403:
629
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
630
+ case 404:
631
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
632
+ case 500:
633
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
634
+ default:
635
+ throw new errors.PaidError({
636
+ statusCode: _response.error.statusCode,
637
+ body: _response.error.body,
638
+ rawResponse: _response.rawResponse,
639
+ });
640
+ }
641
+ }
642
+ switch (_response.error.reason) {
643
+ case "non-json":
644
+ throw new errors.PaidError({
645
+ statusCode: _response.error.statusCode,
646
+ body: _response.error.rawBody,
647
+ rawResponse: _response.rawResponse,
648
+ });
649
+ case "timeout":
650
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/{id}/credits/balances.");
651
+ case "unknown":
652
+ throw new errors.PaidError({
653
+ message: _response.error.errorMessage,
654
+ rawResponse: _response.rawResponse,
655
+ });
656
+ }
657
+ });
658
+ }
659
+ /**
660
+ * Get current customer credit balances grouped by currency, looked up by external ID
661
+ *
662
+ * @param {Paid.GetCustomerCreditBalancesByExternalIdRequest} request
663
+ * @param {Customers.RequestOptions} requestOptions - Request-specific configuration.
664
+ *
665
+ * @throws {@link Paid.ForbiddenError}
666
+ * @throws {@link Paid.NotFoundError}
667
+ * @throws {@link Paid.InternalServerError}
668
+ *
669
+ * @example
670
+ * await client.customers.getCustomerCreditBalancesByExternalId({
671
+ * externalId: "externalId"
672
+ * })
673
+ */
674
+ getCustomerCreditBalancesByExternalId(request, requestOptions) {
675
+ return core.HttpResponsePromise.fromPromise(this.__getCustomerCreditBalancesByExternalId(request, requestOptions));
676
+ }
677
+ __getCustomerCreditBalancesByExternalId(request, requestOptions) {
678
+ return __awaiter(this, void 0, void 0, function* () {
679
+ var _a, _b, _c, _d, _e, _f, _g, _h;
680
+ const { externalId } = request;
681
+ 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);
682
+ const _response = yield core.fetcher({
683
+ 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`),
684
+ method: "GET",
685
+ headers: _headers,
686
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
687
+ 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,
688
+ 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,
689
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
690
+ });
691
+ if (_response.ok) {
692
+ return { data: _response.body, rawResponse: _response.rawResponse };
693
+ }
694
+ if (_response.error.reason === "status-code") {
695
+ switch (_response.error.statusCode) {
696
+ case 403:
697
+ throw new Paid.ForbiddenError(_response.error.body, _response.rawResponse);
698
+ case 404:
699
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
700
+ case 500:
701
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
702
+ default:
703
+ throw new errors.PaidError({
704
+ statusCode: _response.error.statusCode,
705
+ body: _response.error.body,
706
+ rawResponse: _response.rawResponse,
707
+ });
708
+ }
709
+ }
710
+ switch (_response.error.reason) {
711
+ case "non-json":
712
+ throw new errors.PaidError({
713
+ statusCode: _response.error.statusCode,
714
+ body: _response.error.rawBody,
715
+ rawResponse: _response.rawResponse,
716
+ });
717
+ case "timeout":
718
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /customers/external/{externalId}/credits/balances.");
719
+ case "unknown":
720
+ throw new errors.PaidError({
721
+ message: _response.error.errorMessage,
722
+ rawResponse: _response.rawResponse,
723
+ });
724
+ }
725
+ });
726
+ }
585
727
  _getAuthorizationHeader() {
586
728
  return __awaiter(this, void 0, void 0, function* () {
587
729
  return `Bearer ${yield core.Supplier.get(this._options.token)}`;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * externalId: "externalId"
5
+ * }
6
+ */
7
+ export interface GetCustomerCreditBalancesByExternalIdRequest {
8
+ externalId: string;
9
+ }
@@ -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 GetCustomerCreditBalancesRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -3,6 +3,8 @@ export type { DeleteCustomerByExternalIdRequest } from "./DeleteCustomerByExtern
3
3
  export type { DeleteCustomerByIdRequest } from "./DeleteCustomerByIdRequest.mjs";
4
4
  export type { GetCustomerByExternalIdRequest } from "./GetCustomerByExternalIdRequest.mjs";
5
5
  export type { GetCustomerByIdRequest } from "./GetCustomerByIdRequest.mjs";
6
+ export type { GetCustomerCreditBalancesByExternalIdRequest } from "./GetCustomerCreditBalancesByExternalIdRequest.mjs";
7
+ export type { GetCustomerCreditBalancesRequest } from "./GetCustomerCreditBalancesRequest.mjs";
6
8
  export type { ListCustomersRequest } from "./ListCustomersRequest.mjs";
7
9
  export type { UpdateCustomerByExternalIdRequest } from "./UpdateCustomerByExternalIdRequest.mjs";
8
10
  export type { UpdateCustomerByIdRequest } from "./UpdateCustomerByIdRequest.mjs";
@@ -1,5 +1,11 @@
1
+ export * from "./checkouts/client/requests/index.mjs";
2
+ export * as checkouts from "./checkouts/index.mjs";
3
+ export * from "./checkouts/types/index.mjs";
1
4
  export * from "./contacts/client/requests/index.mjs";
2
5
  export * as contacts from "./contacts/index.mjs";
6
+ export * as credits from "./credits/index.mjs";
7
+ export * from "./customerPortals/client/requests/index.mjs";
8
+ export * as customerPortals from "./customerPortals/index.mjs";
3
9
  export * from "./customers/client/requests/index.mjs";
4
10
  export * as customers from "./customers/index.mjs";
5
11
  export * from "./invoices/client/requests/index.mjs";
@@ -10,3 +16,5 @@ export * from "./products/client/requests/index.mjs";
10
16
  export * as products from "./products/index.mjs";
11
17
  export * from "./signals/client/requests/index.mjs";
12
18
  export * as signals from "./signals/index.mjs";
19
+ export * from "./valueReceipts/client/requests/index.mjs";
20
+ export * as valueReceipts from "./valueReceipts/index.mjs";
@@ -1,5 +1,11 @@
1
+ export * from "./checkouts/client/requests/index.mjs";
2
+ export * as checkouts from "./checkouts/index.mjs";
3
+ export * from "./checkouts/types/index.mjs";
1
4
  export * from "./contacts/client/requests/index.mjs";
2
5
  export * as contacts from "./contacts/index.mjs";
6
+ export * as credits from "./credits/index.mjs";
7
+ export * from "./customerPortals/client/requests/index.mjs";
8
+ export * as customerPortals from "./customerPortals/index.mjs";
3
9
  export * from "./customers/client/requests/index.mjs";
4
10
  export * as customers from "./customers/index.mjs";
5
11
  export * from "./invoices/client/requests/index.mjs";
@@ -10,3 +16,5 @@ export * from "./products/client/requests/index.mjs";
10
16
  export * as products from "./products/index.mjs";
11
17
  export * from "./signals/client/requests/index.mjs";
12
18
  export * as signals from "./signals/index.mjs";
19
+ export * from "./valueReceipts/client/requests/index.mjs";
20
+ export * as valueReceipts from "./valueReceipts/index.mjs";
@@ -7,17 +7,21 @@ import type * as Paid from "../../../../index.mjs";
7
7
  */
8
8
  export interface CreateOrderRequest {
9
9
  customerId: string;
10
- billingCustomerId?: string | null;
10
+ billingCustomerId?: string;
11
11
  billingContactIds?: string[];
12
12
  name?: string;
13
13
  startDate?: string;
14
- endDate?: string | null;
15
- subscriptionTerms?: number | null;
14
+ endDate?: string;
15
+ subscriptionTerms?: number;
16
16
  creationState?: Paid.OrderCreationState;
17
17
  /** Day of month for billing anchor (1-31). Defaults to start date day if not provided. */
18
- billingAnchor?: number | null;
19
- paymentTerms?: string | null;
20
- externalId?: string | null;
21
- metadata?: Record<string, unknown> | null;
18
+ billingAnchor?: number;
19
+ paymentTerms?: string;
20
+ externalId?: string;
21
+ metadata?: Record<string, unknown>;
22
+ currency?: string;
23
+ autoPostInvoices?: boolean;
24
+ autoSendBillingEmails?: boolean;
25
+ autoSendPaymentEmails?: boolean;
22
26
  lines?: Paid.CreateOrderLineRequest[];
23
27
  }
@@ -9,14 +9,17 @@ export interface UpdateOrderRequest {
9
9
  id: string;
10
10
  name?: string;
11
11
  startDate?: string;
12
- endDate?: string | null;
13
- subscriptionTerms?: number | null;
12
+ endDate?: string;
13
+ subscriptionTerms?: number;
14
14
  creationState?: Paid.OrderCreationState;
15
15
  /** Day of month for billing anchor (1-31). Defaults to start date day if not provided. */
16
- billingAnchor?: number | null;
17
- paymentTerms?: string | null;
18
- externalId?: string | null;
19
- metadata?: Record<string, unknown> | null;
20
- billingCustomerId?: string | null;
16
+ billingAnchor?: number;
17
+ paymentTerms?: string;
18
+ externalId?: string;
19
+ metadata?: Record<string, unknown>;
20
+ billingCustomerId?: string;
21
21
  billingContactIds?: string[];
22
+ autoPostInvoices?: boolean;
23
+ autoSendBillingEmails?: boolean;
24
+ autoSendPaymentEmails?: boolean;
22
25
  }
@@ -0,0 +1,75 @@
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 ValueReceipts {
5
+ interface Options extends BaseClientOptions {
6
+ }
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class ValueReceipts {
11
+ protected readonly _options: ValueReceipts.Options;
12
+ constructor(_options: ValueReceipts.Options);
13
+ /**
14
+ * List value receipts for the organization
15
+ *
16
+ * @param {Paid.ListValueReceiptsRequest} request
17
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link Paid.InternalServerError}
20
+ *
21
+ * @example
22
+ * await client.valueReceipts.listValueReceipts()
23
+ */
24
+ listValueReceipts(request?: Paid.ListValueReceiptsRequest, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptListResponse>;
25
+ private __listValueReceipts;
26
+ /**
27
+ * Get a value receipt by ID, including its publish/share state.
28
+ *
29
+ * @param {Paid.GetValueReceiptByIdRequest} request
30
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
31
+ *
32
+ * @throws {@link Paid.NotFoundError}
33
+ * @throws {@link Paid.InternalServerError}
34
+ *
35
+ * @example
36
+ * await client.valueReceipts.getValueReceiptById({
37
+ * id: "id"
38
+ * })
39
+ */
40
+ getValueReceiptById(request: Paid.GetValueReceiptByIdRequest, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptDetail>;
41
+ private __getValueReceiptById;
42
+ /**
43
+ * Make a value receipt publicly accessible via URL.
44
+ *
45
+ * @param {Paid.PublishValueReceiptBody} request
46
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
47
+ *
48
+ * @throws {@link Paid.NotFoundError}
49
+ * @throws {@link Paid.InternalServerError}
50
+ *
51
+ * @example
52
+ * await client.valueReceipts.publishValueReceipt({
53
+ * id: "id"
54
+ * })
55
+ */
56
+ publishValueReceipt(request: Paid.PublishValueReceiptBody, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptDetail>;
57
+ private __publishValueReceipt;
58
+ /**
59
+ * Revoke public access to a value receipt.
60
+ *
61
+ * @param {Paid.UnpublishValueReceiptRequest} request
62
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
63
+ *
64
+ * @throws {@link Paid.NotFoundError}
65
+ * @throws {@link Paid.InternalServerError}
66
+ *
67
+ * @example
68
+ * await client.valueReceipts.unpublishValueReceipt({
69
+ * id: "id"
70
+ * })
71
+ */
72
+ unpublishValueReceipt(request: Paid.UnpublishValueReceiptRequest, requestOptions?: ValueReceipts.RequestOptions): core.HttpResponsePromise<Paid.ValueReceiptDetail>;
73
+ private __unpublishValueReceipt;
74
+ protected _getAuthorizationHeader(): Promise<string>;
75
+ }