@peable.to/contracts 0.4.0 → 1.1.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 (322) 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 -137
  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/dashboard.js +68 -0
  92. package/dist/cjs/vocabulary/errors.js +175 -0
  93. package/dist/cjs/vocabulary/events.js +176 -0
  94. package/dist/cjs/vocabulary/files.js +44 -0
  95. package/dist/cjs/vocabulary/identity.js +12 -0
  96. package/dist/cjs/vocabulary/index.js +39 -0
  97. package/dist/cjs/vocabulary/invoices.js +52 -0
  98. package/dist/cjs/vocabulary/lists.js +22 -0
  99. package/dist/cjs/vocabulary/merchants.js +23 -0
  100. package/dist/cjs/vocabulary/money.js +104 -0
  101. package/dist/cjs/vocabulary/paymentMethodConfigurations.js +36 -0
  102. package/dist/cjs/vocabulary/payments.js +195 -0
  103. package/dist/cjs/vocabulary/reporting.js +27 -0
  104. package/dist/cjs/vocabulary/subscriptions.js +60 -0
  105. package/dist/cjs/vocabulary/tax.js +237 -0
  106. package/dist/cjs/vocabulary/version.js +12 -0
  107. package/dist/esm/common/address.js +76 -0
  108. package/dist/esm/common/envelopes.js +95 -0
  109. package/dist/esm/common/objects.js +74 -0
  110. package/dist/esm/common/params.js +203 -0
  111. package/dist/esm/common/primitives.js +35 -0
  112. package/dist/esm/contributions.js +5 -0
  113. package/dist/esm/index.js +26 -134
  114. package/dist/esm/openapi/document.js +294 -0
  115. package/dist/esm/openapi/index.js +2 -0
  116. package/dist/esm/openapi/webhooks.js +14 -0
  117. package/dist/esm/resources/billingEngine/billingPortal.js +234 -0
  118. package/dist/esm/resources/billingEngine/creditNotes.js +186 -0
  119. package/dist/esm/resources/billingEngine/customerBalanceTransactions.js +87 -0
  120. package/dist/esm/resources/billingEngine/index.js +26 -0
  121. package/dist/esm/resources/billingEngine/invoiceItems.js +152 -0
  122. package/dist/esm/resources/billingEngine/invoices.js +506 -0
  123. package/dist/esm/resources/billingEngine/params.js +39 -0
  124. package/dist/esm/resources/billingEngine/public.js +323 -0
  125. package/dist/esm/resources/billingEngine/subscriptions.js +473 -0
  126. package/dist/esm/resources/catalog/billing.js +752 -0
  127. package/dist/esm/resources/catalog/billingSettings.js +128 -0
  128. package/dist/esm/resources/catalog/coupons.js +219 -0
  129. package/dist/esm/resources/catalog/entitlements.js +254 -0
  130. package/dist/esm/resources/catalog/index.js +38 -0
  131. package/dist/esm/resources/catalog/meters.js +276 -0
  132. package/dist/esm/resources/catalog/prices.js +419 -0
  133. package/dist/esm/resources/catalog/products.js +225 -0
  134. package/dist/esm/resources/catalog/promotionCodes.js +171 -0
  135. package/dist/esm/resources/catalog/shared.js +67 -0
  136. package/dist/esm/resources/catalog/testClocks.js +124 -0
  137. package/dist/esm/resources/checkout/checkoutSessions.js +579 -0
  138. package/dist/esm/resources/checkout/contributions.js +167 -0
  139. package/dist/esm/resources/checkout/files.js +130 -0
  140. package/dist/esm/resources/checkout/index.js +25 -0
  141. package/dist/esm/resources/checkout/merchants.js +287 -0
  142. package/dist/esm/resources/checkout/paymentLinks.js +327 -0
  143. package/dist/esm/resources/checkout/paymentMethodConfigurations.js +259 -0
  144. package/dist/esm/resources/checkout/shared.js +363 -0
  145. package/dist/esm/resources/connect/account.js +329 -0
  146. package/dist/esm/resources/connect/applicationFees.js +110 -0
  147. package/dist/esm/resources/connect/balance.js +209 -0
  148. package/dist/esm/resources/connect/connectedAccounts.js +257 -0
  149. package/dist/esm/resources/connect/index.js +34 -0
  150. package/dist/esm/resources/connect/onboarding.js +79 -0
  151. package/dist/esm/resources/connect/payouts.js +193 -0
  152. package/dist/esm/resources/connect/reporting.js +232 -0
  153. package/dist/esm/resources/connect/requestLogs.js +107 -0
  154. package/dist/esm/resources/connect/transfers.js +224 -0
  155. package/dist/esm/resources/core/customers.js +191 -0
  156. package/dist/esm/resources/core/index.js +6 -0
  157. package/dist/esm/resources/core/paymentMethods.js +131 -0
  158. package/dist/esm/resources/events/events.js +353 -0
  159. package/dist/esm/resources/events/index.js +12 -0
  160. package/dist/esm/resources/events/webhookDeliveries.js +90 -0
  161. package/dist/esm/resources/events/webhookEndpoints.js +212 -0
  162. package/dist/esm/resources/payments/charges.js +154 -0
  163. package/dist/esm/resources/payments/disputes.js +201 -0
  164. package/dist/esm/resources/payments/index.js +24 -0
  165. package/dist/esm/resources/payments/paymentIntents.js +526 -0
  166. package/dist/esm/resources/payments/refunds.js +242 -0
  167. package/dist/esm/resources/payments/setupIntents.js +155 -0
  168. package/dist/esm/resources/payments/social.js +179 -0
  169. package/dist/esm/resources/payments/testHelpers.js +36 -0
  170. package/dist/esm/resources/tax/assessments.js +214 -0
  171. package/dist/esm/resources/tax/businessProfile.js +96 -0
  172. package/dist/esm/resources/tax/calculations.js +173 -0
  173. package/dist/esm/resources/tax/capabilities.js +39 -0
  174. package/dist/esm/resources/tax/codes.js +34 -0
  175. package/dist/esm/resources/tax/complianceActions.js +53 -0
  176. package/dist/esm/resources/tax/deadlines.js +56 -0
  177. package/dist/esm/resources/tax/documents.js +125 -0
  178. package/dist/esm/resources/tax/index.js +63 -0
  179. package/dist/esm/resources/tax/locationEvidence.js +128 -0
  180. package/dist/esm/resources/tax/operatingLocations.js +95 -0
  181. package/dist/esm/resources/tax/products.js +64 -0
  182. package/dist/esm/resources/tax/registrationDeclarations.js +121 -0
  183. package/dist/esm/resources/tax/registrations.js +79 -0
  184. package/dist/esm/resources/tax/reports.js +89 -0
  185. package/dist/esm/resources/tax/reviewItems.js +113 -0
  186. package/dist/esm/resources/tax/ruleSet.js +65 -0
  187. package/dist/esm/resources/tax/salesDestinations.js +91 -0
  188. package/dist/esm/resources/tax/settings.js +101 -0
  189. package/dist/esm/resources/tax/shared.js +58 -0
  190. package/dist/esm/resources/tax/transactions.js +99 -0
  191. package/dist/esm/route.js +16 -0
  192. package/dist/esm/routes.js +27 -0
  193. package/dist/esm/vocabulary/billingPortal.js +12 -0
  194. package/dist/esm/vocabulary/catalog.js +106 -0
  195. package/dist/esm/vocabulary/checkout.js +50 -0
  196. package/dist/esm/vocabulary/connect.js +92 -0
  197. package/dist/esm/vocabulary/dashboard.js +64 -0
  198. package/dist/esm/vocabulary/errors.js +170 -0
  199. package/dist/esm/vocabulary/events.js +173 -0
  200. package/dist/esm/vocabulary/files.js +41 -0
  201. package/dist/esm/vocabulary/identity.js +9 -0
  202. package/dist/esm/vocabulary/index.js +23 -0
  203. package/dist/esm/vocabulary/invoices.js +49 -0
  204. package/dist/esm/vocabulary/lists.js +19 -0
  205. package/dist/esm/vocabulary/merchants.js +20 -0
  206. package/dist/esm/vocabulary/money.js +98 -0
  207. package/dist/esm/vocabulary/paymentMethodConfigurations.js +33 -0
  208. package/dist/esm/vocabulary/payments.js +192 -0
  209. package/dist/esm/vocabulary/reporting.js +24 -0
  210. package/dist/esm/vocabulary/subscriptions.js +57 -0
  211. package/dist/esm/vocabulary/tax.js +233 -0
  212. package/dist/esm/vocabulary/version.js +9 -0
  213. package/dist/types/common/address.d.ts +62 -0
  214. package/dist/types/common/envelopes.d.ts +88 -0
  215. package/dist/types/common/objects.d.ts +107 -0
  216. package/dist/types/common/params.d.ts +156 -0
  217. package/dist/types/common/primitives.d.ts +56 -0
  218. package/dist/types/contributions.d.ts +1 -0
  219. package/dist/types/index.d.ts +16 -171
  220. package/dist/types/openapi/document.d.ts +16 -0
  221. package/dist/types/openapi/index.d.ts +2 -0
  222. package/dist/types/openapi/webhooks.d.ts +15 -0
  223. package/dist/types/resources/billingEngine/billingPortal.d.ts +742 -0
  224. package/dist/types/resources/billingEngine/creditNotes.d.ts +655 -0
  225. package/dist/types/resources/billingEngine/customerBalanceTransactions.d.ts +282 -0
  226. package/dist/types/resources/billingEngine/index.d.ts +6071 -0
  227. package/dist/types/resources/billingEngine/invoiceItems.d.ts +502 -0
  228. package/dist/types/resources/billingEngine/invoices.d.ts +2547 -0
  229. package/dist/types/resources/billingEngine/params.d.ts +51 -0
  230. package/dist/types/resources/billingEngine/public.d.ts +1860 -0
  231. package/dist/types/resources/billingEngine/subscriptions.d.ts +1519 -0
  232. package/dist/types/resources/catalog/billing.d.ts +1723 -0
  233. package/dist/types/resources/catalog/billingSettings.d.ts +160 -0
  234. package/dist/types/resources/catalog/coupons.d.ts +403 -0
  235. package/dist/types/resources/catalog/entitlements.d.ts +422 -0
  236. package/dist/types/resources/catalog/index.d.ts +3155 -0
  237. package/dist/types/resources/catalog/meters.d.ts +474 -0
  238. package/dist/types/resources/catalog/prices.d.ts +1091 -0
  239. package/dist/types/resources/catalog/products.d.ts +430 -0
  240. package/dist/types/resources/catalog/promotionCodes.d.ts +369 -0
  241. package/dist/types/resources/catalog/shared.d.ts +34 -0
  242. package/dist/types/resources/catalog/testClocks.d.ts +220 -0
  243. package/dist/types/resources/checkout/checkoutSessions.d.ts +3207 -0
  244. package/dist/types/resources/checkout/contributions.d.ts +375 -0
  245. package/dist/types/resources/checkout/files.d.ts +280 -0
  246. package/dist/types/resources/checkout/index.d.ts +5678 -0
  247. package/dist/types/resources/checkout/merchants.d.ts +395 -0
  248. package/dist/types/resources/checkout/paymentLinks.d.ts +1728 -0
  249. package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +2104 -0
  250. package/dist/types/resources/checkout/shared.d.ts +419 -0
  251. package/dist/types/resources/connect/account.d.ts +483 -0
  252. package/dist/types/resources/connect/applicationFees.d.ts +198 -0
  253. package/dist/types/resources/connect/balance.d.ts +399 -0
  254. package/dist/types/resources/connect/connectedAccounts.d.ts +494 -0
  255. package/dist/types/resources/connect/index.d.ts +2094 -0
  256. package/dist/types/resources/connect/onboarding.d.ts +95 -0
  257. package/dist/types/resources/connect/payouts.d.ts +527 -0
  258. package/dist/types/resources/connect/reporting.d.ts +506 -0
  259. package/dist/types/resources/connect/requestLogs.d.ts +236 -0
  260. package/dist/types/resources/connect/transfers.d.ts +436 -0
  261. package/dist/types/resources/core/customers.d.ts +619 -0
  262. package/dist/types/resources/core/index.d.ts +679 -0
  263. package/dist/types/resources/core/paymentMethods.d.ts +336 -0
  264. package/dist/types/resources/events/events.d.ts +731 -0
  265. package/dist/types/resources/events/index.d.ts +1727 -0
  266. package/dist/types/resources/events/webhookDeliveries.d.ts +436 -0
  267. package/dist/types/resources/events/webhookEndpoints.d.ts +1502 -0
  268. package/dist/types/resources/payments/charges.d.ts +390 -0
  269. package/dist/types/resources/payments/disputes.d.ts +822 -0
  270. package/dist/types/resources/payments/index.d.ts +3517 -0
  271. package/dist/types/resources/payments/paymentIntents.d.ts +2080 -0
  272. package/dist/types/resources/payments/refunds.d.ts +684 -0
  273. package/dist/types/resources/payments/setupIntents.d.ts +391 -0
  274. package/dist/types/resources/payments/social.d.ts +266 -0
  275. package/dist/types/resources/payments/testHelpers.d.ts +178 -0
  276. package/dist/types/resources/tax/assessments.d.ts +787 -0
  277. package/dist/types/resources/tax/businessProfile.d.ts +134 -0
  278. package/dist/types/resources/tax/calculations.d.ts +261 -0
  279. package/dist/types/resources/tax/capabilities.d.ts +81 -0
  280. package/dist/types/resources/tax/codes.d.ts +29 -0
  281. package/dist/types/resources/tax/complianceActions.d.ts +97 -0
  282. package/dist/types/resources/tax/deadlines.d.ts +133 -0
  283. package/dist/types/resources/tax/documents.d.ts +257 -0
  284. package/dist/types/resources/tax/index.d.ts +1946 -0
  285. package/dist/types/resources/tax/locationEvidence.d.ts +246 -0
  286. package/dist/types/resources/tax/operatingLocations.d.ts +170 -0
  287. package/dist/types/resources/tax/products.d.ts +68 -0
  288. package/dist/types/resources/tax/registrationDeclarations.d.ts +270 -0
  289. package/dist/types/resources/tax/registrations.d.ts +103 -0
  290. package/dist/types/resources/tax/reports.d.ts +129 -0
  291. package/dist/types/resources/tax/reviewItems.d.ts +226 -0
  292. package/dist/types/resources/tax/ruleSet.d.ts +219 -0
  293. package/dist/types/resources/tax/salesDestinations.d.ts +158 -0
  294. package/dist/types/resources/tax/settings.d.ts +122 -0
  295. package/dist/types/resources/tax/shared.d.ts +43 -0
  296. package/dist/types/resources/tax/transactions.d.ts +404 -0
  297. package/dist/types/route.d.ts +86 -0
  298. package/dist/types/routes.d.ts +23 -0
  299. package/dist/types/vocabulary/billingPortal.d.ts +15 -0
  300. package/dist/types/vocabulary/catalog.d.ts +97 -0
  301. package/dist/types/vocabulary/checkout.d.ts +49 -0
  302. package/dist/types/vocabulary/connect.d.ts +62 -0
  303. package/dist/types/vocabulary/dashboard.d.ts +44 -0
  304. package/dist/types/vocabulary/errors.d.ts +146 -0
  305. package/dist/types/vocabulary/events.d.ts +171 -0
  306. package/dist/types/vocabulary/files.d.ts +30 -0
  307. package/dist/types/vocabulary/identity.d.ts +9 -0
  308. package/dist/types/vocabulary/index.d.ts +19 -0
  309. package/dist/types/vocabulary/invoices.d.ts +39 -0
  310. package/dist/types/vocabulary/lists.d.ts +9 -0
  311. package/dist/types/vocabulary/merchants.d.ts +9 -0
  312. package/dist/types/vocabulary/money.d.ts +59 -0
  313. package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +22 -0
  314. package/dist/types/vocabulary/payments.d.ts +117 -0
  315. package/dist/types/vocabulary/reporting.d.ts +18 -0
  316. package/dist/types/vocabulary/subscriptions.d.ts +45 -0
  317. package/dist/types/vocabulary/tax.d.ts +163 -0
  318. package/dist/types/vocabulary/version.d.ts +10 -0
  319. package/package.json +51 -11
  320. package/dist/cjs/openapi.js +0 -165
  321. package/dist/esm/openapi.js +0 -161
  322. package/dist/types/openapi.d.ts +0 -148
