@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,310 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
23
+ import * as core from "../../../../core/index.mjs";
24
+ import * as environments from "../../../../environments.mjs";
25
+ import * as errors from "../../../../errors/index.mjs";
26
+ import * as Paid from "../../../index.mjs";
27
+ export class ValueReceipts {
28
+ constructor(_options) {
29
+ this._options = _options;
30
+ }
31
+ /**
32
+ * List value receipts for the organization
33
+ *
34
+ * @param {Paid.ListValueReceiptsRequest} request
35
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link Paid.InternalServerError}
38
+ *
39
+ * @example
40
+ * await client.valueReceipts.listValueReceipts()
41
+ */
42
+ listValueReceipts(request = {}, requestOptions) {
43
+ return core.HttpResponsePromise.fromPromise(this.__listValueReceipts(request, requestOptions));
44
+ }
45
+ __listValueReceipts() {
46
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
47
+ var _a, _b, _c, _d, _e, _f, _g, _h;
48
+ const { limit, offset, customerId, orderId } = request;
49
+ const _queryParams = {};
50
+ if (limit != null) {
51
+ _queryParams.limit = limit.toString();
52
+ }
53
+ if (offset != null) {
54
+ _queryParams.offset = offset.toString();
55
+ }
56
+ if (customerId != null) {
57
+ _queryParams.customerId = customerId;
58
+ }
59
+ if (orderId != null) {
60
+ _queryParams.orderId = orderId;
61
+ }
62
+ 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);
63
+ const _response = yield core.fetcher({
64
+ 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, "value-receipts/"),
65
+ method: "GET",
66
+ headers: _headers,
67
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
68
+ 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,
69
+ 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,
70
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
71
+ });
72
+ if (_response.ok) {
73
+ return { data: _response.body, rawResponse: _response.rawResponse };
74
+ }
75
+ if (_response.error.reason === "status-code") {
76
+ switch (_response.error.statusCode) {
77
+ case 500:
78
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
79
+ default:
80
+ throw new errors.PaidError({
81
+ statusCode: _response.error.statusCode,
82
+ body: _response.error.body,
83
+ rawResponse: _response.rawResponse,
84
+ });
85
+ }
86
+ }
87
+ switch (_response.error.reason) {
88
+ case "non-json":
89
+ throw new errors.PaidError({
90
+ statusCode: _response.error.statusCode,
91
+ body: _response.error.rawBody,
92
+ rawResponse: _response.rawResponse,
93
+ });
94
+ case "timeout":
95
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /value-receipts/.");
96
+ case "unknown":
97
+ throw new errors.PaidError({
98
+ message: _response.error.errorMessage,
99
+ rawResponse: _response.rawResponse,
100
+ });
101
+ }
102
+ });
103
+ }
104
+ /**
105
+ * Get a value receipt by ID, including its publish/share state.
106
+ *
107
+ * @param {Paid.GetValueReceiptByIdRequest} request
108
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
109
+ *
110
+ * @throws {@link Paid.NotFoundError}
111
+ * @throws {@link Paid.InternalServerError}
112
+ *
113
+ * @example
114
+ * await client.valueReceipts.getValueReceiptById({
115
+ * id: "id"
116
+ * })
117
+ */
118
+ getValueReceiptById(request, requestOptions) {
119
+ return core.HttpResponsePromise.fromPromise(this.__getValueReceiptById(request, requestOptions));
120
+ }
121
+ __getValueReceiptById(request, requestOptions) {
122
+ return __awaiter(this, void 0, void 0, function* () {
123
+ var _a, _b, _c, _d, _e, _f, _g, _h;
124
+ const { id } = request;
125
+ 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);
126
+ const _response = yield core.fetcher({
127
+ 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, `value-receipts/${core.url.encodePathParam(id)}`),
128
+ method: "GET",
129
+ headers: _headers,
130
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
131
+ 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,
132
+ 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,
133
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
134
+ });
135
+ if (_response.ok) {
136
+ return { data: _response.body, rawResponse: _response.rawResponse };
137
+ }
138
+ if (_response.error.reason === "status-code") {
139
+ switch (_response.error.statusCode) {
140
+ case 404:
141
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
142
+ case 500:
143
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
144
+ default:
145
+ throw new errors.PaidError({
146
+ statusCode: _response.error.statusCode,
147
+ body: _response.error.body,
148
+ rawResponse: _response.rawResponse,
149
+ });
150
+ }
151
+ }
152
+ switch (_response.error.reason) {
153
+ case "non-json":
154
+ throw new errors.PaidError({
155
+ statusCode: _response.error.statusCode,
156
+ body: _response.error.rawBody,
157
+ rawResponse: _response.rawResponse,
158
+ });
159
+ case "timeout":
160
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /value-receipts/{id}.");
161
+ case "unknown":
162
+ throw new errors.PaidError({
163
+ message: _response.error.errorMessage,
164
+ rawResponse: _response.rawResponse,
165
+ });
166
+ }
167
+ });
168
+ }
169
+ /**
170
+ * Make a value receipt publicly accessible via URL.
171
+ *
172
+ * @param {Paid.PublishValueReceiptBody} request
173
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
174
+ *
175
+ * @throws {@link Paid.NotFoundError}
176
+ * @throws {@link Paid.InternalServerError}
177
+ *
178
+ * @example
179
+ * await client.valueReceipts.publishValueReceipt({
180
+ * id: "id"
181
+ * })
182
+ */
183
+ publishValueReceipt(request, requestOptions) {
184
+ return core.HttpResponsePromise.fromPromise(this.__publishValueReceipt(request, requestOptions));
185
+ }
186
+ __publishValueReceipt(request, requestOptions) {
187
+ return __awaiter(this, void 0, void 0, function* () {
188
+ var _a, _b, _c, _d, _e, _f, _g, _h;
189
+ const { id } = request, _body = __rest(request, ["id"]);
190
+ 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);
191
+ const _response = yield core.fetcher({
192
+ 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, `value-receipts/${core.url.encodePathParam(id)}/publish`),
193
+ method: "POST",
194
+ headers: _headers,
195
+ contentType: "application/json",
196
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
197
+ requestType: "json",
198
+ body: _body,
199
+ 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,
200
+ 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,
201
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
202
+ });
203
+ if (_response.ok) {
204
+ return { data: _response.body, rawResponse: _response.rawResponse };
205
+ }
206
+ if (_response.error.reason === "status-code") {
207
+ switch (_response.error.statusCode) {
208
+ case 404:
209
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
210
+ case 500:
211
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
212
+ default:
213
+ throw new errors.PaidError({
214
+ statusCode: _response.error.statusCode,
215
+ body: _response.error.body,
216
+ rawResponse: _response.rawResponse,
217
+ });
218
+ }
219
+ }
220
+ switch (_response.error.reason) {
221
+ case "non-json":
222
+ throw new errors.PaidError({
223
+ statusCode: _response.error.statusCode,
224
+ body: _response.error.rawBody,
225
+ rawResponse: _response.rawResponse,
226
+ });
227
+ case "timeout":
228
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /value-receipts/{id}/publish.");
229
+ case "unknown":
230
+ throw new errors.PaidError({
231
+ message: _response.error.errorMessage,
232
+ rawResponse: _response.rawResponse,
233
+ });
234
+ }
235
+ });
236
+ }
237
+ /**
238
+ * Revoke public access to a value receipt.
239
+ *
240
+ * @param {Paid.UnpublishValueReceiptRequest} request
241
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
242
+ *
243
+ * @throws {@link Paid.NotFoundError}
244
+ * @throws {@link Paid.InternalServerError}
245
+ *
246
+ * @example
247
+ * await client.valueReceipts.unpublishValueReceipt({
248
+ * id: "id"
249
+ * })
250
+ */
251
+ unpublishValueReceipt(request, requestOptions) {
252
+ return core.HttpResponsePromise.fromPromise(this.__unpublishValueReceipt(request, requestOptions));
253
+ }
254
+ __unpublishValueReceipt(request, requestOptions) {
255
+ return __awaiter(this, void 0, void 0, function* () {
256
+ var _a, _b, _c, _d, _e, _f, _g, _h;
257
+ const { id } = request, _body = __rest(request, ["id"]);
258
+ 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);
259
+ const _response = yield core.fetcher({
260
+ 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, `value-receipts/${core.url.encodePathParam(id)}/unpublish`),
261
+ method: "POST",
262
+ headers: _headers,
263
+ contentType: "application/json",
264
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
265
+ requestType: "json",
266
+ body: _body,
267
+ 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,
268
+ 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,
269
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
270
+ });
271
+ if (_response.ok) {
272
+ return { data: _response.body, rawResponse: _response.rawResponse };
273
+ }
274
+ if (_response.error.reason === "status-code") {
275
+ switch (_response.error.statusCode) {
276
+ case 404:
277
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
278
+ case 500:
279
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
280
+ default:
281
+ throw new errors.PaidError({
282
+ statusCode: _response.error.statusCode,
283
+ body: _response.error.body,
284
+ rawResponse: _response.rawResponse,
285
+ });
286
+ }
287
+ }
288
+ switch (_response.error.reason) {
289
+ case "non-json":
290
+ throw new errors.PaidError({
291
+ statusCode: _response.error.statusCode,
292
+ body: _response.error.rawBody,
293
+ rawResponse: _response.rawResponse,
294
+ });
295
+ case "timeout":
296
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /value-receipts/{id}/unpublish.");
297
+ case "unknown":
298
+ throw new errors.PaidError({
299
+ message: _response.error.errorMessage,
300
+ rawResponse: _response.rawResponse,
301
+ });
302
+ }
303
+ });
304
+ }
305
+ _getAuthorizationHeader() {
306
+ return __awaiter(this, void 0, void 0, function* () {
307
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
308
+ });
309
+ }
310
+ }
@@ -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 GetValueReceiptByIdRequest {
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
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface ListValueReceiptsRequest {
6
+ limit?: number;
7
+ offset?: number;
8
+ customerId?: string;
9
+ orderId?: string;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface PublishValueReceiptBody {
8
+ id: string;
9
+ publishExpiresAt?: string | null;
10
+ }
@@ -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 UnpublishValueReceiptRequest {
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,4 @@
1
+ export type { GetValueReceiptByIdRequest } from "./GetValueReceiptByIdRequest.mjs";
2
+ export type { ListValueReceiptsRequest } from "./ListValueReceiptsRequest.mjs";
3
+ export type { PublishValueReceiptBody } from "./PublishValueReceiptBody.mjs";
4
+ export type { UnpublishValueReceiptRequest } from "./UnpublishValueReceiptRequest.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1,19 @@
1
+ import type * as Paid from "../index.mjs";
2
+ export interface Checkout {
3
+ id: string;
4
+ url: string;
5
+ status: Paid.CheckoutStatus;
6
+ products: Paid.CheckoutProduct[];
7
+ customerId: string | null;
8
+ externalCustomerId: string | null;
9
+ successUrl: string;
10
+ cancelUrl: string | null;
11
+ expiresAt: string | null;
12
+ metadata: Record<string, unknown> | null;
13
+ collectAddress: boolean;
14
+ collectPhone: boolean;
15
+ singleUse: boolean;
16
+ allowedCurrencies: string[];
17
+ createdAt: string;
18
+ updatedAt: string;
19
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,5 @@
1
+ import type * as Paid from "../index.mjs";
2
+ export interface CheckoutListResponse {
3
+ data: Paid.Checkout[];
4
+ pagination: Paid.Pagination;
5
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export interface CheckoutProduct {
2
+ id: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export interface CheckoutProductInput {
2
+ id: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ export declare const CheckoutStatus: {
2
+ readonly Active: "active";
3
+ readonly Completed: "completed";
4
+ readonly Expired: "expired";
5
+ readonly Archived: "archived";
6
+ };
7
+ export type CheckoutStatus = (typeof CheckoutStatus)[keyof typeof CheckoutStatus];
@@ -0,0 +1,7 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export const CheckoutStatus = {
3
+ Active: "active",
4
+ Completed: "completed",
5
+ Expired: "expired",
6
+ Archived: "archived",
7
+ };
@@ -1,5 +1,120 @@
1
1
  export interface CreateOrderLineAttributeRequest {
2
2
  name: string;
3
3
  quantity?: number;
4
- pricing: Record<string, unknown>;
4
+ pricing: CreateOrderLineAttributeRequest.Pricing;
5
+ }
6
+ export declare namespace CreateOrderLineAttributeRequest {
7
+ interface Pricing {
8
+ eventName?: string;
9
+ chargeType: Pricing.ChargeType;
10
+ pricePoints: Pricing.PricePoints;
11
+ pricingModel?: Pricing.PricingModel;
12
+ billingFrequency?: Pricing.BillingFrequency;
13
+ billingFrequencyCustomMonths?: number;
14
+ billingType?: Pricing.BillingType;
15
+ signalType?: Pricing.SignalType;
16
+ creditsCurrencyId?: string;
17
+ creditCost?: number;
18
+ overageUnitPrice?: number;
19
+ creditBenefits?: Pricing.CreditBenefits.Item[];
20
+ }
21
+ namespace Pricing {
22
+ const ChargeType: {
23
+ readonly Usage: "usage";
24
+ readonly Recurring: "recurring";
25
+ readonly OneTime: "oneTime";
26
+ readonly SeatBased: "seatBased";
27
+ };
28
+ type ChargeType = (typeof ChargeType)[keyof typeof ChargeType];
29
+ interface PricePoints {
30
+ currency?: string;
31
+ unitPrice: number;
32
+ minQuantity?: number;
33
+ includedQuantity?: number;
34
+ tiers?: PricePoints.Tiers.Item[];
35
+ }
36
+ namespace PricePoints {
37
+ type Tiers = Tiers.Item[];
38
+ namespace Tiers {
39
+ interface Item {
40
+ flatAmount?: number;
41
+ index?: number;
42
+ lowerBound?: number;
43
+ number?: number;
44
+ tierBillingType?: Item.TierBillingType;
45
+ unitAmount?: number;
46
+ upperBound?: number;
47
+ }
48
+ namespace Item {
49
+ const TierBillingType: {
50
+ readonly Flat: "flat";
51
+ readonly PerUnit: "perUnit";
52
+ };
53
+ type TierBillingType = (typeof TierBillingType)[keyof typeof TierBillingType];
54
+ }
55
+ }
56
+ }
57
+ const PricingModel: {
58
+ readonly PerUnit: "perUnit";
59
+ readonly VolumePricing: "volumePricing";
60
+ readonly GraduatedPricing: "graduatedPricing";
61
+ readonly PrepaidCredits: "prepaidCredits";
62
+ readonly Flat: "flat";
63
+ };
64
+ type PricingModel = (typeof PricingModel)[keyof typeof PricingModel];
65
+ const BillingFrequency: {
66
+ readonly Monthly: "monthly";
67
+ readonly Quarterly: "quarterly";
68
+ readonly SemiAnnually: "semiAnnually";
69
+ readonly Annual: "annual";
70
+ readonly Custom: "custom";
71
+ };
72
+ type BillingFrequency = (typeof BillingFrequency)[keyof typeof BillingFrequency];
73
+ const BillingType: {
74
+ readonly Advance: "advance";
75
+ readonly Arrears: "arrears";
76
+ };
77
+ type BillingType = (typeof BillingType)[keyof typeof BillingType];
78
+ const SignalType: {
79
+ readonly Activity: "activity";
80
+ readonly Outcome: "outcome";
81
+ };
82
+ type SignalType = (typeof SignalType)[keyof typeof SignalType];
83
+ type CreditBenefits = CreditBenefits.Item[];
84
+ namespace CreditBenefits {
85
+ interface Item {
86
+ id: string;
87
+ creditsCurrencyId?: string;
88
+ recipient?: Item.Recipient;
89
+ amount: number;
90
+ rolloverAmount?: number;
91
+ rolloverDuration?: number;
92
+ rolloverDurationUnit?: Item.RolloverDurationUnit;
93
+ allocationCadence?: Item.AllocationCadence;
94
+ creditGrantTiming?: Item.CreditGrantTiming;
95
+ }
96
+ namespace Item {
97
+ const Recipient: {
98
+ readonly Organization: "organization";
99
+ readonly Seat: "seat";
100
+ };
101
+ type Recipient = (typeof Recipient)[keyof typeof Recipient];
102
+ const RolloverDurationUnit: {
103
+ readonly Days: "days";
104
+ readonly Months: "months";
105
+ };
106
+ type RolloverDurationUnit = (typeof RolloverDurationUnit)[keyof typeof RolloverDurationUnit];
107
+ const AllocationCadence: {
108
+ readonly Upfront: "upfront";
109
+ readonly Monthly: "monthly";
110
+ };
111
+ type AllocationCadence = (typeof AllocationCadence)[keyof typeof AllocationCadence];
112
+ const CreditGrantTiming: {
113
+ readonly OnPayment: "on_payment";
114
+ readonly OnOrderActivation: "on_order_activation";
115
+ };
116
+ type CreditGrantTiming = (typeof CreditGrantTiming)[keyof typeof CreditGrantTiming];
117
+ }
118
+ }
119
+ }
5
120
  }
@@ -1,2 +1,70 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- export {};
2
+ export var CreateOrderLineAttributeRequest;
3
+ (function (CreateOrderLineAttributeRequest) {
4
+ let Pricing;
5
+ (function (Pricing) {
6
+ Pricing.ChargeType = {
7
+ Usage: "usage",
8
+ Recurring: "recurring",
9
+ OneTime: "oneTime",
10
+ SeatBased: "seatBased",
11
+ };
12
+ let PricePoints;
13
+ (function (PricePoints) {
14
+ let Tiers;
15
+ (function (Tiers) {
16
+ let Item;
17
+ (function (Item) {
18
+ Item.TierBillingType = {
19
+ Flat: "flat",
20
+ PerUnit: "perUnit",
21
+ };
22
+ })(Item = Tiers.Item || (Tiers.Item = {}));
23
+ })(Tiers = PricePoints.Tiers || (PricePoints.Tiers = {}));
24
+ })(PricePoints = Pricing.PricePoints || (Pricing.PricePoints = {}));
25
+ Pricing.PricingModel = {
26
+ PerUnit: "perUnit",
27
+ VolumePricing: "volumePricing",
28
+ GraduatedPricing: "graduatedPricing",
29
+ PrepaidCredits: "prepaidCredits",
30
+ Flat: "flat",
31
+ };
32
+ Pricing.BillingFrequency = {
33
+ Monthly: "monthly",
34
+ Quarterly: "quarterly",
35
+ SemiAnnually: "semiAnnually",
36
+ Annual: "annual",
37
+ Custom: "custom",
38
+ };
39
+ Pricing.BillingType = {
40
+ Advance: "advance",
41
+ Arrears: "arrears",
42
+ };
43
+ Pricing.SignalType = {
44
+ Activity: "activity",
45
+ Outcome: "outcome",
46
+ };
47
+ let CreditBenefits;
48
+ (function (CreditBenefits) {
49
+ let Item;
50
+ (function (Item) {
51
+ Item.Recipient = {
52
+ Organization: "organization",
53
+ Seat: "seat",
54
+ };
55
+ Item.RolloverDurationUnit = {
56
+ Days: "days",
57
+ Months: "months",
58
+ };
59
+ Item.AllocationCadence = {
60
+ Upfront: "upfront",
61
+ Monthly: "monthly",
62
+ };
63
+ Item.CreditGrantTiming = {
64
+ OnPayment: "on_payment",
65
+ OnOrderActivation: "on_order_activation",
66
+ };
67
+ })(Item = CreditBenefits.Item || (CreditBenefits.Item = {}));
68
+ })(CreditBenefits = Pricing.CreditBenefits || (Pricing.CreditBenefits = {}));
69
+ })(Pricing = CreateOrderLineAttributeRequest.Pricing || (CreateOrderLineAttributeRequest.Pricing = {}));
70
+ })(CreateOrderLineAttributeRequest || (CreateOrderLineAttributeRequest = {}));