@peable.to/contracts 0.3.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/dist/cjs/common/address.js +81 -0
  2. package/dist/cjs/common/envelopes.js +101 -0
  3. package/dist/cjs/common/objects.js +85 -0
  4. package/dist/cjs/common/params.js +211 -0
  5. package/dist/cjs/common/primitives.js +39 -0
  6. package/dist/cjs/contributions.js +22 -0
  7. package/dist/cjs/index.js +40 -97
  8. package/dist/cjs/openapi/document.js +297 -0
  9. package/dist/cjs/openapi/index.js +7 -0
  10. package/dist/cjs/openapi/webhooks.js +17 -0
  11. package/dist/cjs/resources/billingEngine/billingPortal.js +237 -0
  12. package/dist/cjs/resources/billingEngine/creditNotes.js +189 -0
  13. package/dist/cjs/resources/billingEngine/customerBalanceTransactions.js +90 -0
  14. package/dist/cjs/resources/billingEngine/index.js +43 -0
  15. package/dist/cjs/resources/billingEngine/invoiceItems.js +155 -0
  16. package/dist/cjs/resources/billingEngine/invoices.js +509 -0
  17. package/dist/cjs/resources/billingEngine/params.js +43 -0
  18. package/dist/cjs/resources/billingEngine/public.js +326 -0
  19. package/dist/cjs/resources/billingEngine/subscriptions.js +476 -0
  20. package/dist/cjs/resources/catalog/billing.js +755 -0
  21. package/dist/cjs/resources/catalog/billingSettings.js +131 -0
  22. package/dist/cjs/resources/catalog/coupons.js +222 -0
  23. package/dist/cjs/resources/catalog/entitlements.js +257 -0
  24. package/dist/cjs/resources/catalog/index.js +58 -0
  25. package/dist/cjs/resources/catalog/meters.js +279 -0
  26. package/dist/cjs/resources/catalog/prices.js +423 -0
  27. package/dist/cjs/resources/catalog/products.js +228 -0
  28. package/dist/cjs/resources/catalog/promotionCodes.js +174 -0
  29. package/dist/cjs/resources/catalog/shared.js +75 -0
  30. package/dist/cjs/resources/catalog/testClocks.js +127 -0
  31. package/dist/cjs/resources/checkout/checkoutSessions.js +582 -0
  32. package/dist/cjs/resources/checkout/contributions.js +172 -0
  33. package/dist/cjs/resources/checkout/files.js +133 -0
  34. package/dist/cjs/resources/checkout/index.js +57 -0
  35. package/dist/cjs/resources/checkout/merchants.js +290 -0
  36. package/dist/cjs/resources/checkout/paymentLinks.js +330 -0
  37. package/dist/cjs/resources/checkout/paymentMethodConfigurations.js +262 -0
  38. package/dist/cjs/resources/checkout/shared.js +368 -0
  39. package/dist/cjs/resources/connect/account.js +332 -0
  40. package/dist/cjs/resources/connect/applicationFees.js +113 -0
  41. package/dist/cjs/resources/connect/balance.js +212 -0
  42. package/dist/cjs/resources/connect/connectedAccounts.js +260 -0
  43. package/dist/cjs/resources/connect/index.js +51 -0
  44. package/dist/cjs/resources/connect/onboarding.js +82 -0
  45. package/dist/cjs/resources/connect/payouts.js +196 -0
  46. package/dist/cjs/resources/connect/reporting.js +235 -0
  47. package/dist/cjs/resources/connect/requestLogs.js +110 -0
  48. package/dist/cjs/resources/connect/transfers.js +227 -0
  49. package/dist/cjs/resources/core/customers.js +194 -0
  50. package/dist/cjs/resources/core/index.js +23 -0
  51. package/dist/cjs/resources/core/paymentMethods.js +134 -0
  52. package/dist/cjs/resources/events/events.js +357 -0
  53. package/dist/cjs/resources/events/index.js +29 -0
  54. package/dist/cjs/resources/events/webhookDeliveries.js +93 -0
  55. package/dist/cjs/resources/events/webhookEndpoints.js +215 -0
  56. package/dist/cjs/resources/payments/charges.js +157 -0
  57. package/dist/cjs/resources/payments/disputes.js +204 -0
  58. package/dist/cjs/resources/payments/index.js +41 -0
  59. package/dist/cjs/resources/payments/paymentIntents.js +529 -0
  60. package/dist/cjs/resources/payments/refunds.js +245 -0
  61. package/dist/cjs/resources/payments/setupIntents.js +158 -0
  62. package/dist/cjs/resources/payments/social.js +182 -0
  63. package/dist/cjs/resources/payments/testHelpers.js +39 -0
  64. package/dist/cjs/resources/tax/assessments.js +217 -0
  65. package/dist/cjs/resources/tax/businessProfile.js +99 -0
  66. package/dist/cjs/resources/tax/calculations.js +176 -0
  67. package/dist/cjs/resources/tax/capabilities.js +42 -0
  68. package/dist/cjs/resources/tax/codes.js +37 -0
  69. package/dist/cjs/resources/tax/complianceActions.js +56 -0
  70. package/dist/cjs/resources/tax/deadlines.js +59 -0
  71. package/dist/cjs/resources/tax/documents.js +128 -0
  72. package/dist/cjs/resources/tax/index.js +80 -0
  73. package/dist/cjs/resources/tax/locationEvidence.js +131 -0
  74. package/dist/cjs/resources/tax/operatingLocations.js +98 -0
  75. package/dist/cjs/resources/tax/products.js +67 -0
  76. package/dist/cjs/resources/tax/registrationDeclarations.js +124 -0
  77. package/dist/cjs/resources/tax/registrations.js +82 -0
  78. package/dist/cjs/resources/tax/reports.js +92 -0
  79. package/dist/cjs/resources/tax/reviewItems.js +116 -0
  80. package/dist/cjs/resources/tax/ruleSet.js +68 -0
  81. package/dist/cjs/resources/tax/salesDestinations.js +94 -0
  82. package/dist/cjs/resources/tax/settings.js +104 -0
  83. package/dist/cjs/resources/tax/shared.js +62 -0
  84. package/dist/cjs/resources/tax/transactions.js +102 -0
  85. package/dist/cjs/route.js +22 -0
  86. package/dist/cjs/routes.js +31 -0
  87. package/dist/cjs/vocabulary/billingPortal.js +15 -0
  88. package/dist/cjs/vocabulary/catalog.js +110 -0
  89. package/dist/cjs/vocabulary/checkout.js +53 -0
  90. package/dist/cjs/vocabulary/connect.js +95 -0
  91. package/dist/cjs/vocabulary/errors.js +174 -0
  92. package/dist/cjs/vocabulary/events.js +176 -0
  93. package/dist/cjs/vocabulary/files.js +44 -0
  94. package/dist/cjs/vocabulary/index.js +37 -0
  95. package/dist/cjs/vocabulary/invoices.js +52 -0
  96. package/dist/cjs/vocabulary/lists.js +22 -0
  97. package/dist/cjs/vocabulary/merchants.js +23 -0
  98. package/dist/cjs/vocabulary/money.js +104 -0
  99. package/dist/cjs/vocabulary/paymentMethodConfigurations.js +36 -0
  100. package/dist/cjs/vocabulary/payments.js +195 -0
  101. package/dist/cjs/vocabulary/reporting.js +27 -0
  102. package/dist/cjs/vocabulary/subscriptions.js +60 -0
  103. package/dist/cjs/vocabulary/tax.js +237 -0
  104. package/dist/cjs/vocabulary/version.js +12 -0
  105. package/dist/esm/common/address.js +76 -0
  106. package/dist/esm/common/envelopes.js +95 -0
  107. package/dist/esm/common/objects.js +74 -0
  108. package/dist/esm/common/params.js +203 -0
  109. package/dist/esm/common/primitives.js +35 -0
  110. package/dist/esm/contributions.js +5 -0
  111. package/dist/esm/index.js +26 -94
  112. package/dist/esm/openapi/document.js +294 -0
  113. package/dist/esm/openapi/index.js +2 -0
  114. package/dist/esm/openapi/webhooks.js +14 -0
  115. package/dist/esm/resources/billingEngine/billingPortal.js +234 -0
  116. package/dist/esm/resources/billingEngine/creditNotes.js +186 -0
  117. package/dist/esm/resources/billingEngine/customerBalanceTransactions.js +87 -0
  118. package/dist/esm/resources/billingEngine/index.js +26 -0
  119. package/dist/esm/resources/billingEngine/invoiceItems.js +152 -0
  120. package/dist/esm/resources/billingEngine/invoices.js +506 -0
  121. package/dist/esm/resources/billingEngine/params.js +39 -0
  122. package/dist/esm/resources/billingEngine/public.js +323 -0
  123. package/dist/esm/resources/billingEngine/subscriptions.js +473 -0
  124. package/dist/esm/resources/catalog/billing.js +752 -0
  125. package/dist/esm/resources/catalog/billingSettings.js +128 -0
  126. package/dist/esm/resources/catalog/coupons.js +219 -0
  127. package/dist/esm/resources/catalog/entitlements.js +254 -0
  128. package/dist/esm/resources/catalog/index.js +38 -0
  129. package/dist/esm/resources/catalog/meters.js +276 -0
  130. package/dist/esm/resources/catalog/prices.js +419 -0
  131. package/dist/esm/resources/catalog/products.js +225 -0
  132. package/dist/esm/resources/catalog/promotionCodes.js +171 -0
  133. package/dist/esm/resources/catalog/shared.js +67 -0
  134. package/dist/esm/resources/catalog/testClocks.js +124 -0
  135. package/dist/esm/resources/checkout/checkoutSessions.js +579 -0
  136. package/dist/esm/resources/checkout/contributions.js +167 -0
  137. package/dist/esm/resources/checkout/files.js +130 -0
  138. package/dist/esm/resources/checkout/index.js +25 -0
  139. package/dist/esm/resources/checkout/merchants.js +287 -0
  140. package/dist/esm/resources/checkout/paymentLinks.js +327 -0
  141. package/dist/esm/resources/checkout/paymentMethodConfigurations.js +259 -0
  142. package/dist/esm/resources/checkout/shared.js +363 -0
  143. package/dist/esm/resources/connect/account.js +329 -0
  144. package/dist/esm/resources/connect/applicationFees.js +110 -0
  145. package/dist/esm/resources/connect/balance.js +209 -0
  146. package/dist/esm/resources/connect/connectedAccounts.js +257 -0
  147. package/dist/esm/resources/connect/index.js +34 -0
  148. package/dist/esm/resources/connect/onboarding.js +79 -0
  149. package/dist/esm/resources/connect/payouts.js +193 -0
  150. package/dist/esm/resources/connect/reporting.js +232 -0
  151. package/dist/esm/resources/connect/requestLogs.js +107 -0
  152. package/dist/esm/resources/connect/transfers.js +224 -0
  153. package/dist/esm/resources/core/customers.js +191 -0
  154. package/dist/esm/resources/core/index.js +6 -0
  155. package/dist/esm/resources/core/paymentMethods.js +131 -0
  156. package/dist/esm/resources/events/events.js +353 -0
  157. package/dist/esm/resources/events/index.js +12 -0
  158. package/dist/esm/resources/events/webhookDeliveries.js +90 -0
  159. package/dist/esm/resources/events/webhookEndpoints.js +212 -0
  160. package/dist/esm/resources/payments/charges.js +154 -0
  161. package/dist/esm/resources/payments/disputes.js +201 -0
  162. package/dist/esm/resources/payments/index.js +24 -0
  163. package/dist/esm/resources/payments/paymentIntents.js +526 -0
  164. package/dist/esm/resources/payments/refunds.js +242 -0
  165. package/dist/esm/resources/payments/setupIntents.js +155 -0
  166. package/dist/esm/resources/payments/social.js +179 -0
  167. package/dist/esm/resources/payments/testHelpers.js +36 -0
  168. package/dist/esm/resources/tax/assessments.js +214 -0
  169. package/dist/esm/resources/tax/businessProfile.js +96 -0
  170. package/dist/esm/resources/tax/calculations.js +173 -0
  171. package/dist/esm/resources/tax/capabilities.js +39 -0
  172. package/dist/esm/resources/tax/codes.js +34 -0
  173. package/dist/esm/resources/tax/complianceActions.js +53 -0
  174. package/dist/esm/resources/tax/deadlines.js +56 -0
  175. package/dist/esm/resources/tax/documents.js +125 -0
  176. package/dist/esm/resources/tax/index.js +63 -0
  177. package/dist/esm/resources/tax/locationEvidence.js +128 -0
  178. package/dist/esm/resources/tax/operatingLocations.js +95 -0
  179. package/dist/esm/resources/tax/products.js +64 -0
  180. package/dist/esm/resources/tax/registrationDeclarations.js +121 -0
  181. package/dist/esm/resources/tax/registrations.js +79 -0
  182. package/dist/esm/resources/tax/reports.js +89 -0
  183. package/dist/esm/resources/tax/reviewItems.js +113 -0
  184. package/dist/esm/resources/tax/ruleSet.js +65 -0
  185. package/dist/esm/resources/tax/salesDestinations.js +91 -0
  186. package/dist/esm/resources/tax/settings.js +101 -0
  187. package/dist/esm/resources/tax/shared.js +58 -0
  188. package/dist/esm/resources/tax/transactions.js +99 -0
  189. package/dist/esm/route.js +16 -0
  190. package/dist/esm/routes.js +27 -0
  191. package/dist/esm/vocabulary/billingPortal.js +12 -0
  192. package/dist/esm/vocabulary/catalog.js +106 -0
  193. package/dist/esm/vocabulary/checkout.js +50 -0
  194. package/dist/esm/vocabulary/connect.js +92 -0
  195. package/dist/esm/vocabulary/errors.js +169 -0
  196. package/dist/esm/vocabulary/events.js +173 -0
  197. package/dist/esm/vocabulary/files.js +41 -0
  198. package/dist/esm/vocabulary/index.js +21 -0
  199. package/dist/esm/vocabulary/invoices.js +49 -0
  200. package/dist/esm/vocabulary/lists.js +19 -0
  201. package/dist/esm/vocabulary/merchants.js +20 -0
  202. package/dist/esm/vocabulary/money.js +98 -0
  203. package/dist/esm/vocabulary/paymentMethodConfigurations.js +33 -0
  204. package/dist/esm/vocabulary/payments.js +192 -0
  205. package/dist/esm/vocabulary/reporting.js +24 -0
  206. package/dist/esm/vocabulary/subscriptions.js +57 -0
  207. package/dist/esm/vocabulary/tax.js +233 -0
  208. package/dist/esm/vocabulary/version.js +9 -0
  209. package/dist/types/common/address.d.ts +62 -0
  210. package/dist/types/common/envelopes.d.ts +88 -0
  211. package/dist/types/common/objects.d.ts +107 -0
  212. package/dist/types/common/params.d.ts +156 -0
  213. package/dist/types/common/primitives.d.ts +56 -0
  214. package/dist/types/contributions.d.ts +1 -0
  215. package/dist/types/index.d.ts +16 -134
  216. package/dist/types/openapi/document.d.ts +16 -0
  217. package/dist/types/openapi/index.d.ts +2 -0
  218. package/dist/types/openapi/webhooks.d.ts +15 -0
  219. package/dist/types/resources/billingEngine/billingPortal.d.ts +742 -0
  220. package/dist/types/resources/billingEngine/creditNotes.d.ts +655 -0
  221. package/dist/types/resources/billingEngine/customerBalanceTransactions.d.ts +282 -0
  222. package/dist/types/resources/billingEngine/index.d.ts +6071 -0
  223. package/dist/types/resources/billingEngine/invoiceItems.d.ts +502 -0
  224. package/dist/types/resources/billingEngine/invoices.d.ts +2547 -0
  225. package/dist/types/resources/billingEngine/params.d.ts +51 -0
  226. package/dist/types/resources/billingEngine/public.d.ts +1860 -0
  227. package/dist/types/resources/billingEngine/subscriptions.d.ts +1519 -0
  228. package/dist/types/resources/catalog/billing.d.ts +1723 -0
  229. package/dist/types/resources/catalog/billingSettings.d.ts +160 -0
  230. package/dist/types/resources/catalog/coupons.d.ts +403 -0
  231. package/dist/types/resources/catalog/entitlements.d.ts +422 -0
  232. package/dist/types/resources/catalog/index.d.ts +3155 -0
  233. package/dist/types/resources/catalog/meters.d.ts +474 -0
  234. package/dist/types/resources/catalog/prices.d.ts +1091 -0
  235. package/dist/types/resources/catalog/products.d.ts +430 -0
  236. package/dist/types/resources/catalog/promotionCodes.d.ts +369 -0
  237. package/dist/types/resources/catalog/shared.d.ts +34 -0
  238. package/dist/types/resources/catalog/testClocks.d.ts +220 -0
  239. package/dist/types/resources/checkout/checkoutSessions.d.ts +3207 -0
  240. package/dist/types/resources/checkout/contributions.d.ts +375 -0
  241. package/dist/types/resources/checkout/files.d.ts +280 -0
  242. package/dist/types/resources/checkout/index.d.ts +5678 -0
  243. package/dist/types/resources/checkout/merchants.d.ts +395 -0
  244. package/dist/types/resources/checkout/paymentLinks.d.ts +1728 -0
  245. package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +2104 -0
  246. package/dist/types/resources/checkout/shared.d.ts +419 -0
  247. package/dist/types/resources/connect/account.d.ts +483 -0
  248. package/dist/types/resources/connect/applicationFees.d.ts +198 -0
  249. package/dist/types/resources/connect/balance.d.ts +399 -0
  250. package/dist/types/resources/connect/connectedAccounts.d.ts +494 -0
  251. package/dist/types/resources/connect/index.d.ts +2094 -0
  252. package/dist/types/resources/connect/onboarding.d.ts +95 -0
  253. package/dist/types/resources/connect/payouts.d.ts +527 -0
  254. package/dist/types/resources/connect/reporting.d.ts +506 -0
  255. package/dist/types/resources/connect/requestLogs.d.ts +236 -0
  256. package/dist/types/resources/connect/transfers.d.ts +436 -0
  257. package/dist/types/resources/core/customers.d.ts +619 -0
  258. package/dist/types/resources/core/index.d.ts +679 -0
  259. package/dist/types/resources/core/paymentMethods.d.ts +336 -0
  260. package/dist/types/resources/events/events.d.ts +731 -0
  261. package/dist/types/resources/events/index.d.ts +1727 -0
  262. package/dist/types/resources/events/webhookDeliveries.d.ts +436 -0
  263. package/dist/types/resources/events/webhookEndpoints.d.ts +1502 -0
  264. package/dist/types/resources/payments/charges.d.ts +390 -0
  265. package/dist/types/resources/payments/disputes.d.ts +822 -0
  266. package/dist/types/resources/payments/index.d.ts +3517 -0
  267. package/dist/types/resources/payments/paymentIntents.d.ts +2080 -0
  268. package/dist/types/resources/payments/refunds.d.ts +684 -0
  269. package/dist/types/resources/payments/setupIntents.d.ts +391 -0
  270. package/dist/types/resources/payments/social.d.ts +266 -0
  271. package/dist/types/resources/payments/testHelpers.d.ts +178 -0
  272. package/dist/types/resources/tax/assessments.d.ts +787 -0
  273. package/dist/types/resources/tax/businessProfile.d.ts +134 -0
  274. package/dist/types/resources/tax/calculations.d.ts +261 -0
  275. package/dist/types/resources/tax/capabilities.d.ts +81 -0
  276. package/dist/types/resources/tax/codes.d.ts +29 -0
  277. package/dist/types/resources/tax/complianceActions.d.ts +97 -0
  278. package/dist/types/resources/tax/deadlines.d.ts +133 -0
  279. package/dist/types/resources/tax/documents.d.ts +257 -0
  280. package/dist/types/resources/tax/index.d.ts +1946 -0
  281. package/dist/types/resources/tax/locationEvidence.d.ts +246 -0
  282. package/dist/types/resources/tax/operatingLocations.d.ts +170 -0
  283. package/dist/types/resources/tax/products.d.ts +68 -0
  284. package/dist/types/resources/tax/registrationDeclarations.d.ts +270 -0
  285. package/dist/types/resources/tax/registrations.d.ts +103 -0
  286. package/dist/types/resources/tax/reports.d.ts +129 -0
  287. package/dist/types/resources/tax/reviewItems.d.ts +226 -0
  288. package/dist/types/resources/tax/ruleSet.d.ts +219 -0
  289. package/dist/types/resources/tax/salesDestinations.d.ts +158 -0
  290. package/dist/types/resources/tax/settings.d.ts +122 -0
  291. package/dist/types/resources/tax/shared.d.ts +43 -0
  292. package/dist/types/resources/tax/transactions.d.ts +404 -0
  293. package/dist/types/route.d.ts +86 -0
  294. package/dist/types/routes.d.ts +23 -0
  295. package/dist/types/vocabulary/billingPortal.d.ts +15 -0
  296. package/dist/types/vocabulary/catalog.d.ts +97 -0
  297. package/dist/types/vocabulary/checkout.d.ts +49 -0
  298. package/dist/types/vocabulary/connect.d.ts +62 -0
  299. package/dist/types/vocabulary/errors.d.ts +145 -0
  300. package/dist/types/vocabulary/events.d.ts +171 -0
  301. package/dist/types/vocabulary/files.d.ts +30 -0
  302. package/dist/types/vocabulary/index.d.ts +17 -0
  303. package/dist/types/vocabulary/invoices.d.ts +39 -0
  304. package/dist/types/vocabulary/lists.d.ts +9 -0
  305. package/dist/types/vocabulary/merchants.d.ts +9 -0
  306. package/dist/types/vocabulary/money.d.ts +59 -0
  307. package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +22 -0
  308. package/dist/types/vocabulary/payments.d.ts +117 -0
  309. package/dist/types/vocabulary/reporting.d.ts +18 -0
  310. package/dist/types/vocabulary/subscriptions.d.ts +45 -0
  311. package/dist/types/vocabulary/tax.d.ts +163 -0
  312. package/dist/types/vocabulary/version.d.ts +10 -0
  313. package/package.json +51 -11
  314. package/dist/cjs/openapi.js +0 -138
  315. package/dist/esm/openapi.js +0 -134
  316. package/dist/types/openapi.d.ts +0 -145
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.billingSettingsRoutes = exports.updateBillingSettingsParams = exports.billingSettingsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const objects_1 = require("../../common/objects");
6
+ const params_1 = require("../../common/params");
7
+ const primitives_1 = require("../../common/primitives");
8
+ const route_1 = require("../../route");
9
+ const catalog_1 = require("../../vocabulary/catalog");
10
+ /**
11
+ * The merchant's billing settings (ADR 0018 §5; one per merchant and mode).
12
+ * Every field has a default, so a merchant that never opens the screen bills
13
+ * correctly:
14
+ *
15
+ * - `invoice_prefix`: derived from the merchant id; numbers are
16
+ * `PREFIX-0001`, gapless per merchant.
17
+ * - `dunning.retry_schedule_days`: `[1, 3, 5, 7]` — each retry so many days
18
+ * after the previous attempt (16 days, four retries, Stripe's default
19
+ * window).
20
+ * - `dunning.final_action`: `cancel` — the subscription ends when the last
21
+ * retry fails; `dunning.invoice_action`: `mark_uncollectible`.
22
+ * - emails on: the payer is told when an invoice is finalized for them
23
+ * (`send_invoice`) and when a payment fails.
24
+ */
25
+ exports.billingSettingsSchema = (0, objects_1.defineObject)('billing_settings', 'BillingSettings', zod_1.z
26
+ .object({
27
+ object: zod_1.z.literal('billing_settings'),
28
+ livemode: primitives_1.livemode,
29
+ invoice_prefix: zod_1.z.string().describe('Invoice numbers are `PREFIX-0001`, gapless.'),
30
+ next_invoice_sequence: zod_1.z
31
+ .number()
32
+ .int()
33
+ .describe('The next invoice number that will be assigned.'),
34
+ default_days_until_due: zod_1.z.number().int(),
35
+ dunning: zod_1.z
36
+ .object({
37
+ retry_schedule_days: zod_1.z
38
+ .array(zod_1.z.number().int())
39
+ .describe('Each retry so many days after the previous attempt.'),
40
+ final_action: zod_1.z
41
+ .enum(catalog_1.DUNNING_FINAL_ACTIONS)
42
+ .describe('What happens to the subscription once the last retry fails.'),
43
+ invoice_action: zod_1.z
44
+ .enum(catalog_1.DUNNING_INVOICE_ACTIONS)
45
+ .describe('What happens to the invoice once the last retry fails.'),
46
+ })
47
+ .strict(),
48
+ emails: zod_1.z
49
+ .object({
50
+ invoice_finalized: zod_1.z.boolean(),
51
+ payment_failed: zod_1.z.boolean(),
52
+ })
53
+ .strict(),
54
+ updated: primitives_1.unixSeconds,
55
+ })
56
+ .strict(), {
57
+ examples: [
58
+ {
59
+ object: 'billing_settings',
60
+ livemode: false,
61
+ invoice_prefix: 'MENTION',
62
+ next_invoice_sequence: 1,
63
+ default_days_until_due: 30,
64
+ dunning: {
65
+ retry_schedule_days: [1, 3, 5, 7],
66
+ final_action: 'cancel',
67
+ invoice_action: 'mark_uncollectible',
68
+ },
69
+ emails: { invoice_finalized: true, payment_failed: true },
70
+ updated: 1793750400,
71
+ },
72
+ ],
73
+ });
74
+ exports.updateBillingSettingsParams = zod_1.z
75
+ .object({
76
+ invoice_prefix: zod_1.z
77
+ .string()
78
+ .regex(new RegExp(catalog_1.BILLING_SETTINGS_LIMITS.invoicePrefixPattern))
79
+ .optional()
80
+ .describe('3–12 uppercase letters and digits.'),
81
+ default_days_until_due: zod_1.z
82
+ .number()
83
+ .int()
84
+ .min(0)
85
+ .max(catalog_1.BILLING_SETTINGS_LIMITS.daysUntilDueMax)
86
+ .optional(),
87
+ dunning: zod_1.z
88
+ .object({
89
+ retry_schedule_days: zod_1.z
90
+ .array(zod_1.z.number().int().min(1).max(catalog_1.BILLING_SETTINGS_LIMITS.retryDaysMax))
91
+ .max(catalog_1.BILLING_SETTINGS_LIMITS.retriesMax)
92
+ .optional(),
93
+ final_action: zod_1.z.enum(catalog_1.DUNNING_FINAL_ACTIONS).optional(),
94
+ invoice_action: zod_1.z.enum(catalog_1.DUNNING_INVOICE_ACTIONS).optional(),
95
+ })
96
+ .strict()
97
+ .optional(),
98
+ emails: zod_1.z
99
+ .object({ invoice_finalized: zod_1.z.boolean().optional(), payment_failed: zod_1.z.boolean().optional() })
100
+ .strict()
101
+ .optional(),
102
+ })
103
+ .strict();
104
+ exports.billingSettingsRoutes = [
105
+ (0, route_1.defineRoute)({
106
+ operationId: 'retrieveBillingSettings',
107
+ method: 'get',
108
+ path: '/v1/billing_settings',
109
+ tag: 'Billing settings',
110
+ summary: 'Retrieve the billing settings',
111
+ auth: 'service',
112
+ scope: 'payments:read',
113
+ query: params_1.expandOnlyQuery,
114
+ response: exports.billingSettingsSchema,
115
+ sdk: 'billingSettings.retrieve',
116
+ }),
117
+ (0, route_1.defineRoute)({
118
+ operationId: 'updateBillingSettings',
119
+ method: 'post',
120
+ path: '/v1/billing_settings',
121
+ tag: 'Billing settings',
122
+ summary: 'Update the billing settings',
123
+ description: 'Invoice numbering, the default payment term, dunning and the payer emails.',
124
+ auth: 'service',
125
+ scope: 'payments:write',
126
+ idempotent: true,
127
+ body: exports.updateBillingSettingsParams,
128
+ response: exports.billingSettingsSchema,
129
+ sdk: 'billingSettings.update',
130
+ }),
131
+ ];
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.couponRoutes = exports.listCouponsQuery = exports.updateCouponParams = exports.createCouponParams = exports.deletedCouponSchema = exports.couponSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const envelopes_1 = require("../../common/envelopes");
6
+ const objects_1 = require("../../common/objects");
7
+ const params_1 = require("../../common/params");
8
+ const primitives_1 = require("../../common/primitives");
9
+ const route_1 = require("../../route");
10
+ const catalog_1 = require("../../vocabulary/catalog");
11
+ const shared_1 = require("./shared");
12
+ /**
13
+ * Coupons (ADR 0018) — a discount, by percentage or by a fixed amount in one
14
+ * currency. Its `id` is the merchant's own (`SUMMER25`) or generated
15
+ * (`coupon_…`), and names that one coupon forever: a deleted coupon's id is
16
+ * never reused. Only `name` and `metadata` change; the terms of a discount a
17
+ * customer already holds cannot.
18
+ */
19
+ exports.couponSchema = (0, objects_1.defineObject)('coupon', 'Coupon', zod_1.z
20
+ .object({
21
+ id: zod_1.z.string(),
22
+ object: zod_1.z.literal('coupon'),
23
+ livemode: primitives_1.livemode,
24
+ name: zod_1.z.string().nullable(),
25
+ percent_off: zod_1.z
26
+ .number()
27
+ .nullable()
28
+ .describe('0 < x ≤ 100, at most two decimals. Set exactly when `amount_off` is not.'),
29
+ amount_off: primitives_1.amount.nullable().describe('Base units taken off, in `currency`.'),
30
+ currency: primitives_1.currency.nullable(),
31
+ duration: zod_1.z.enum(catalog_1.COUPON_DURATIONS),
32
+ duration_in_months: zod_1.z
33
+ .number()
34
+ .int()
35
+ .nullable()
36
+ .describe('Months a `repeating` coupon lasts; `null` otherwise.'),
37
+ max_redemptions: zod_1.z.number().int().nullable(),
38
+ redeem_by: primitives_1.unixSeconds.nullable().describe('The last instant it can be redeemed.'),
39
+ times_redeemed: zod_1.z.number().int(),
40
+ valid: zod_1.z
41
+ .boolean()
42
+ .describe('Whether it can still be redeemed: not past `redeem_by` and not used up.'),
43
+ applies_to: zod_1.z
44
+ .object({ products: zod_1.z.array(zod_1.z.string()) })
45
+ .strict()
46
+ .nullable()
47
+ .describe('The products (`prod_…`) it is restricted to, or `null` for every product.'),
48
+ metadata: primitives_1.metadata,
49
+ created: primitives_1.unixSeconds,
50
+ })
51
+ .strict(), {
52
+ examples: [
53
+ {
54
+ id: 'SUMMER25',
55
+ object: 'coupon',
56
+ livemode: false,
57
+ name: 'Summer sale',
58
+ percent_off: 25,
59
+ amount_off: null,
60
+ currency: null,
61
+ duration: 'repeating',
62
+ duration_in_months: 3,
63
+ max_redemptions: 100,
64
+ redeem_by: null,
65
+ times_redeemed: 0,
66
+ valid: true,
67
+ applies_to: null,
68
+ metadata: {},
69
+ created: 1793750400,
70
+ },
71
+ ],
72
+ });
73
+ /** What `DELETE /v1/coupons/{id}` answers. Existing discounts are not affected. */
74
+ exports.deletedCouponSchema = (0, objects_1.defineComponent)('DeletedCoupon', (0, envelopes_1.deletedOf)('coupon'));
75
+ /**
76
+ * A percentage with at most two decimals, as basis points (12.5 → 1250). The
77
+ * check is on the scaled value, so 33.333 is refused rather than rounded.
78
+ */
79
+ const percentOff = zod_1.z
80
+ .number()
81
+ .gt(0)
82
+ .max(100)
83
+ .refine((value) => Math.abs(value * 100 - Math.round(value * 100)) < 1e-9, 'percent_off has at most two decimals')
84
+ .transform((value) => Math.round(value * 100));
85
+ const couponId = zod_1.z
86
+ .string()
87
+ .regex(new RegExp(`^[A-Za-z0-9_-]{1,${catalog_1.CATALOG_LIMITS.couponIdMax}}$`), `a coupon id is 1–${catalog_1.CATALOG_LIMITS.couponIdMax} letters, digits, '_' or '-'`);
88
+ const name = zod_1.z.string().min(1).max(catalog_1.CATALOG_LIMITS.couponNameMax);
89
+ exports.createCouponParams = zod_1.z
90
+ .object({
91
+ id: couponId
92
+ .optional()
93
+ .describe('Your own id (`SUMMER25`); generated (`coupon_…`) when absent.'),
94
+ name: name.optional(),
95
+ percent_off: percentOff.optional(),
96
+ amount_off: shared_1.baseUnitAmountParam.optional(),
97
+ currency: primitives_1.currency.optional().describe('Required with `amount_off`.'),
98
+ duration: zod_1.z.enum(catalog_1.COUPON_DURATIONS).optional().describe('Default `once`.'),
99
+ duration_in_months: zod_1.z
100
+ .number()
101
+ .int()
102
+ .min(1)
103
+ .max(catalog_1.CATALOG_LIMITS.couponDurationInMonthsMax)
104
+ .optional()
105
+ .describe('Required for `repeating`.'),
106
+ max_redemptions: shared_1.countParam.optional(),
107
+ redeem_by: shared_1.positiveUnixSecondsParam.optional().describe('Unix seconds, in the future.'),
108
+ applies_to: zod_1.z
109
+ .object({
110
+ products: zod_1.z
111
+ .array(zod_1.z.string().min(1).max(255))
112
+ .min(1)
113
+ .max(catalog_1.CATALOG_LIMITS.couponAppliesToProductsMax),
114
+ })
115
+ .strict()
116
+ .optional(),
117
+ metadata: params_1.metadataCreateParam.optional(),
118
+ expand: params_1.expandParam.optional(),
119
+ })
120
+ .strict()
121
+ .superRefine((body, ctx) => {
122
+ const issue = (path, message) => ctx.addIssue({ code: 'custom', path: [path], message });
123
+ if ((body.percent_off === undefined) === (body.amount_off === undefined)) {
124
+ issue('percent_off', 'a coupon takes exactly one of percent_off and amount_off');
125
+ }
126
+ if (body.amount_off !== undefined && body.currency === undefined) {
127
+ issue('currency', 'amount_off needs a currency');
128
+ }
129
+ if (body.amount_off === undefined && body.currency !== undefined) {
130
+ issue('currency', 'currency is only for an amount_off coupon');
131
+ }
132
+ if (body.amount_off === '0')
133
+ issue('amount_off', 'amount_off must be positive');
134
+ (0, shared_1.checkAmountBound)(ctx, body.amount_off, body.currency, ['amount_off']);
135
+ const duration = body.duration ?? 'once';
136
+ if (duration === 'repeating' && body.duration_in_months === undefined) {
137
+ issue('duration_in_months', 'a repeating coupon needs duration_in_months');
138
+ }
139
+ if (duration !== 'repeating' && body.duration_in_months !== undefined) {
140
+ issue('duration_in_months', 'duration_in_months is only for a repeating coupon');
141
+ }
142
+ });
143
+ exports.updateCouponParams = zod_1.z
144
+ .object({
145
+ name: (0, shared_1.clearing)(name).optional().describe('`""` clears it.'),
146
+ metadata: params_1.metadataUpdateParam.optional(),
147
+ expand: params_1.expandParam.optional(),
148
+ })
149
+ .strict();
150
+ exports.listCouponsQuery = (0, params_1.listQuery)({});
151
+ exports.couponRoutes = [
152
+ (0, route_1.defineRoute)({
153
+ operationId: 'createCoupon',
154
+ method: 'post',
155
+ path: '/v1/coupons',
156
+ tag: 'Coupons',
157
+ summary: 'Create a coupon',
158
+ auth: 'service',
159
+ scope: 'payments:write',
160
+ idempotent: true,
161
+ body: exports.createCouponParams,
162
+ response: exports.couponSchema,
163
+ sdk: 'coupons.create',
164
+ expandable: 'coupon',
165
+ }),
166
+ (0, route_1.defineRoute)({
167
+ operationId: 'listCoupons',
168
+ method: 'get',
169
+ path: '/v1/coupons',
170
+ tag: 'Coupons',
171
+ summary: 'List coupons',
172
+ auth: 'service',
173
+ scope: 'payments:read',
174
+ query: exports.listCouponsQuery,
175
+ response: (0, envelopes_1.listOf)(exports.couponSchema),
176
+ sdk: 'coupons.list',
177
+ expandable: 'coupon',
178
+ }),
179
+ (0, route_1.defineRoute)({
180
+ operationId: 'retrieveCoupon',
181
+ method: 'get',
182
+ path: '/v1/coupons/{id}',
183
+ tag: 'Coupons',
184
+ summary: 'Retrieve a coupon',
185
+ auth: 'service',
186
+ scope: 'payments:read',
187
+ params: { id: 'The coupon (`SUMMER25`, `coupon_…`).' },
188
+ query: params_1.expandOnlyQuery,
189
+ response: exports.couponSchema,
190
+ sdk: 'coupons.retrieve',
191
+ expandable: 'coupon',
192
+ }),
193
+ (0, route_1.defineRoute)({
194
+ operationId: 'updateCoupon',
195
+ method: 'post',
196
+ path: '/v1/coupons/{id}',
197
+ tag: 'Coupons',
198
+ summary: 'Update a coupon',
199
+ description: 'Only `name` and `metadata` change.',
200
+ auth: 'service',
201
+ scope: 'payments:write',
202
+ idempotent: true,
203
+ params: { id: 'The coupon (`SUMMER25`, `coupon_…`).' },
204
+ body: exports.updateCouponParams,
205
+ response: exports.couponSchema,
206
+ sdk: 'coupons.update',
207
+ expandable: 'coupon',
208
+ }),
209
+ (0, route_1.defineRoute)({
210
+ operationId: 'deleteCoupon',
211
+ method: 'delete',
212
+ path: '/v1/coupons/{id}',
213
+ tag: 'Coupons',
214
+ summary: 'Delete a coupon',
215
+ description: 'Discounts customers already hold are not affected; the id is never reused.',
216
+ auth: 'service',
217
+ scope: 'payments:write',
218
+ params: { id: 'The coupon (`SUMMER25`, `coupon_…`).' },
219
+ response: exports.deletedCouponSchema,
220
+ sdk: 'coupons.del',
221
+ }),
222
+ ];
@@ -0,0 +1,257 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.entitlementRoutes = exports.listActiveEntitlementsQuery = exports.listProductFeaturesQuery = exports.attachProductFeatureParams = exports.listEntitlementFeaturesQuery = exports.updateEntitlementFeatureParams = exports.createEntitlementFeatureParams = exports.activeEntitlementSummarySchema = exports.activeEntitlementSchema = exports.deletedProductFeatureSchema = exports.productFeatureSchema = exports.entitlementFeatureSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const envelopes_1 = require("../../common/envelopes");
6
+ const objects_1 = require("../../common/objects");
7
+ const params_1 = require("../../common/params");
8
+ const primitives_1 = require("../../common/primitives");
9
+ const route_1 = require("../../route");
10
+ const shared_1 = require("./shared");
11
+ /**
12
+ * Entitlements (ADR 0018 §8): features (`feat_…`) a product grants, and what a
13
+ * customer may access NOW. `lookup_key` is what an app checks access by.
14
+ */
15
+ /** A feature (`feat_…`) a product grants — `lookup_key` is what an app checks. */
16
+ exports.entitlementFeatureSchema = (0, objects_1.defineObject)('entitlements.feature', 'EntitlementFeature', zod_1.z
17
+ .object({
18
+ id: zod_1.z.string(),
19
+ object: zod_1.z.literal('entitlements.feature'),
20
+ livemode: primitives_1.livemode,
21
+ lookup_key: zod_1.z.string().describe('What an app checks access by; unique per merchant.'),
22
+ name: zod_1.z.string(),
23
+ active: zod_1.z
24
+ .boolean()
25
+ .describe('`false`: archived, and withdrawn from every customer that held it.'),
26
+ metadata: primitives_1.metadata,
27
+ created: primitives_1.unixSeconds,
28
+ })
29
+ .strict(), {
30
+ examples: [
31
+ {
32
+ id: 'feat_0193b8f2c1a87d3e9f4f',
33
+ object: 'entitlements.feature',
34
+ livemode: false,
35
+ lookup_key: 'mention_plus',
36
+ name: 'Mention Plus',
37
+ active: true,
38
+ metadata: {},
39
+ created: 1793750400,
40
+ },
41
+ ],
42
+ });
43
+ /** A feature attached to a product (`prodft_…`). */
44
+ exports.productFeatureSchema = (0, objects_1.defineObject)('product_feature', 'ProductFeature', zod_1.z
45
+ .object({
46
+ id: zod_1.z.string(),
47
+ object: zod_1.z.literal('product_feature'),
48
+ livemode: primitives_1.livemode,
49
+ product: zod_1.z.string().describe('The product (`prod_…`) that grants it.'),
50
+ entitlement_feature: exports.entitlementFeatureSchema,
51
+ })
52
+ .strict(), {
53
+ examples: [
54
+ {
55
+ id: 'prodft_0193b8f2c1a87d3e9f50',
56
+ object: 'product_feature',
57
+ livemode: false,
58
+ product: 'prod_0193b8f2c1a87d3e9f4a',
59
+ entitlement_feature: {
60
+ id: 'feat_0193b8f2c1a87d3e9f4f',
61
+ object: 'entitlements.feature',
62
+ livemode: false,
63
+ lookup_key: 'mention_plus',
64
+ name: 'Mention Plus',
65
+ active: true,
66
+ metadata: {},
67
+ created: 1793750400,
68
+ },
69
+ },
70
+ ],
71
+ });
72
+ /** What `DELETE /v1/products/{id}/features/{feature}` answers. */
73
+ exports.deletedProductFeatureSchema = (0, objects_1.defineComponent)('DeletedProductFeature', (0, envelopes_1.deletedOf)('product_feature'));
74
+ /**
75
+ * One feature a customer is entitled to right now: some product granting it is
76
+ * on a `trialing`, `active` or `past_due` subscription of theirs. Several
77
+ * products granting the same feature give ONE entitlement — Mention Plus
78
+ * through the Plus product or through Oxy One is the same access.
79
+ */
80
+ exports.activeEntitlementSchema = (0, objects_1.defineObject)('entitlements.active_entitlement', 'ActiveEntitlement', zod_1.z
81
+ .object({
82
+ id: zod_1.z.string().describe('Stable per customer and feature.'),
83
+ object: zod_1.z.literal('entitlements.active_entitlement'),
84
+ livemode: primitives_1.livemode,
85
+ feature: zod_1.z.string().describe('The feature (`feat_…`).'),
86
+ lookup_key: zod_1.z.string(),
87
+ })
88
+ .strict(), {
89
+ examples: [
90
+ {
91
+ id: 'ent_5f1c0a9e2b7d4c3a8e6f1b2d',
92
+ object: 'entitlements.active_entitlement',
93
+ livemode: false,
94
+ feature: 'feat_0193b8f2c1a87d3e9f4f',
95
+ lookup_key: 'mention_plus',
96
+ },
97
+ ],
98
+ });
99
+ /** What `entitlements.active_entitlement_summary.updated` carries: a customer's complete set. */
100
+ exports.activeEntitlementSummarySchema = (0, objects_1.defineObject)('entitlements.active_entitlement_summary', 'ActiveEntitlementSummary', zod_1.z
101
+ .object({
102
+ object: zod_1.z.literal('entitlements.active_entitlement_summary'),
103
+ livemode: primitives_1.livemode,
104
+ customer: zod_1.z.string().describe('The customer (`cus_…`).'),
105
+ entitlements: zod_1.z
106
+ .object({
107
+ object: zod_1.z.literal('list'),
108
+ data: zod_1.z.array(exports.activeEntitlementSchema),
109
+ has_more: zod_1.z.literal(false),
110
+ url: zod_1.z.string(),
111
+ })
112
+ .strict()
113
+ .describe('The complete set: never paged.'),
114
+ })
115
+ .strict());
116
+ const name = zod_1.z.string().min(1).max(80);
117
+ exports.createEntitlementFeatureParams = zod_1.z
118
+ .object({
119
+ lookup_key: zod_1.z.string().regex(/^[A-Za-z0-9_.:-]{1,80}$/),
120
+ name,
121
+ metadata: params_1.metadataCreateParam.optional(),
122
+ })
123
+ .strict();
124
+ exports.updateEntitlementFeatureParams = zod_1.z
125
+ .object({
126
+ name: name.optional(),
127
+ active: zod_1.z
128
+ .boolean()
129
+ .optional()
130
+ .describe('`false` archives it and withdraws it from every customer that held it.'),
131
+ metadata: params_1.metadataUpdateParam.optional(),
132
+ })
133
+ .strict();
134
+ exports.listEntitlementFeaturesQuery = (0, params_1.listQuery)({
135
+ lookup_key: zod_1.z.string().min(1).max(80).optional(),
136
+ archived: shared_1.queryFlag.optional(),
137
+ });
138
+ exports.attachProductFeatureParams = zod_1.z
139
+ .object({ entitlement_feature: params_1.idParam.describe('The feature (`feat_…`) to grant.') })
140
+ .strict();
141
+ exports.listProductFeaturesQuery = (0, params_1.listQuery)({});
142
+ exports.listActiveEntitlementsQuery = (0, params_1.listQuery)({
143
+ customer: params_1.idParam.describe('The customer (`cus_…`).'),
144
+ });
145
+ const featureId = { id: 'The feature (`feat_…`).' };
146
+ exports.entitlementRoutes = [
147
+ (0, route_1.defineRoute)({
148
+ operationId: 'createEntitlementFeature',
149
+ method: 'post',
150
+ path: '/v1/entitlements/features',
151
+ tag: 'Entitlements',
152
+ summary: 'Create a feature',
153
+ auth: 'service',
154
+ scope: 'payments:write',
155
+ idempotent: true,
156
+ body: exports.createEntitlementFeatureParams,
157
+ response: exports.entitlementFeatureSchema,
158
+ sdk: 'entitlements.features.create',
159
+ }),
160
+ (0, route_1.defineRoute)({
161
+ operationId: 'listEntitlementFeatures',
162
+ method: 'get',
163
+ path: '/v1/entitlements/features',
164
+ tag: 'Entitlements',
165
+ summary: 'List features',
166
+ auth: 'service',
167
+ scope: 'payments:read',
168
+ query: exports.listEntitlementFeaturesQuery,
169
+ response: (0, envelopes_1.listOf)(exports.entitlementFeatureSchema),
170
+ sdk: 'entitlements.features.list',
171
+ expandable: 'entitlements.feature',
172
+ }),
173
+ (0, route_1.defineRoute)({
174
+ operationId: 'retrieveEntitlementFeature',
175
+ method: 'get',
176
+ path: '/v1/entitlements/features/{id}',
177
+ tag: 'Entitlements',
178
+ summary: 'Retrieve a feature',
179
+ auth: 'service',
180
+ scope: 'payments:read',
181
+ params: featureId,
182
+ query: params_1.expandOnlyQuery,
183
+ response: exports.entitlementFeatureSchema,
184
+ sdk: 'entitlements.features.retrieve',
185
+ }),
186
+ (0, route_1.defineRoute)({
187
+ operationId: 'updateEntitlementFeature',
188
+ method: 'post',
189
+ path: '/v1/entitlements/features/{id}',
190
+ tag: 'Entitlements',
191
+ summary: 'Update a feature',
192
+ description: '`active: false` archives it and withdraws it from every customer that held it.',
193
+ auth: 'service',
194
+ scope: 'payments:write',
195
+ idempotent: true,
196
+ params: featureId,
197
+ body: exports.updateEntitlementFeatureParams,
198
+ response: exports.entitlementFeatureSchema,
199
+ sdk: 'entitlements.features.update',
200
+ }),
201
+ (0, route_1.defineRoute)({
202
+ operationId: 'attachProductFeature',
203
+ method: 'post',
204
+ path: '/v1/products/{id}/features',
205
+ tag: 'Entitlements',
206
+ summary: 'Attach a feature to a product',
207
+ auth: 'service',
208
+ scope: 'payments:write',
209
+ idempotent: true,
210
+ params: { id: 'The product (`prod_…`).' },
211
+ body: exports.attachProductFeatureParams,
212
+ response: exports.productFeatureSchema,
213
+ sdk: 'entitlements.productFeatures.attach',
214
+ }),
215
+ (0, route_1.defineRoute)({
216
+ operationId: 'listProductFeatures',
217
+ method: 'get',
218
+ path: '/v1/products/{id}/features',
219
+ tag: 'Entitlements',
220
+ summary: "List a product's features",
221
+ auth: 'service',
222
+ scope: 'payments:read',
223
+ params: { id: 'The product (`prod_…`).' },
224
+ query: exports.listProductFeaturesQuery,
225
+ response: (0, envelopes_1.listOf)(exports.productFeatureSchema),
226
+ sdk: 'entitlements.productFeatures.list',
227
+ expandable: 'product_feature',
228
+ }),
229
+ (0, route_1.defineRoute)({
230
+ operationId: 'detachProductFeature',
231
+ method: 'delete',
232
+ path: '/v1/products/{id}/features/{feature}',
233
+ tag: 'Entitlements',
234
+ summary: 'Detach a feature from a product',
235
+ auth: 'service',
236
+ scope: 'payments:write',
237
+ params: {
238
+ id: 'The product (`prod_…`).',
239
+ feature: 'The attachment (`prodft_…`).',
240
+ },
241
+ response: exports.deletedProductFeatureSchema,
242
+ sdk: 'entitlements.productFeatures.detach',
243
+ }),
244
+ (0, route_1.defineRoute)({
245
+ operationId: 'listActiveEntitlements',
246
+ method: 'get',
247
+ path: '/v1/entitlements/active_entitlements',
248
+ tag: 'Entitlements',
249
+ summary: "List a customer's active entitlements",
250
+ description: 'What the customer may access NOW: one entitlement per feature, however many products grant it. A complete set, never paged (`has_more` is always `false`).',
251
+ auth: 'service',
252
+ scope: 'payments:read',
253
+ query: exports.listActiveEntitlementsQuery,
254
+ response: (0, envelopes_1.listOf)(exports.activeEntitlementSchema),
255
+ sdk: 'entitlements.activeEntitlements.list',
256
+ }),
257
+ ];
@@ -0,0 +1,58 @@
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
+ exports.catalogRoutes = exports.queryIdList = exports.queryFlag = exports.baseUnitAmountParam = void 0;
18
+ // Contracts of this group: one module per resource, re-exported here, and
19
+ // their routes concatenated into `catalogRoutes`.
20
+ const billing_1 = require("./billing");
21
+ const billingSettings_1 = require("./billingSettings");
22
+ const coupons_1 = require("./coupons");
23
+ const entitlements_1 = require("./entitlements");
24
+ const meters_1 = require("./meters");
25
+ const prices_1 = require("./prices");
26
+ const products_1 = require("./products");
27
+ const promotionCodes_1 = require("./promotionCodes");
28
+ const testClocks_1 = require("./testClocks");
29
+ __exportStar(require("./billing"), exports);
30
+ __exportStar(require("./billingSettings"), exports);
31
+ __exportStar(require("./coupons"), exports);
32
+ __exportStar(require("./entitlements"), exports);
33
+ __exportStar(require("./meters"), exports);
34
+ __exportStar(require("./prices"), exports);
35
+ __exportStar(require("./products"), exports);
36
+ __exportStar(require("./promotionCodes"), exports);
37
+ __exportStar(require("./testClocks"), exports);
38
+ // The request pieces every body naming an amount, an inline price or a filter reuses.
39
+ var shared_1 = require("./shared");
40
+ Object.defineProperty(exports, "baseUnitAmountParam", { enumerable: true, get: function () { return shared_1.baseUnitAmountParam; } });
41
+ Object.defineProperty(exports, "queryFlag", { enumerable: true, get: function () { return shared_1.queryFlag; } });
42
+ Object.defineProperty(exports, "queryIdList", { enumerable: true, get: function () { return shared_1.queryIdList; } });
43
+ /**
44
+ * The catalog (products, prices, coupons, promotion codes), entitlements, the
45
+ * billing engine's platform objects (test clocks, billing settings, meters)
46
+ * and the recurring billing transport (`/v1/billing/*`).
47
+ */
48
+ exports.catalogRoutes = [
49
+ ...products_1.productRoutes,
50
+ ...prices_1.priceRoutes,
51
+ ...coupons_1.couponRoutes,
52
+ ...promotionCodes_1.promotionCodeRoutes,
53
+ ...entitlements_1.entitlementRoutes,
54
+ ...testClocks_1.testClockRoutes,
55
+ ...billingSettings_1.billingSettingsRoutes,
56
+ ...meters_1.meterRoutes,
57
+ ...billing_1.billingRoutes,
58
+ ];