@@ -0,0 +1,215 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.webhookEndpointRoutes = exports.listWebhookEndpointsQuery = exports.rollWebhookEndpointSecretParams = exports.updateWebhookEndpointParams = exports.createWebhookEndpointParams = exports.deletedWebhookEndpointSchema = exports.webhookEndpointWithSecretSchema = exports.webhookEndpointSchema = 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 events_1 = require("../../vocabulary/events");
11
+ const webhookDeliveries_1 = require("./webhookDeliveries");
12
+ /**
13
+ * Webhook endpoints (`we_…`, ADR 0014 D4) — one URL a merchant receives events
14
+ * at, with the event types it wants and the secret deliveries to it are signed
15
+ * with. A merchant may hold several; every event fans out to each ENABLED
16
+ * endpoint whose `enabled_events` matches it, as one delivery per endpoint.
17
+ */
18
+ const enabledEvent = zod_1.z.enum(events_1.WEBHOOK_ENABLED_EVENTS);
19
+ const endpointShape = {
20
+ id: zod_1.z.string(),
21
+ object: zod_1.z.literal('webhook_endpoint'),
22
+ livemode: primitives_1.livemode.describe('The mode of the merchant that owns it (ADR 0017).'),
23
+ url: zod_1.z.string(),
24
+ description: zod_1.z.string().nullable(),
25
+ enabled_events: zod_1.z
26
+ .array(enabledEvent)
27
+ .describe('The event types sent to it; `*` is every type, including ones added later.'),
28
+ status: zod_1.z.enum(events_1.WEBHOOK_ENDPOINT_STATUSES),
29
+ disabled_reason: zod_1.z
30
+ .enum(events_1.WEBHOOK_ENDPOINT_DISABLED_REASONS)
31
+ .nullable()
32
+ .describe('`null` exactly when `status` is `enabled`. `delivery_failures`: every delivery failed for three days straight.'),
33
+ api_version: zod_1.z.string().describe('The wire version events are rendered with for this endpoint.'),
34
+ metadata: primitives_1.metadata,
35
+ created: primitives_1.unixSeconds,
36
+ updated_at: primitives_1.unixSeconds,
37
+ };
38
+ const endpointExample = {
39
+ id: 'we_0193b8f2c1a87d3e9f4c',
40
+ object: 'webhook_endpoint',
41
+ livemode: false,
42
+ url: 'https://example.com/peable/webhooks',
43
+ description: 'Order fulfilment',
44
+ enabled_events: ['payment_intent.succeeded', 'charge.refunded'],
45
+ status: 'enabled',
46
+ disabled_reason: null,
47
+ api_version: '2026-11-03',
48
+ metadata: {},
49
+ created: 1793750000,
50
+ updated_at: 1793750000,
51
+ };
52
+ /** An endpoint as every answer but a create and a roll renders it: never the secret. */
53
+ exports.webhookEndpointSchema = (0, objects_1.defineObject)('webhook_endpoint', 'WebhookEndpoint', zod_1.z.object(endpointShape).strict(), { examples: [endpointExample] });
54
+ /**
55
+ * The answer of a create and of a `roll_secret` — the ONLY two that show the
56
+ * signing secret. Peable never shows it again; a lost secret is rolled, not
57
+ * retrieved.
58
+ */
59
+ exports.webhookEndpointWithSecretSchema = (0, objects_1.defineComponent)('WebhookEndpointWithSecret', zod_1.z
60
+ .object({
61
+ ...endpointShape,
62
+ secret: zod_1.z
63
+ .string()
64
+ .regex(/^whsec_/)
65
+ .describe('The signing secret (`whsec_…`), shown on this answer only.'),
66
+ })
67
+ .strict(), { examples: [{ ...endpointExample, secret: 'whsec_9f4a7d3e0193b8f2c1a87d3e9f4a7d3e' }] });
68
+ /** What `DELETE /v1/webhook_endpoints/:id` answers. */
69
+ exports.deletedWebhookEndpointSchema = (0, objects_1.defineComponent)('DeletedWebhookEndpoint', (0, envelopes_1.deletedOf)('webhook_endpoint'));
70
+ const enabledEventsParam = zod_1.z
71
+ .array(enabledEvent)
72
+ .min(1, 'enabled_events needs at least one event type, or "*"')
73
+ .max(events_1.WEBHOOK_ENABLED_EVENTS.length)
74
+ // A repeated type means nothing more than one; stored once.
75
+ .transform((list) => [...new Set(list)]);
76
+ const descriptionParam = zod_1.z.string().max(events_1.WEBHOOK_ENDPOINT_DESCRIPTION_MAX);
77
+ const urlParam = zod_1.z
78
+ .string()
79
+ .min(1)
80
+ .describe('An `https` URL (a test-mode endpoint may also use `http`), ports 80/443 only.');
81
+ exports.createWebhookEndpointParams = zod_1.z
82
+ .object({
83
+ url: urlParam,
84
+ enabled_events: enabledEventsParam,
85
+ description: descriptionParam.min(1).optional(),
86
+ metadata: params_1.metadataCreateParam.optional(),
87
+ })
88
+ .strict();
89
+ exports.updateWebhookEndpointParams = zod_1.z
90
+ .object({
91
+ url: urlParam.optional(),
92
+ enabled_events: enabledEventsParam.optional(),
93
+ disabled: zod_1.z
94
+ .boolean()
95
+ .optional()
96
+ .describe('`true` stops deliveries; `false` re-enables an endpoint, whatever disabled it.'),
97
+ description: descriptionParam.optional().describe('`""` clears it.'),
98
+ metadata: params_1.metadataUpdateParam.optional(),
99
+ })
100
+ .strict();
101
+ exports.rollWebhookEndpointSecretParams = zod_1.z
102
+ .object({
103
+ expires_in_seconds: zod_1.z
104
+ .number()
105
+ .int()
106
+ .min(0)
107
+ .max(events_1.WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS)
108
+ .optional()
109
+ .describe('How long the PREVIOUS secret keeps signing beside the new one, in seconds (0–86400, default 0). While both are live every delivery carries two `v1=` signatures, so a receiver can switch secrets without a gap.'),
110
+ })
111
+ .strict();
112
+ exports.listWebhookEndpointsQuery = (0, params_1.listQuery)({});
113
+ const idDoc = { id: 'The webhook endpoint (`we_…`).' };
114
+ exports.webhookEndpointRoutes = [
115
+ (0, route_1.defineRoute)({
116
+ operationId: 'createWebhookEndpoint',
117
+ method: 'post',
118
+ path: '/v1/webhook_endpoints',
119
+ tag: 'Webhook endpoints',
120
+ summary: 'Create a webhook endpoint',
121
+ description: 'The answer is the ONLY one that shows `secret`. A retry with the same `Idempotency-Key` replays it, secret included, for 24 hours. At most 16 endpoints per merchant and mode.',
122
+ auth: 'service',
123
+ scope: 'payments:write',
124
+ idempotent: true,
125
+ body: exports.createWebhookEndpointParams,
126
+ response: exports.webhookEndpointWithSecretSchema,
127
+ sdk: 'webhookEndpoints.create',
128
+ }),
129
+ (0, route_1.defineRoute)({
130
+ operationId: 'listWebhookEndpoints',
131
+ method: 'get',
132
+ path: '/v1/webhook_endpoints',
133
+ tag: 'Webhook endpoints',
134
+ summary: 'List webhook endpoints',
135
+ description: 'Newest first. Never the secret.',
136
+ auth: 'service',
137
+ scope: 'payments:read',
138
+ query: exports.listWebhookEndpointsQuery,
139
+ response: (0, envelopes_1.listOf)(exports.webhookEndpointSchema),
140
+ sdk: 'webhookEndpoints.list',
141
+ expandable: 'webhook_endpoint',
142
+ }),
143
+ (0, route_1.defineRoute)({
144
+ operationId: 'retrieveWebhookEndpoint',
145
+ method: 'get',
146
+ path: '/v1/webhook_endpoints/{id}',
147
+ tag: 'Webhook endpoints',
148
+ summary: 'Retrieve a webhook endpoint',
149
+ description: 'Never the secret: a lost secret is rolled, not retrieved.',
150
+ auth: 'service',
151
+ scope: 'payments:read',
152
+ params: idDoc,
153
+ query: params_1.expandOnlyQuery,
154
+ response: exports.webhookEndpointSchema,
155
+ sdk: 'webhookEndpoints.retrieve',
156
+ expandable: 'webhook_endpoint',
157
+ }),
158
+ (0, route_1.defineRoute)({
159
+ operationId: 'updateWebhookEndpoint',
160
+ method: 'post',
161
+ path: '/v1/webhook_endpoints/{id}',
162
+ tag: 'Webhook endpoints',
163
+ summary: 'Update a webhook endpoint',
164
+ description: '`url`, `enabled_events`, `disabled`, `description` (`""` clears it) and `metadata` (a patch).',
165
+ auth: 'service',
166
+ scope: 'payments:write',
167
+ idempotent: true,
168
+ params: idDoc,
169
+ body: exports.updateWebhookEndpointParams,
170
+ response: exports.webhookEndpointSchema,
171
+ sdk: 'webhookEndpoints.update',
172
+ }),
173
+ (0, route_1.defineRoute)({
174
+ operationId: 'deleteWebhookEndpoint',
175
+ method: 'delete',
176
+ path: '/v1/webhook_endpoints/{id}',
177
+ tag: 'Webhook endpoints',
178
+ summary: 'Delete a webhook endpoint',
179
+ description: 'Its deliveries go with it, pending ones included.',
180
+ auth: 'service',
181
+ scope: 'payments:write',
182
+ params: idDoc,
183
+ response: exports.deletedWebhookEndpointSchema,
184
+ sdk: 'webhookEndpoints.del',
185
+ }),
186
+ (0, route_1.defineRoute)({
187
+ operationId: 'rollWebhookEndpointSecret',
188
+ method: 'post',
189
+ path: '/v1/webhook_endpoints/{id}/roll_secret',
190
+ tag: 'Webhook endpoints',
191
+ summary: 'Roll the signing secret',
192
+ description: 'Mint a new secret and show it once. With `expires_in_seconds` (≤ 24h) the previous one keeps signing beside it until then; without, it stops now.',
193
+ auth: 'service',
194
+ scope: 'payments:write',
195
+ idempotent: true,
196
+ params: idDoc,
197
+ body: exports.rollWebhookEndpointSecretParams,
198
+ response: exports.webhookEndpointWithSecretSchema,
199
+ sdk: 'webhookEndpoints.rollSecret',
200
+ }),
201
+ (0, route_1.defineRoute)({
202
+ operationId: 'sendWebhookEndpointTestEvent',
203
+ method: 'post',
204
+ path: '/v1/webhook_endpoints/{id}/test',
205
+ tag: 'Webhook endpoints',
206
+ summary: 'Send a test event',
207
+ description: 'Send this endpoint a `webhook_endpoint.test` event now and answer the delivery after its first attempt. A disabled endpoint is refused (`webhook_endpoint_disabled`).',
208
+ auth: 'service',
209
+ scope: 'payments:write',
210
+ idempotent: true,
211
+ params: idDoc,
212
+ response: webhookDeliveries_1.webhookDeliverySchema,
213
+ sdk: 'webhookEndpoints.sendTestEvent',
214
+ }),
215
+ ];
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.chargeRoutes = exports.listChargesQuery = exports.chargeSchema = exports.chargeOutcomeSchema = 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 paymentMethods_1 = require("../core/paymentMethods");
11
+ /**
12
+ * Charges (`ch_…`) — the read-only record of the money a CARD PaymentIntent
13
+ * moved (ADR 0019). Peable's object over the provider's charge, which stays an
14
+ * internal binding (ADR 0016). A FairCoin payment has no charge: its chain side
15
+ * is `PaymentIntent.faircoin`.
16
+ */
17
+ exports.chargeOutcomeSchema = (0, objects_1.defineComponent)('ChargeOutcome', zod_1.z
18
+ .object({
19
+ network_status: primitives_1.nullableString.describe('`approved_by_network`, `declined_by_network`, `not_sent_to_network`, `reversed_after_approval`.'),
20
+ risk_level: primitives_1.nullableString.describe('`normal`, `elevated`, `highest`, or `not_assessed`.'),
21
+ type: primitives_1.nullableString.describe('`authorized`, `manual_review`, `issuer_declined`, `blocked`, `invalid`.'),
22
+ seller_message: primitives_1.nullableString.describe("Peable's own one-line explanation for the merchant — never the provider's prose."),
23
+ })
24
+ .strict());
25
+ exports.chargeSchema = (0, objects_1.defineObject)('charge', 'Charge', zod_1.z
26
+ .object({
27
+ id: zod_1.z.string(),
28
+ object: zod_1.z.literal('charge'),
29
+ livemode: primitives_1.livemode,
30
+ payment_intent: (0, objects_1.expandable)('payment_intent', '`pi_…`, or the PaymentIntent with `expand[]=payment_intent`.'),
31
+ customer: (0, objects_1.expandable)('customer', '`cus_…`, or the Customer with `expand[]=customer`.').nullable(),
32
+ payment_method: (0, objects_1.expandable)('payment_method', '`pm_…`, or the PaymentMethod with `expand[]=payment_method`.').nullable(),
33
+ amount: primitives_1.amount,
34
+ amount_captured: primitives_1.amount,
35
+ amount_refunded: primitives_1.amount,
36
+ currency: primitives_1.currency,
37
+ status: zod_1.z
38
+ .literal('succeeded')
39
+ .describe('Always `succeeded`: Peable records the authorization that succeeded.'),
40
+ paid: zod_1.z.boolean(),
41
+ captured: zod_1.z.boolean(),
42
+ refunded: zod_1.z
43
+ .boolean()
44
+ .describe('All of it came back — by refunds, or by releasing an uncaptured authorization.'),
45
+ disputed: zod_1.z.boolean(),
46
+ outcome: exports.chargeOutcomeSchema.nullable(),
47
+ billing_details: paymentMethods_1.billingDetailsSchema
48
+ .nullable()
49
+ .describe("Who the card's billing details name, as the provider reported them; `null` until the provider snapshot is read."),
50
+ payment_method_details: zod_1.z
51
+ .object({ type: zod_1.z.literal('card'), card: paymentMethods_1.cardDetailsSchema })
52
+ .strict()
53
+ .nullable(),
54
+ receipt_url: primitives_1.nullableString.describe("The provider's own URL never reaches the wire."),
55
+ balance_transaction: primitives_1.nullableString.describe("The ledger's `txn_…` once the provider's balance transaction was ingested (ADR 0015 §4); never a guess."),
56
+ application_fee: primitives_1.nullableString.describe("Orbit's `fee_…` taken on this charge, once the provider created it."),
57
+ application_fee_amount: primitives_1.amount
58
+ .nullable()
59
+ .describe('The fee instructed on the payment (`application_fee_amount`).'),
60
+ description: primitives_1.nullableString,
61
+ receipt_email: primitives_1.nullableString,
62
+ metadata: primitives_1.metadata,
63
+ created: primitives_1.unixSeconds,
64
+ })
65
+ .strict(), {
66
+ examples: [
67
+ {
68
+ id: 'ch_0193b8f2c1a87d3e9f4a',
69
+ object: 'charge',
70
+ livemode: false,
71
+ payment_intent: 'pi_0193b8f2c1a87d3e9f4a',
72
+ customer: 'cus_0193b8f2c1a87d3e9f4a',
73
+ payment_method: 'pm_0193b8f2c1a87d3e9f4a',
74
+ amount: '2500',
75
+ amount_captured: '2500',
76
+ amount_refunded: '0',
77
+ currency: 'EUR',
78
+ status: 'succeeded',
79
+ paid: true,
80
+ captured: true,
81
+ refunded: false,
82
+ disputed: false,
83
+ outcome: {
84
+ network_status: 'approved_by_network',
85
+ risk_level: 'normal',
86
+ type: 'authorized',
87
+ seller_message: 'Payment complete.',
88
+ },
89
+ billing_details: null,
90
+ payment_method_details: {
91
+ type: 'card',
92
+ card: {
93
+ brand: 'visa',
94
+ last4: '4242',
95
+ exp_month: 12,
96
+ exp_year: 2030,
97
+ country: 'US',
98
+ funding: 'credit',
99
+ },
100
+ },
101
+ receipt_url: null,
102
+ balance_transaction: null,
103
+ application_fee: null,
104
+ application_fee_amount: null,
105
+ description: null,
106
+ receipt_email: null,
107
+ metadata: {},
108
+ created: 1793750400,
109
+ },
110
+ ],
111
+ });
112
+ exports.listChargesQuery = (0, params_1.listQuery)({
113
+ payment_intent: params_1.idParam.optional().describe("Only this payment's charges (`pi_…`)."),
114
+ });
115
+ exports.chargeRoutes = [
116
+ (0, route_1.defineRoute)({
117
+ operationId: 'listCharges',
118
+ method: 'get',
119
+ path: '/v1/charges',
120
+ tag: 'Charges',
121
+ summary: 'List charges',
122
+ auth: 'service',
123
+ scope: 'payments:read',
124
+ query: exports.listChargesQuery,
125
+ response: (0, envelopes_1.listOf)(exports.chargeSchema),
126
+ sdk: 'charges.list',
127
+ expandable: 'charge',
128
+ }),
129
+ (0, route_1.defineRoute)({
130
+ operationId: 'retrieveCharge',
131
+ method: 'get',
132
+ path: '/v1/charges/{id}',
133
+ tag: 'Charges',
134
+ summary: 'Retrieve a charge',
135
+ auth: 'service',
136
+ scope: 'payments:read',
137
+ params: { id: 'The charge (`ch_…`).' },
138
+ query: params_1.expandOnlyQuery,
139
+ response: exports.chargeSchema,
140
+ sdk: 'charges.retrieve',
141
+ expandable: 'charge',
142
+ }),
143
+ (0, route_1.defineRoute)({
144
+ operationId: 'searchCharges',
145
+ method: 'get',
146
+ path: '/v1/charges/search',
147
+ tag: 'Charges',
148
+ summary: 'Search charges',
149
+ description: "Stripe's query language over `amount`, `currency`, `customer`, `payment_intent`, `status`, `captured`, `refunded`, `disputed`, `created` and `metadata['key']`.",
150
+ auth: 'service',
151
+ scope: 'payments:read',
152
+ query: params_1.searchQuery,
153
+ response: (0, envelopes_1.searchResultOf)(exports.chargeSchema),
154
+ sdk: 'charges.search',
155
+ expandable: 'charge',
156
+ }),
157
+ ];
@@ -0,0 +1,204 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.disputeRoutes = exports.listPaymentIntentDisputesQuery = exports.listDisputesQuery = exports.closeDisputeParams = exports.updateDisputeParams = exports.disputeEvidenceParams = exports.disputeSchema = exports.disputeEvidenceDetailsSchema = exports.disputeEvidenceSchema = 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 payments_1 = require("../../vocabulary/payments");
11
+ /**
12
+ * Disputes (`dp_…`) — the card network holding a payment's money while a
13
+ * cardholder contests it. A dispute is a DEADLINE: `evidence_details.due_by`
14
+ * arrives with it. The network's own dispute id never appears.
15
+ */
16
+ /** Every evidence field, `null` when unset. */
17
+ const evidenceFields = (field) => Object.fromEntries([...payments_1.DISPUTE_TEXT_EVIDENCE_FIELDS, ...payments_1.DISPUTE_FILE_EVIDENCE_FIELDS].map((name) => [name, field]));
18
+ /**
19
+ * A merchant's evidence as the dispute holds it. Present ONLY on a live read
20
+ * (`GET /v1/disputes/{id}` and the answers of its update and close): the text
21
+ * is read from the provider, where a draft lives (Peable keeps none of its
22
+ * words); the file half is the `file_…` ids attached. Lists and events never
23
+ * carry it.
24
+ */
25
+ exports.disputeEvidenceSchema = (0, objects_1.defineComponent)('DisputeEvidence', zod_1.z.object(evidenceFields(zod_1.z.string().nullable())).strict());
26
+ exports.disputeEvidenceDetailsSchema = (0, objects_1.defineComponent)('DisputeEvidenceDetails', zod_1.z
27
+ .object({
28
+ due_by: primitives_1.unixSeconds
29
+ .nullable()
30
+ .describe('When the network stops accepting evidence; `null` once the dispute is closed.'),
31
+ has_evidence: zod_1.z.boolean().describe('Whether any evidence has been staged or submitted.'),
32
+ past_due: zod_1.z.boolean().describe('Whether the deadline passed without a submission.'),
33
+ submission_count: zod_1.z
34
+ .number()
35
+ .int()
36
+ .min(0)
37
+ .max(1)
38
+ .describe('`0` or `1`: a response is one-shot at the network.'),
39
+ submitted_at: primitives_1.unixSeconds
40
+ .nullable()
41
+ .describe('When the response reached the network; `null` while it has not.'),
42
+ })
43
+ .strict());
44
+ exports.disputeSchema = (0, objects_1.defineObject)('dispute', 'Dispute', zod_1.z
45
+ .object({
46
+ id: zod_1.z.string(),
47
+ object: zod_1.z.literal('dispute'),
48
+ livemode: primitives_1.livemode,
49
+ amount: primitives_1.amount.describe("The DISPUTED amount, which may be less than the payment's: a cardholder can contest part of a charge."),
50
+ currency: primitives_1.currency,
51
+ charge: (0, objects_1.expandable)('charge', '`ch_…`, or the Charge with `expand[]=charge`.').nullable(),
52
+ payment_intent: (0, objects_1.expandable)('payment_intent', 'The disputed payment (`pi_…`), or the PaymentIntent with `expand[]=payment_intent`.'),
53
+ status: zod_1.z
54
+ .enum(payments_1.DISPUTE_STATUSES)
55
+ .describe('`needs_response` and `under_review` are open; `won` and `lost` are terminal and say where the money ended up.'),
56
+ reason: zod_1.z.enum(payments_1.DISPUTE_REASONS),
57
+ is_charge_refundable: zod_1.z
58
+ .boolean()
59
+ .describe('Whether the disputed payment can still be refunded.'),
60
+ evidence_details: exports.disputeEvidenceDetailsSchema,
61
+ evidence: exports.disputeEvidenceSchema
62
+ .optional()
63
+ .describe('Live reads only: never on a list or an event.'),
64
+ metadata: primitives_1.metadata,
65
+ created: primitives_1.unixSeconds,
66
+ updated_at: primitives_1.unixSeconds,
67
+ })
68
+ .strict(), {
69
+ examples: [
70
+ {
71
+ id: 'dp_0193b8f2c1a87d3e9f4a',
72
+ object: 'dispute',
73
+ livemode: false,
74
+ amount: '2500',
75
+ currency: 'EUR',
76
+ charge: 'ch_0193b8f2c1a87d3e9f4a',
77
+ payment_intent: 'pi_0193b8f2c1a87d3e9f4a',
78
+ status: 'needs_response',
79
+ reason: 'product_not_received',
80
+ is_charge_refundable: true,
81
+ evidence_details: {
82
+ due_by: 1794355200,
83
+ has_evidence: false,
84
+ past_due: false,
85
+ submission_count: 0,
86
+ submitted_at: null,
87
+ },
88
+ metadata: {},
89
+ created: 1793750400,
90
+ updated_at: 1793750400,
91
+ },
92
+ ],
93
+ });
94
+ const FILE_ID_MAX = 255;
95
+ /** `""` unsets a field, as on Stripe. */
96
+ const textEvidence = zod_1.z.string().max(payments_1.DISPUTE_EVIDENCE_TEXT_MAX).optional();
97
+ const fileEvidence = zod_1.z.string().max(FILE_ID_MAX).optional();
98
+ /**
99
+ * The evidence fields, in the network's names — a CLOSED set. Unknown keys are
100
+ * REFUSED rather than dropped: a merchant who sent `tracking_number` instead of
101
+ * `shipping_tracking_number` would otherwise submit, finally, a response
102
+ * missing the field they relied on.
103
+ */
104
+ exports.disputeEvidenceParams = zod_1.z
105
+ .object({
106
+ ...Object.fromEntries(payments_1.DISPUTE_TEXT_EVIDENCE_FIELDS.map((field) => [field, textEvidence])),
107
+ ...Object.fromEntries(payments_1.DISPUTE_FILE_EVIDENCE_FIELDS.map((field) => [field, fileEvidence])),
108
+ })
109
+ .strict()
110
+ .describe('Any subset of the fields: a text field is your words (at most 20,000 characters), a file field a `file_…` of purpose `dispute_evidence`. `""` unsets a field.');
111
+ /**
112
+ * `submit: false` (the default) STAGES the evidence: text goes to the provider
113
+ * as a draft, files are attached by id. `submit: true` uploads the attached
114
+ * files and submits everything — ONCE; a second submission is refused.
115
+ */
116
+ exports.updateDisputeParams = zod_1.z
117
+ .object({
118
+ evidence: exports.disputeEvidenceParams.optional(),
119
+ metadata: params_1.metadataUpdateParam.optional(),
120
+ submit: zod_1.z.boolean().optional(),
121
+ })
122
+ .strict();
123
+ exports.closeDisputeParams = zod_1.z.object({}).strict();
124
+ exports.listDisputesQuery = (0, params_1.listQuery)({
125
+ payment_intent: params_1.idParam.optional().describe("Only this payment's disputes (`pi_…`)."),
126
+ charge: params_1.idParam.optional().describe("Only this charge's disputes (`ch_…`)."),
127
+ });
128
+ /** The per-payment sub-list: the payment is in the path. */
129
+ exports.listPaymentIntentDisputesQuery = (0, params_1.listQuery)({});
130
+ const disputeId = { disputeId: 'The dispute (`dp_…`).' };
131
+ exports.disputeRoutes = [
132
+ (0, route_1.defineRoute)({
133
+ operationId: 'listPaymentIntentDisputes',
134
+ method: 'get',
135
+ path: '/v1/payment_intents/{intentId}/disputes',
136
+ tag: 'Disputes',
137
+ summary: "List a payment's disputes",
138
+ auth: 'service',
139
+ scope: 'payments:read',
140
+ params: { intentId: 'The payment intent (`pi_…`).' },
141
+ query: exports.listPaymentIntentDisputesQuery,
142
+ response: (0, envelopes_1.listOf)(exports.disputeSchema),
143
+ sdk: 'disputes.listForPaymentIntent',
144
+ expandable: 'dispute',
145
+ }),
146
+ (0, route_1.defineRoute)({
147
+ operationId: 'listDisputes',
148
+ method: 'get',
149
+ path: '/v1/disputes',
150
+ tag: 'Disputes',
151
+ summary: 'List disputes',
152
+ auth: 'service',
153
+ scope: 'payments:read',
154
+ query: exports.listDisputesQuery,
155
+ response: (0, envelopes_1.listOf)(exports.disputeSchema),
156
+ sdk: 'disputes.list',
157
+ expandable: 'dispute',
158
+ }),
159
+ (0, route_1.defineRoute)({
160
+ operationId: 'retrieveDispute',
161
+ method: 'get',
162
+ path: '/v1/disputes/{disputeId}',
163
+ tag: 'Disputes',
164
+ summary: 'Retrieve a dispute',
165
+ description: 'The one read that carries `evidence`, read live from the provider.',
166
+ auth: 'service',
167
+ scope: 'payments:read',
168
+ params: disputeId,
169
+ query: params_1.expandOnlyQuery,
170
+ response: exports.disputeSchema,
171
+ sdk: 'disputes.retrieve',
172
+ expandable: 'dispute',
173
+ }),
174
+ (0, route_1.defineRoute)({
175
+ operationId: 'updateDispute',
176
+ method: 'post',
177
+ path: '/v1/disputes/{disputeId}',
178
+ tag: 'Disputes',
179
+ summary: 'Update a dispute',
180
+ description: 'Metadata, a staged draft of evidence, or — with `submit: true` — the one submission. A dispute that no longer takes evidence answers 409.',
181
+ auth: 'service',
182
+ scope: 'payments:write',
183
+ idempotent: true,
184
+ params: disputeId,
185
+ body: exports.updateDisputeParams,
186
+ response: exports.disputeSchema,
187
+ sdk: 'disputes.update',
188
+ }),
189
+ (0, route_1.defineRoute)({
190
+ operationId: 'closeDispute',
191
+ method: 'post',
192
+ path: '/v1/disputes/{disputeId}/close',
193
+ tag: 'Disputes',
194
+ summary: 'Close a dispute',
195
+ description: 'Accept the dispute: it is lost.',
196
+ auth: 'service',
197
+ scope: 'payments:write',
198
+ idempotent: true,
199
+ params: disputeId,
200
+ body: exports.closeDisputeParams,
201
+ response: exports.disputeSchema,
202
+ sdk: 'disputes.close',
203
+ }),
204
+ ];
@@ -0,0 +1,41 @@
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.paymentsRoutes = void 0;
18
+ const charges_1 = require("./charges");
19
+ const disputes_1 = require("./disputes");
20
+ const paymentIntents_1 = require("./paymentIntents");
21
+ const refunds_1 = require("./refunds");
22
+ const setupIntents_1 = require("./setupIntents");
23
+ const social_1 = require("./social");
24
+ const testHelpers_1 = require("./testHelpers");
25
+ __exportStar(require("./charges"), exports);
26
+ __exportStar(require("./disputes"), exports);
27
+ __exportStar(require("./paymentIntents"), exports);
28
+ __exportStar(require("./refunds"), exports);
29
+ __exportStar(require("./setupIntents"), exports);
30
+ __exportStar(require("./social"), exports);
31
+ __exportStar(require("./testHelpers"), exports);
32
+ /** Payment intents, charges, refunds, disputes, setup intents, social payments. */
33
+ exports.paymentsRoutes = [
34
+ ...paymentIntents_1.paymentIntentRoutes,
35
+ ...charges_1.chargeRoutes,
36
+ ...refunds_1.refundRoutes,
37
+ ...disputes_1.disputeRoutes,
38
+ ...setupIntents_1.setupIntentRoutes,
39
+ ...social_1.socialRoutes,
40
+ ...testHelpers_1.paymentIntentTestHelperRoutes,
41
+ ];