@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,347 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __rest = (this && this.__rest) || function (s, e) {
46
+ var t = {};
47
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
48
+ t[p] = s[p];
49
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
50
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
51
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
52
+ t[p[i]] = s[p[i]];
53
+ }
54
+ return t;
55
+ };
56
+ Object.defineProperty(exports, "__esModule", { value: true });
57
+ exports.ValueReceipts = void 0;
58
+ const headers_js_1 = require("../../../../core/headers.js");
59
+ const core = __importStar(require("../../../../core/index.js"));
60
+ const environments = __importStar(require("../../../../environments.js"));
61
+ const errors = __importStar(require("../../../../errors/index.js"));
62
+ const Paid = __importStar(require("../../../index.js"));
63
+ class ValueReceipts {
64
+ constructor(_options) {
65
+ this._options = _options;
66
+ }
67
+ /**
68
+ * List value receipts for the organization
69
+ *
70
+ * @param {Paid.ListValueReceiptsRequest} request
71
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
72
+ *
73
+ * @throws {@link Paid.InternalServerError}
74
+ *
75
+ * @example
76
+ * await client.valueReceipts.listValueReceipts()
77
+ */
78
+ listValueReceipts(request = {}, requestOptions) {
79
+ return core.HttpResponsePromise.fromPromise(this.__listValueReceipts(request, requestOptions));
80
+ }
81
+ __listValueReceipts() {
82
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
83
+ var _a, _b, _c, _d, _e, _f, _g, _h;
84
+ const { limit, offset, customerId, orderId } = request;
85
+ const _queryParams = {};
86
+ if (limit != null) {
87
+ _queryParams.limit = limit.toString();
88
+ }
89
+ if (offset != null) {
90
+ _queryParams.offset = offset.toString();
91
+ }
92
+ if (customerId != null) {
93
+ _queryParams.customerId = customerId;
94
+ }
95
+ if (orderId != null) {
96
+ _queryParams.orderId = orderId;
97
+ }
98
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
99
+ const _response = yield core.fetcher({
100
+ 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/"),
101
+ method: "GET",
102
+ headers: _headers,
103
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
104
+ 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,
105
+ 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,
106
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
107
+ });
108
+ if (_response.ok) {
109
+ return { data: _response.body, rawResponse: _response.rawResponse };
110
+ }
111
+ if (_response.error.reason === "status-code") {
112
+ switch (_response.error.statusCode) {
113
+ case 500:
114
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
115
+ default:
116
+ throw new errors.PaidError({
117
+ statusCode: _response.error.statusCode,
118
+ body: _response.error.body,
119
+ rawResponse: _response.rawResponse,
120
+ });
121
+ }
122
+ }
123
+ switch (_response.error.reason) {
124
+ case "non-json":
125
+ throw new errors.PaidError({
126
+ statusCode: _response.error.statusCode,
127
+ body: _response.error.rawBody,
128
+ rawResponse: _response.rawResponse,
129
+ });
130
+ case "timeout":
131
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /value-receipts/.");
132
+ case "unknown":
133
+ throw new errors.PaidError({
134
+ message: _response.error.errorMessage,
135
+ rawResponse: _response.rawResponse,
136
+ });
137
+ }
138
+ });
139
+ }
140
+ /**
141
+ * Get a value receipt by ID, including its publish/share state.
142
+ *
143
+ * @param {Paid.GetValueReceiptByIdRequest} request
144
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
145
+ *
146
+ * @throws {@link Paid.NotFoundError}
147
+ * @throws {@link Paid.InternalServerError}
148
+ *
149
+ * @example
150
+ * await client.valueReceipts.getValueReceiptById({
151
+ * id: "id"
152
+ * })
153
+ */
154
+ getValueReceiptById(request, requestOptions) {
155
+ return core.HttpResponsePromise.fromPromise(this.__getValueReceiptById(request, requestOptions));
156
+ }
157
+ __getValueReceiptById(request, requestOptions) {
158
+ return __awaiter(this, void 0, void 0, function* () {
159
+ var _a, _b, _c, _d, _e, _f, _g, _h;
160
+ const { id } = request;
161
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
162
+ const _response = yield core.fetcher({
163
+ 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)}`),
164
+ method: "GET",
165
+ headers: _headers,
166
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
167
+ 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,
168
+ 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,
169
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
170
+ });
171
+ if (_response.ok) {
172
+ return { data: _response.body, rawResponse: _response.rawResponse };
173
+ }
174
+ if (_response.error.reason === "status-code") {
175
+ switch (_response.error.statusCode) {
176
+ case 404:
177
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
178
+ case 500:
179
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
180
+ default:
181
+ throw new errors.PaidError({
182
+ statusCode: _response.error.statusCode,
183
+ body: _response.error.body,
184
+ rawResponse: _response.rawResponse,
185
+ });
186
+ }
187
+ }
188
+ switch (_response.error.reason) {
189
+ case "non-json":
190
+ throw new errors.PaidError({
191
+ statusCode: _response.error.statusCode,
192
+ body: _response.error.rawBody,
193
+ rawResponse: _response.rawResponse,
194
+ });
195
+ case "timeout":
196
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling GET /value-receipts/{id}.");
197
+ case "unknown":
198
+ throw new errors.PaidError({
199
+ message: _response.error.errorMessage,
200
+ rawResponse: _response.rawResponse,
201
+ });
202
+ }
203
+ });
204
+ }
205
+ /**
206
+ * Make a value receipt publicly accessible via URL.
207
+ *
208
+ * @param {Paid.PublishValueReceiptBody} request
209
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
210
+ *
211
+ * @throws {@link Paid.NotFoundError}
212
+ * @throws {@link Paid.InternalServerError}
213
+ *
214
+ * @example
215
+ * await client.valueReceipts.publishValueReceipt({
216
+ * id: "id"
217
+ * })
218
+ */
219
+ publishValueReceipt(request, requestOptions) {
220
+ return core.HttpResponsePromise.fromPromise(this.__publishValueReceipt(request, requestOptions));
221
+ }
222
+ __publishValueReceipt(request, requestOptions) {
223
+ return __awaiter(this, void 0, void 0, function* () {
224
+ var _a, _b, _c, _d, _e, _f, _g, _h;
225
+ const { id } = request, _body = __rest(request, ["id"]);
226
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
227
+ const _response = yield core.fetcher({
228
+ 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`),
229
+ method: "POST",
230
+ headers: _headers,
231
+ contentType: "application/json",
232
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
233
+ requestType: "json",
234
+ body: _body,
235
+ 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,
236
+ 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,
237
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
238
+ });
239
+ if (_response.ok) {
240
+ return { data: _response.body, rawResponse: _response.rawResponse };
241
+ }
242
+ if (_response.error.reason === "status-code") {
243
+ switch (_response.error.statusCode) {
244
+ case 404:
245
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
246
+ case 500:
247
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
248
+ default:
249
+ throw new errors.PaidError({
250
+ statusCode: _response.error.statusCode,
251
+ body: _response.error.body,
252
+ rawResponse: _response.rawResponse,
253
+ });
254
+ }
255
+ }
256
+ switch (_response.error.reason) {
257
+ case "non-json":
258
+ throw new errors.PaidError({
259
+ statusCode: _response.error.statusCode,
260
+ body: _response.error.rawBody,
261
+ rawResponse: _response.rawResponse,
262
+ });
263
+ case "timeout":
264
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /value-receipts/{id}/publish.");
265
+ case "unknown":
266
+ throw new errors.PaidError({
267
+ message: _response.error.errorMessage,
268
+ rawResponse: _response.rawResponse,
269
+ });
270
+ }
271
+ });
272
+ }
273
+ /**
274
+ * Revoke public access to a value receipt.
275
+ *
276
+ * @param {Paid.UnpublishValueReceiptRequest} request
277
+ * @param {ValueReceipts.RequestOptions} requestOptions - Request-specific configuration.
278
+ *
279
+ * @throws {@link Paid.NotFoundError}
280
+ * @throws {@link Paid.InternalServerError}
281
+ *
282
+ * @example
283
+ * await client.valueReceipts.unpublishValueReceipt({
284
+ * id: "id"
285
+ * })
286
+ */
287
+ unpublishValueReceipt(request, requestOptions) {
288
+ return core.HttpResponsePromise.fromPromise(this.__unpublishValueReceipt(request, requestOptions));
289
+ }
290
+ __unpublishValueReceipt(request, requestOptions) {
291
+ return __awaiter(this, void 0, void 0, function* () {
292
+ var _a, _b, _c, _d, _e, _f, _g, _h;
293
+ const { id } = request, _body = __rest(request, ["id"]);
294
+ const _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
295
+ const _response = yield core.fetcher({
296
+ 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`),
297
+ method: "POST",
298
+ headers: _headers,
299
+ contentType: "application/json",
300
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
301
+ requestType: "json",
302
+ body: _body,
303
+ 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,
304
+ 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,
305
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
306
+ });
307
+ if (_response.ok) {
308
+ return { data: _response.body, rawResponse: _response.rawResponse };
309
+ }
310
+ if (_response.error.reason === "status-code") {
311
+ switch (_response.error.statusCode) {
312
+ case 404:
313
+ throw new Paid.NotFoundError(_response.error.body, _response.rawResponse);
314
+ case 500:
315
+ throw new Paid.InternalServerError(_response.error.body, _response.rawResponse);
316
+ default:
317
+ throw new errors.PaidError({
318
+ statusCode: _response.error.statusCode,
319
+ body: _response.error.body,
320
+ rawResponse: _response.rawResponse,
321
+ });
322
+ }
323
+ }
324
+ switch (_response.error.reason) {
325
+ case "non-json":
326
+ throw new errors.PaidError({
327
+ statusCode: _response.error.statusCode,
328
+ body: _response.error.rawBody,
329
+ rawResponse: _response.rawResponse,
330
+ });
331
+ case "timeout":
332
+ throw new errors.PaidTimeoutError("Timeout exceeded when calling POST /value-receipts/{id}/unpublish.");
333
+ case "unknown":
334
+ throw new errors.PaidError({
335
+ message: _response.error.errorMessage,
336
+ rawResponse: _response.rawResponse,
337
+ });
338
+ }
339
+ });
340
+ }
341
+ _getAuthorizationHeader() {
342
+ return __awaiter(this, void 0, void 0, function* () {
343
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
344
+ });
345
+ }
346
+ }
347
+ exports.ValueReceipts = ValueReceipts;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface GetValueReceiptByIdRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "id"
5
+ * }
6
+ */
7
+ export interface UnpublishValueReceiptRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type { GetValueReceiptByIdRequest } from "./GetValueReceiptByIdRequest.js";
2
+ export type { ListValueReceiptsRequest } from "./ListValueReceiptsRequest.js";
3
+ export type { PublishValueReceiptBody } from "./PublishValueReceiptBody.js";
4
+ export type { UnpublishValueReceiptRequest } from "./UnpublishValueReceiptRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export * from "./client/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./client/index.js"), exports);
@@ -0,0 +1,19 @@
1
+ import type * as Paid from "../index.js";
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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,5 @@
1
+ import type * as Paid from "../index.js";
2
+ export interface CheckoutListResponse {
3
+ data: Paid.Checkout[];
4
+ pagination: Paid.Pagination;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface CheckoutProduct {
2
+ id: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface CheckoutProductInput {
2
+ id: string;
3
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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,10 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.CheckoutStatus = void 0;
5
+ exports.CheckoutStatus = {
6
+ Active: "active",
7
+ Completed: "completed",
8
+ Expired: "expired",
9
+ Archived: "archived",
10
+ };