@peable.to/contracts 0.4.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 -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/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 -134
  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 -171
  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 -165
  315. package/dist/esm/openapi.js +0 -161
  316. package/dist/types/openapi.d.ts +0 -148
@@ -0,0 +1,174 @@
1
+ "use strict";
2
+ // The error vocabulary (ADR 0014 D1). Zod-free: the documentation site renders
3
+ // its errors page from these two tables, and the backend's `sendError` takes an
4
+ // `ErrorCode`, so a code the gateway can answer with and the page does not list
5
+ // is a compile error rather than a dead `doc_url`.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.ERROR_CODES = exports.ERROR_CODE_DESCRIPTIONS = exports.ERROR_DOCS_BASE_URL = exports.ERROR_TYPE_DESCRIPTIONS = exports.ERROR_TYPES = void 0;
8
+ exports.errorDocUrl = errorDocUrl;
9
+ exports.isErrorCode = isErrorCode;
10
+ /** `error.type`: the broad class a caller branches on first. */
11
+ exports.ERROR_TYPES = [
12
+ 'api_error',
13
+ 'authentication_error',
14
+ 'card_error',
15
+ 'idempotency_error',
16
+ 'invalid_request_error',
17
+ 'permission_error',
18
+ 'rate_limit_error',
19
+ ];
20
+ /** What each `error.type` means, and the HTTP status it comes with. */
21
+ exports.ERROR_TYPE_DESCRIPTIONS = {
22
+ api_error: 'Something went wrong on Peable or its provider (5xx, or 502 for a retryable provider fault). Safe to retry with the same `Idempotency-Key`.',
23
+ authentication_error: 'The credential is missing, expired or invalid (401).',
24
+ card_error: 'The payment method was declined (402). `decline_code` carries the issuer reason when there is one.',
25
+ idempotency_error: 'The `Idempotency-Key` was reused with a different request (400), or the first request with it is still running (409).',
26
+ invalid_request_error: 'The request is malformed, names something that does not exist, or conflicts with the state of an object (400, 404, 409).',
27
+ permission_error: 'The credential is valid but may not do this (403).',
28
+ rate_limit_error: 'Too many requests (429). Back off and retry.',
29
+ };
30
+ /**
31
+ * Where every code is documented: the error-code page of Peable's docs on the
32
+ * Oxy developer site, generated from this file (`bun run generate:api-docs`,
33
+ * `packages/sdk/docs/errors.mdx`). The trailing slash is the page's canonical
34
+ * form; each code is its own fragment.
35
+ */
36
+ exports.ERROR_DOCS_BASE_URL = 'https://oxy.so/developers/docs/peable/errors/';
37
+ /** The `doc_url` of a code. */
38
+ function errorDocUrl(code) {
39
+ return `${exports.ERROR_DOCS_BASE_URL}#${code}`;
40
+ }
41
+ /**
42
+ * Every `error.code` the gateway answers with, and what it means. The keys ARE
43
+ * the list — {@link ERROR_CODES} is derived from them — so a new code cannot be
44
+ * added without its description.
45
+ */
46
+ exports.ERROR_CODE_DESCRIPTIONS = {
47
+ account_invalid: 'The `Peable-Account` header names no connected account of this platform.',
48
+ account_missing: 'The merchant has no account object yet.',
49
+ amount_not_representable: 'The amount does not fit the currency or the rail.',
50
+ billing_not_enabled: 'Billing is not enabled for this merchant.',
51
+ billing_provider_unavailable: 'The billing provider could not be reached; retry.',
52
+ domain_taken: 'The domain is already registered by another merchant.',
53
+ file_too_large: 'The uploaded file is larger than its purpose allows.',
54
+ file_unavailable: 'The file exists but its contents cannot be served right now.',
55
+ idempotency_error: 'The `Idempotency-Key` was used with a different request, or its first request is still running.',
56
+ idempotency_key_invalid: 'The `Idempotency-Key` header is not a valid key.',
57
+ insufficient_scope: 'The credential is valid but was not granted the Oxy scope this route requires (`payments:read`, `payments:write`, …); `message` names it.',
58
+ invalid_billing_request: 'The billing request is not valid for this subscription or offer.',
59
+ keyless_recipient: 'The recipient has no receive key, so no address can be derived for them.',
60
+ link_not_found: 'The link does not exist or is no longer active.',
61
+ live_payments_gated: 'Live payments are not enabled for this application yet.',
62
+ local_test_request_required: 'This test helper only answers a local test request.',
63
+ parameter_invalid: 'A parameter is invalid; `param` names it.',
64
+ parameter_missing: 'A required parameter is missing; `param` names it.',
65
+ parameter_unknown: 'The request carries a parameter this route does not accept; `param` names it.',
66
+ payment_intent_unexpected_state: 'The PaymentIntent is in a status that does not allow this operation.',
67
+ payout_not_allowed: 'Payouts cannot be created for this account.',
68
+ rate_limited: 'Too many requests; back off and retry.',
69
+ refund_not_cancelable: 'The refund has already left a cancelable state.',
70
+ resource_conflict: 'The object changed under this request; read it again and retry.',
71
+ resource_missing: 'The object does not exist, or this credential cannot read it.',
72
+ setup_intent_unexpected_state: 'The SetupIntent is in a status that does not allow this operation.',
73
+ tax_not_enabled: 'Peable Tax is not enabled for this merchant.',
74
+ test_mode_only: 'This operation exists in test mode only.',
75
+ too_many_streams: 'Too many live streams are open for this merchant.',
76
+ url_invalid: 'The URL is not an allowed https URL.',
77
+ watch_only_violation: 'The extended key carries a private key. Peable only ever accepts watch-only (public) keys.',
78
+ webhook_endpoint_disabled: 'The webhook endpoint is disabled.',
79
+ webhook_endpoint_limit_reached: 'The merchant already has the maximum number of webhook endpoints.',
80
+ account_not_ready: 'The connected account cannot take this payment yet: its onboarding or a capability is incomplete.',
81
+ approval_incomplete: 'The tax settings cannot be approved yet: a legal name and head office are required, or they changed during the approval.',
82
+ approval_requires_provider: 'Registered sales need a tax provider, and this application has none: the approval would leave covered sales unpriceable.',
83
+ checkout_session_expired: 'The Checkout Session has expired.',
84
+ checkout_session_not_open: 'The Checkout Session is no longer open (complete or expired).',
85
+ customer_location_conflicting: "The customer's location evidence disagrees, so the sale cannot be placed in one jurisdiction.",
86
+ customer_location_expired: "The customer's location evidence is too old to price a sale with.",
87
+ customer_location_insufficient: "There is not enough evidence of the customer's location to decide whether the sale is taxed.",
88
+ customer_location_invalid: "The tax provider could not use the customer's location.",
89
+ dispute_already_submitted: 'Evidence for this dispute has already been submitted; it is one shot.',
90
+ dispute_not_answerable: 'The dispute is in a status that no longer accepts evidence.',
91
+ idempotency_conflict: 'The same operation key was used for a different billing request.',
92
+ identity_conflict: 'The billing identity already belongs to another customer or subscription.',
93
+ in_progress: 'The same operation is still running; retry with the same key.',
94
+ invalid_provider_response: 'The provider answered with something Peable cannot trust; the operation was not applied.',
95
+ invalid_registration: 'The tax registration is not valid.',
96
+ invalid_registration_declaration: 'The tax registration declaration is not valid.',
97
+ invalid_tax_code: 'The tax code does not exist.',
98
+ invalid_tax_document: 'The tax document is not valid for its declared purpose.',
99
+ invalid_tax_request: 'The tax request is not valid.',
100
+ lookup_key_taken: 'Another price already uses this `lookup_key`.',
101
+ mode_unavailable: 'This Checkout mode is not available to this merchant.',
102
+ not_found: 'The object does not exist, or this credential cannot read it.',
103
+ payment_link_inactive: 'The Payment Link is deactivated.',
104
+ price_is_default: "The price is its product's `default_price` and cannot be archived.",
105
+ product_has_prices: 'The product still has prices; archive it instead.',
106
+ product_in_use: 'The product is referenced by a subscription or a link.',
107
+ promotion_code_invalid: 'The promotion code does not exist, is inactive or does not apply.',
108
+ promotion_code_taken: 'Another active promotion code already uses this `code`.',
109
+ provider_unavailable: 'The payment provider could not be reached; retry.',
110
+ rail_unavailable: 'The payment rail this request needs is not available.',
111
+ reconciliation_required: 'The billing operation has an unknown outcome at the provider and is being reconciled.',
112
+ registration_immutable: 'An approved or ended tax registration cannot be deleted or changed this way; end it instead.',
113
+ resource_already_exists: 'An object with this identity already exists.',
114
+ result_expired: 'The stored result of this operation has expired.',
115
+ review_item_not_open: 'The review item is already resolved or dismissed.',
116
+ rule_set_version_unavailable: 'The tax rule set version is not available.',
117
+ subscription_line_invalid: 'A subscription line item is not valid for Checkout.',
118
+ tax_behavior_locked: "The price's `tax_behavior` cannot change once set.",
119
+ tax_calculation_unavailable: 'Tax could not be calculated; a covered sale fails closed.',
120
+ tax_provider_registration_mismatch: "The provider's registrations disagree with the ones Peable has approved.",
121
+ tax_settings_not_active: 'Tax settings are not active for this merchant.',
122
+ local_test_unavailable: 'The local test checkout is not available.',
123
+ local_test_configuration_unavailable: 'The local test checkout has no provider configuration.',
124
+ local_test_subscription_unavailable: 'The local test subscription cannot be read.',
125
+ rail_mismatch: 'The operation does not apply to the rail this payment uses.',
126
+ checkout_session_changed: 'The Checkout Session changed while this request ran (a price, a discount, its tax); read it again and retry.',
127
+ checkout_session_locked: 'The Checkout Session is being confirmed and cannot change.',
128
+ tax_calculation_failed: 'The tax for this Checkout Session could not be calculated.',
129
+ payment_cancellation_failed: 'The payment could not be cancelled at the provider; the Checkout Session stays as it was.',
130
+ invoice_not_editable: 'The invoice is finalized and can no longer be edited.',
131
+ invoice_unexpected_state: 'The invoice is in a status that does not allow this operation.',
132
+ invoice_no_customer_line_items: 'The invoice has no line items to finalize.',
133
+ invoice_payment_intent_requires_action: "The invoice's payment needs the customer to act (a card challenge).",
134
+ subscription_unexpected_state: 'The subscription is in a status that does not allow this operation.',
135
+ customer_currency_mismatch: "The currency differs from the customer's billing currency.",
136
+ customer_test_clock_mismatch: 'The objects live on different test clocks.',
137
+ coupon_invalid: 'The coupon does not exist or is no longer valid.',
138
+ coupon_currency_mismatch: "The coupon's currency differs from the purchase's.",
139
+ coupon_not_applicable: 'The coupon does not apply to these products.',
140
+ promotion_code_inactive: 'The promotion code is inactive.',
141
+ promotion_code_customer_mismatch: 'The promotion code is restricted to another customer.',
142
+ promotion_code_expired: 'The promotion code has expired.',
143
+ promotion_code_max_redemptions: 'The promotion code has been redeemed its maximum number of times.',
144
+ promotion_code_minimum_amount: 'The purchase is below the promotion code minimum amount.',
145
+ payment_method_missing: 'No payment method is available to charge.',
146
+ faircoin_cannot_debit: 'A FairCoin invoice cannot be charged automatically: the payer signs every payment.',
147
+ credit_note_exceeds_invoice: "The credit note's amount exceeds what the invoice can still credit.",
148
+ test_clock_unexpected_state: 'The test clock is advancing; wait until it is ready.',
149
+ meter_event_customer_missing: 'The meter event names no customer of this merchant.',
150
+ feature_lookup_key_taken: 'Another feature already uses this `lookup_key`.',
151
+ portal_feature_disabled: 'The customer portal configuration does not allow this action.',
152
+ portal_session_expired: 'The customer portal session has expired.',
153
+ card_declined: 'The card was declined.',
154
+ promotion_code_first_time_only: "The promotion code is for a customer's first purchase only.",
155
+ network_mismatch: 'The FairCoin network differs from the one this object uses.',
156
+ // Connect onboarding (ADR 0012 D3): the seller-facing refusals.
157
+ link_expired: 'The onboarding link has expired or was already used; `refresh_url` is where the seller gets a fresh one.',
158
+ wrong_seller: 'The onboarding link names a different Oxy account; sign in as the seller it was minted for.',
159
+ already_registered: 'The seller already registered a FairCoin key, and it cannot be changed.',
160
+ key_in_use: 'The key already receives payments for another account.',
161
+ no_faircoin_half: 'The connected account has no FairCoin half to register a key for.',
162
+ // The dashboard routes (`/v1/dashboard/*`, Orbit): the signed-in person, not a credential.
163
+ merchant_missing: 'The application has no merchant in this environment yet; register one (Orbit shows "Set up payments").',
164
+ application_membership_required: 'The signed-in Oxy account is not a member of the account that owns this application.',
165
+ permission_required: 'The member lacks an Oxy permission this needs; `param` names it (`billing:read`, `billing:manage`). An owner grants it in Oxy Console.',
166
+ membership_unavailable: 'Oxy could not be asked whether the signed-in person is a member of this application; retry.',
167
+ session_invalid: 'Oxy no longer accepts the signed-in session; sign in again.',
168
+ };
169
+ /** Every error code, sorted. */
170
+ exports.ERROR_CODES = Object.keys(exports.ERROR_CODE_DESCRIPTIONS).sort();
171
+ /** Whether a string is a documented error code. */
172
+ function isErrorCode(value) {
173
+ return Object.hasOwn(exports.ERROR_CODE_DESCRIPTIONS, value);
174
+ }
@@ -0,0 +1,176 @@
1
+ "use strict";
2
+ // The event vocabulary (ADR 0014 D4, ADR 0019): every event type the gateway
3
+ // emits and the `object` type its `data.object` carries. Zod-free, so the SDK's
4
+ // signature check, the CLI and the backend's CHECK constraints read the same
5
+ // closed set without constructing a schema.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.WEBHOOK_DELIVERY_STATUSES = exports.WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS = exports.WEBHOOK_ENDPOINT_DESCRIPTION_MAX = exports.WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT = exports.WEBHOOK_ENDPOINT_DISABLED_REASONS = exports.WEBHOOK_ENDPOINT_STATUSES = exports.WEBHOOK_ENABLED_EVENTS = exports.TARGETED_WEBHOOK_EVENT_TYPES = exports.WEBHOOK_EVENT_TYPES = exports.WEBHOOK_EVENT_OBJECTS = void 0;
8
+ /**
9
+ * Event type → the `object` value of the resource under `data.object`.
10
+ *
11
+ * TOTAL and the ONLY list: {@link WEBHOOK_EVENT_TYPES} is its keys, so a new
12
+ * event type cannot exist without saying what it delivers — an event added
13
+ * with a default would silently ship a PaymentIntent to a consumer expecting
14
+ * something else, which typechecks on both sides and fails only in production.
15
+ * The precise payload TYPE is `WebhookEventPayload` (`resources/events`), the
16
+ * registered object of each value.
17
+ *
18
+ * The order is the database's: the backend's CHECK constraints list the types
19
+ * in this order, so reordering it is a migration.
20
+ *
21
+ * - `payment_intent.*` follow the status the intent reached (ADR 0019):
22
+ * `created` when it is minted, then one per transition — `requires_action`,
23
+ * `processing`, `amount_capturable_updated` (authorized, awaiting capture),
24
+ * `succeeded`, `payment_failed` (an attempt failed; a card returns to
25
+ * `requires_payment_method`, a FairCoin underpayment is also `canceled`) and
26
+ * `canceled` (by the merchant, by expiry — `abandoned` — or underpaid).
27
+ * - Refunds are not PaymentIntent statuses: `refund.*` carry the Refund, and
28
+ * `charge.refunded` the Charge whose `amount_refunded` moved.
29
+ * - A dispute is the network's process beside a payment that stays
30
+ * `succeeded`; its events carry the Dispute, never the evidence (which is not
31
+ * stored).
32
+ * - The catalog has no `price.deleted` or `promotion_code.deleted`: those are
33
+ * archived with `active: false`, and a type that can never be sent is a
34
+ * promise the catalog cannot keep.
35
+ */
36
+ exports.WEBHOOK_EVENT_OBJECTS = {
37
+ 'payment_intent.created': 'payment_intent',
38
+ 'payment_intent.requires_action': 'payment_intent',
39
+ 'payment_intent.processing': 'payment_intent',
40
+ 'payment_intent.amount_capturable_updated': 'payment_intent',
41
+ 'payment_intent.succeeded': 'payment_intent',
42
+ 'payment_intent.payment_failed': 'payment_intent',
43
+ 'payment_intent.canceled': 'payment_intent',
44
+ 'charge.refunded': 'charge',
45
+ 'charge.dispute.created': 'dispute',
46
+ 'charge.dispute.updated': 'dispute',
47
+ 'charge.dispute.closed': 'dispute',
48
+ 'charge.dispute.funds_withdrawn': 'dispute',
49
+ 'charge.dispute.funds_reinstated': 'dispute',
50
+ 'refund.created': 'refund',
51
+ 'refund.updated': 'refund',
52
+ 'refund.failed': 'refund',
53
+ 'customer.created': 'customer',
54
+ 'customer.updated': 'customer',
55
+ 'customer.deleted': 'customer',
56
+ 'payment_method.attached': 'payment_method',
57
+ 'payment_method.detached': 'payment_method',
58
+ 'payment_method.updated': 'payment_method',
59
+ 'setup_intent.created': 'setup_intent',
60
+ 'setup_intent.requires_action': 'setup_intent',
61
+ 'setup_intent.succeeded': 'setup_intent',
62
+ 'setup_intent.setup_failed': 'setup_intent',
63
+ 'setup_intent.canceled': 'setup_intent',
64
+ 'billing.observation.updated': 'billing_observation',
65
+ 'connected_account.updated': 'connected_account',
66
+ 'product.created': 'product',
67
+ 'product.updated': 'product',
68
+ 'product.deleted': 'product',
69
+ 'price.created': 'price',
70
+ 'price.updated': 'price',
71
+ 'coupon.created': 'coupon',
72
+ 'coupon.updated': 'coupon',
73
+ 'coupon.deleted': 'coupon',
74
+ 'promotion_code.created': 'promotion_code',
75
+ 'promotion_code.updated': 'promotion_code',
76
+ 'account.updated': 'account',
77
+ 'application_fee.created': 'application_fee',
78
+ 'application_fee.refunded': 'application_fee',
79
+ 'payout.created': 'payout',
80
+ 'payout.updated': 'payout',
81
+ 'payout.paid': 'payout',
82
+ 'payout.failed': 'payout',
83
+ 'payout.canceled': 'payout',
84
+ 'balance.available': 'balance',
85
+ 'checkout.session.completed': 'checkout_session',
86
+ 'checkout.session.expired': 'checkout_session',
87
+ 'checkout.session.async_payment_succeeded': 'checkout_session',
88
+ 'checkout.session.async_payment_failed': 'checkout_session',
89
+ 'payment_link.created': 'payment_link',
90
+ 'payment_link.updated': 'payment_link',
91
+ 'reporting.report_run.succeeded': 'reporting.report_run',
92
+ 'reporting.report_run.failed': 'reporting.report_run',
93
+ 'customer.subscription.created': 'subscription',
94
+ 'customer.subscription.updated': 'subscription',
95
+ 'customer.subscription.deleted': 'subscription',
96
+ 'customer.subscription.trial_will_end': 'subscription',
97
+ 'customer.subscription.paused': 'subscription',
98
+ 'customer.subscription.resumed': 'subscription',
99
+ 'invoice.created': 'invoice',
100
+ 'invoice.updated': 'invoice',
101
+ 'invoice.deleted': 'invoice',
102
+ 'invoice.finalized': 'invoice',
103
+ 'invoice.paid': 'invoice',
104
+ 'invoice.payment_failed': 'invoice',
105
+ 'invoice.payment_action_required': 'invoice',
106
+ 'invoice.voided': 'invoice',
107
+ 'invoice.marked_uncollectible': 'invoice',
108
+ 'invoice.upcoming': 'invoice',
109
+ 'invoice.sent': 'invoice',
110
+ 'invoiceitem.created': 'invoiceitem',
111
+ 'invoiceitem.deleted': 'invoiceitem',
112
+ 'credit_note.created': 'credit_note',
113
+ 'credit_note.updated': 'credit_note',
114
+ 'credit_note.voided': 'credit_note',
115
+ 'test_helpers.test_clock.created': 'test_helpers.test_clock',
116
+ 'test_helpers.test_clock.advancing': 'test_helpers.test_clock',
117
+ 'test_helpers.test_clock.ready': 'test_helpers.test_clock',
118
+ 'test_helpers.test_clock.deleted': 'test_helpers.test_clock',
119
+ 'billing.meter.created': 'billing.meter',
120
+ 'billing.meter.updated': 'billing.meter',
121
+ 'billing.meter.deactivated': 'billing.meter',
122
+ 'billing.meter.reactivated': 'billing.meter',
123
+ 'entitlements.active_entitlement_summary.updated': 'entitlements.active_entitlement_summary',
124
+ 'billing_portal.configuration.created': 'billing_portal.configuration',
125
+ 'billing_portal.configuration.updated': 'billing_portal.configuration',
126
+ 'billing_portal.session.created': 'billing_portal.session',
127
+ 'tax.assessment.created': 'tax.assessment',
128
+ 'tax.review_item.created': 'tax.review_item',
129
+ 'tax.review_item.updated': 'tax.review_item',
130
+ 'webhook_endpoint.test': 'webhook_endpoint',
131
+ };
132
+ /** Every event type, in {@link WEBHOOK_EVENT_OBJECTS} order. */
133
+ exports.WEBHOOK_EVENT_TYPES = Object.keys(exports.WEBHOOK_EVENT_OBJECTS);
134
+ /**
135
+ * The event types never fanned out by subscription — sent only to the one
136
+ * endpoint they name. `enabled_events` refuses them.
137
+ */
138
+ exports.TARGETED_WEBHOOK_EVENT_TYPES = [
139
+ 'webhook_endpoint.test',
140
+ ];
141
+ /** What `enabled_events` may hold: `*`, then every subscribable type. */
142
+ exports.WEBHOOK_ENABLED_EVENTS = [
143
+ '*',
144
+ ...exports.WEBHOOK_EVENT_TYPES.filter((type) => !exports.TARGETED_WEBHOOK_EVENT_TYPES.includes(type)),
145
+ ];
146
+ exports.WEBHOOK_ENDPOINT_STATUSES = ['enabled', 'disabled'];
147
+ /**
148
+ * Why an endpoint is `disabled`.
149
+ *
150
+ * - `disabled_by_merchant` — its owner set `disabled: true`.
151
+ * - `delivery_failures` — every delivery to it failed for three days
152
+ * straight, so Peable stopped sending. Re-enabling it (`disabled: false`)
153
+ * starts the clock again.
154
+ */
155
+ exports.WEBHOOK_ENDPOINT_DISABLED_REASONS = [
156
+ 'disabled_by_merchant',
157
+ 'delivery_failures',
158
+ ];
159
+ /** At most this many endpoints per merchant (per mode). */
160
+ exports.WEBHOOK_ENDPOINTS_MAX_PER_MERCHANT = 16;
161
+ /** The longest an endpoint's `description` may be. */
162
+ exports.WEBHOOK_ENDPOINT_DESCRIPTION_MAX = 5000;
163
+ /** The longest a rolled secret may keep signing beside its replacement. */
164
+ exports.WEBHOOK_SECRET_ROLL_MAX_EXPIRES_IN_SECONDS = 24 * 60 * 60;
165
+ /**
166
+ * Where one webhook delivery stands (ADR 0001 D7).
167
+ *
168
+ * - `pending` — will be attempted. `next_attempt_at` says when.
169
+ * - `delivered` — terminal success.
170
+ * - `failed` — the endpoint REFUSED it (a 4xx, a blocked address), or the
171
+ * endpoint was disabled before it could be attempted. No retry
172
+ * can fix that, so none is made.
173
+ * - `dead` — every attempt failed transiently over three days and the
174
+ * budget ran out. It can be redelivered by hand.
175
+ */
176
+ exports.WEBHOOK_DELIVERY_STATUSES = ['pending', 'delivered', 'failed', 'dead'];
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // Files vocabulary (`file_…`): what a file is for, the formats it is stored
3
+ // in, and whether its bytes are being served. Zod-free.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.FILE_STATUSES = exports.FILE_TYPES = exports.FILE_UPLOAD_PURPOSES = exports.FILE_PURPOSES = void 0;
6
+ /**
7
+ * What a file is FOR. Decided at upload and never changed: the purpose is what
8
+ * sets the type and size policy, who may see the bytes, and which objects may
9
+ * reference the file — a `business_logo` is public, a `dispute_evidence` file
10
+ * is private and can only be attached to the merchant's own disputes.
11
+ */
12
+ exports.FILE_PURPOSES = [
13
+ 'dispute_evidence',
14
+ 'business_logo',
15
+ 'identity_document',
16
+ 'additional_verification',
17
+ 'finance_report_run',
18
+ 'tax_document',
19
+ ];
20
+ /**
21
+ * The purposes a merchant may upload or import. `finance_report_run` is not
22
+ * among them: a report's CSV is written by Peable's report runs
23
+ * (`/v1/reporting/report_runs`) and nobody else, so a file of that purpose is
24
+ * always a report Peable produced.
25
+ */
26
+ exports.FILE_UPLOAD_PURPOSES = [
27
+ 'dispute_evidence',
28
+ 'business_logo',
29
+ 'identity_document',
30
+ 'additional_verification',
31
+ 'tax_document',
32
+ ];
33
+ /** The stored format, by its conventional extension (Stripe's `type`). */
34
+ exports.FILE_TYPES = ['pdf', 'png', 'jpg', 'csv'];
35
+ /**
36
+ * Whether the bytes can be used right now.
37
+ *
38
+ * - `available` — Oxy serves the file; it can be shown or forwarded.
39
+ * - `withheld` — the file still exists and is not being served (its owner
40
+ * trashed it or made it private); it can come back.
41
+ * - `removed` — Oxy said the file is gone for good (deleted, taken down, lost).
42
+ * The object stays so whatever referenced it can say why it stopped working.
43
+ */
44
+ exports.FILE_STATUSES = ['available', 'withheld', 'removed'];
@@ -0,0 +1,37 @@
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
+ // `@peable.to/contracts/vocabulary` — the zod-free half of the contract: the
18
+ // closed value sets (currencies, statuses, event types, error codes) a schema
19
+ // is built from. A bundle that must stay small imports this subpath, never the
20
+ // package root, which constructs every schema at load.
21
+ __exportStar(require("./billingPortal"), exports);
22
+ __exportStar(require("./connect"), exports);
23
+ __exportStar(require("./catalog"), exports);
24
+ __exportStar(require("./errors"), exports);
25
+ __exportStar(require("./invoices"), exports);
26
+ __exportStar(require("./events"), exports);
27
+ __exportStar(require("./lists"), exports);
28
+ __exportStar(require("./money"), exports);
29
+ __exportStar(require("./tax"), exports);
30
+ __exportStar(require("./subscriptions"), exports);
31
+ __exportStar(require("./reporting"), exports);
32
+ __exportStar(require("./payments"), exports);
33
+ __exportStar(require("./version"), exports);
34
+ __exportStar(require("./checkout"), exports);
35
+ __exportStar(require("./files"), exports);
36
+ __exportStar(require("./merchants"), exports);
37
+ __exportStar(require("./paymentMethodConfigurations"), exports);
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+ // Invoices, invoice items, credit notes and the customer balance (ADR 0018
3
+ // §2–4) — the closed value sets their schemas are built from. Zod-free:
4
+ // `@peable.to/shared-types` re-exports them at runtime.
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PUBLIC_INVOICE_PAYMENT_METHOD_TYPES = exports.CUSTOMER_BALANCE_TRANSACTION_TYPES = exports.CREDIT_NOTE_LINE_TYPES = exports.CREDIT_NOTE_REASONS = exports.CREDIT_NOTE_TYPES = exports.CREDIT_NOTE_STATUSES = exports.PENDING_INVOICE_ITEMS_BEHAVIORS = exports.INVOICE_LINE_TYPES = exports.AUTOMATIC_TAX_STATUSES = exports.INVOICE_BILLING_REASONS = exports.INVOICE_STATUSES = void 0;
7
+ exports.INVOICE_STATUSES = ['draft', 'open', 'paid', 'void', 'uncollectible'];
8
+ /** Why an invoice exists. */
9
+ exports.INVOICE_BILLING_REASONS = [
10
+ 'manual',
11
+ 'subscription_create',
12
+ 'subscription_cycle',
13
+ 'subscription_update',
14
+ 'subscription_cancel',
15
+ 'upcoming',
16
+ ];
17
+ /**
18
+ * `automatic_tax.status` — Peable Tax (ADR 0011) is computed before an invoice
19
+ * finalizes (ADR 0018 §2).
20
+ *
21
+ * - `requires_location_inputs` — the customer's location could not be
22
+ * established; the invoice cannot finalize until it can.
23
+ * - `failed` — the calculation failed closed (the provider
24
+ * was unavailable, or disagreed with Peable's registrations); retried.
25
+ * - `complete` — calculated (including `not_registered`,
26
+ * which is a calculation that collects zero).
27
+ */
28
+ exports.AUTOMATIC_TAX_STATUSES = ['requires_location_inputs', 'failed', 'complete'];
29
+ /** Where an invoice line comes from: a subscription item's period, or an invoice item. */
30
+ exports.INVOICE_LINE_TYPES = ['subscription', 'invoiceitem'];
31
+ /** `pending_invoice_items_behavior` on an invoice create. Default `exclude` (Stripe's). */
32
+ exports.PENDING_INVOICE_ITEMS_BEHAVIORS = ['include', 'exclude'];
33
+ exports.CREDIT_NOTE_STATUSES = ['issued', 'void'];
34
+ /** `pre_payment` reduces what an open invoice asks for; `post_payment` gives back on a paid one. */
35
+ exports.CREDIT_NOTE_TYPES = ['pre_payment', 'post_payment'];
36
+ exports.CREDIT_NOTE_REASONS = [
37
+ 'duplicate',
38
+ 'fraudulent',
39
+ 'order_change',
40
+ 'product_unsatisfactory',
41
+ ];
42
+ /** A credit note line: part of an invoice line, or a custom amount. */
43
+ exports.CREDIT_NOTE_LINE_TYPES = ['invoice_line_item', 'custom_line_item'];
44
+ exports.CUSTOMER_BALANCE_TRANSACTION_TYPES = [
45
+ 'adjustment',
46
+ 'applied_to_invoice',
47
+ 'credit_note',
48
+ 'invoice_overpaid',
49
+ 'unapplied_from_invoice',
50
+ ];
51
+ /** The rails a hosted invoice is paid on: a card through the provider's fields, FairCoin from the payer's wallet. */
52
+ exports.PUBLIC_INVOICE_PAYMENT_METHOD_TYPES = ['card', 'faircoin'];
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // List and search bounds (ADR 0014 D1) — the gateway's, restated so a client
3
+ // can check before it asks.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.SEARCHABLE_RESOURCES = exports.SEARCH_SUBSTRING_MIN_LENGTH = exports.SEARCH_QUERY_MAX_CLAUSES = exports.SEARCH_QUERY_MAX_LENGTH = exports.LIST_LIMIT_MAX = exports.LIST_LIMIT_DEFAULT = void 0;
6
+ exports.LIST_LIMIT_DEFAULT = 10;
7
+ exports.LIST_LIMIT_MAX = 100;
8
+ exports.SEARCH_QUERY_MAX_LENGTH = 1000;
9
+ exports.SEARCH_QUERY_MAX_CLAUSES = 10;
10
+ /** A `~` substring needs at least this many characters (Stripe's rule). */
11
+ exports.SEARCH_SUBSTRING_MIN_LENGTH = 3;
12
+ /** Every searchable resource, by its path segment (`/v1/<resource>/search`). */
13
+ exports.SEARCHABLE_RESOURCES = [
14
+ 'payment_intents',
15
+ 'charges',
16
+ 'customers',
17
+ 'products',
18
+ 'prices',
19
+ 'refunds',
20
+ 'subscriptions',
21
+ 'invoices',
22
+ ];
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ // Merchant vocabulary: the environments a merchant lives in, and the closed
3
+ // sets branding draws from. Every branding value is from a CLOSED set or a
4
+ // validated colour, so nothing a merchant stores can inject markup or a remote
5
+ // font into a payer's page or an email. Zod-free.
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.BRANDING_COLOR_PATTERN = exports.BRANDING_BORDER_STYLES = exports.BRANDING_FONTS = exports.MERCHANT_ENVIRONMENTS = void 0;
8
+ exports.MERCHANT_ENVIRONMENTS = ['development', 'staging', 'production'];
9
+ /** The fonts checkout may render in — system stacks only, no remote font is ever loaded. */
10
+ exports.BRANDING_FONTS = [
11
+ 'system',
12
+ 'inter',
13
+ 'roboto',
14
+ 'open_sans',
15
+ 'lato',
16
+ 'source_sans',
17
+ 'noto_sans',
18
+ 'serif',
19
+ 'monospace',
20
+ ];
21
+ exports.BRANDING_BORDER_STYLES = ['rounded', 'rectangular', 'pill'];
22
+ /** `#rrggbb`, lowercase — the only colour spelling branding stores. */
23
+ exports.BRANDING_COLOR_PATTERN = /^#[0-9a-f]{6}$/;
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ // Money vocabulary. Every monetary value moves through the gateway as a
3
+ // canonical integer string in the currency's SMALLEST unit — m⊜ for FairCoin,
4
+ // cents for a fiat currency — so no float ever touches one.
5
+ //
6
+ // Zod-free on purpose: `@peable.to/contracts/vocabulary` is what a bundle that
7
+ // must stay small (the wallet, the hosted checkout) imports at runtime, through
8
+ // `@peable.to/shared-types`.
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.NETWORK_TYPES = exports.SIGNED_BASE_UNIT_PATTERN = exports.BASE_UNIT_PATTERN = exports.UNITS_PER_COIN = exports.FIAT_CURRENCY_CODES = exports.CURRENCY_DECIMALS = exports.CURRENCY_CODES = void 0;
11
+ exports.isCurrencyCode = isCurrencyCode;
12
+ exports.decimalsFor = decimalsFor;
13
+ exports.isBaseUnitString = isBaseUnitString;
14
+ /**
15
+ * The currencies this gateway can denominate a payment in: FairCoin on the
16
+ * chain rail, and on the card rail the fiat set the provider settles for the
17
+ * payment methods Orbit offers (cards, wallets, SEPA Debit, iDEAL, Bancontact,
18
+ * EPS). A local method narrows it further per payment
19
+ * (`PAYMENT_METHOD_CURRENCIES` in `paymentMethodConfiguration.ts`).
20
+ *
21
+ * A closed set, and the database mirrors it as a CHECK
22
+ * (`db/schema/valueSets.ts`). ADR 0001 D4: the scale of an amount is a property
23
+ * of its currency and is NOT implied by the field's type, which is why
24
+ * {@link CURRENCY_DECIMALS} exists and why {@link UNITS_PER_COIN} must never be
25
+ * used to interpret a fiat amount.
26
+ */
27
+ exports.CURRENCY_CODES = [
28
+ 'FAIR',
29
+ 'EUR',
30
+ 'USD',
31
+ 'GBP',
32
+ 'CHF',
33
+ 'SEK',
34
+ 'NOK',
35
+ 'DKK',
36
+ 'PLN',
37
+ 'CZK',
38
+ 'CAD',
39
+ 'AUD',
40
+ 'JPY',
41
+ ];
42
+ /** Whether an arbitrary string is a currency this gateway knows. */
43
+ function isCurrencyCode(value) {
44
+ return exports.CURRENCY_CODES.includes(value);
45
+ }
46
+ /**
47
+ * How many decimal places each currency's smallest unit represents — i.e. an
48
+ * amount of `1` means `10^-decimals` of one whole unit.
49
+ *
50
+ * ISO 4217's minor units for every fiat member (JPY has none). FairCoin's 8 is
51
+ * a consensus constant and is pinned against {@link UNITS_PER_COIN} by this
52
+ * package's own tests, so the two spellings of one fact cannot drift.
53
+ */
54
+ exports.CURRENCY_DECIMALS = Object.freeze({
55
+ FAIR: 8,
56
+ EUR: 2,
57
+ USD: 2,
58
+ GBP: 2,
59
+ CHF: 2,
60
+ SEK: 2,
61
+ NOK: 2,
62
+ DKK: 2,
63
+ PLN: 2,
64
+ CZK: 2,
65
+ CAD: 2,
66
+ AUD: 2,
67
+ // A zero-decimal currency: an amount of `1` is one yen, never a hundredth of
68
+ // one. The provider counts JPY the same way, so the base unit crosses as is.
69
+ JPY: 0,
70
+ });
71
+ /** The fiat members — every currency the card rail can denominate a payment in. */
72
+ exports.FIAT_CURRENCY_CODES = exports.CURRENCY_CODES.filter((code) => code !== 'FAIR');
73
+ /** The decimal places of `currency`'s smallest unit. */
74
+ function decimalsFor(currency) {
75
+ return exports.CURRENCY_DECIMALS[currency];
76
+ }
77
+ /**
78
+ * Frozen FairCoin consensus constant (smallest units per FAIR). Mirrors
79
+ * `@fairco.in/core`'s branding.ts; inlined to keep this module zero-dependency
80
+ * for a clean CJS+ESM publish — must stay a bigint, never converted to number.
81
+ *
82
+ * FAIRCOIN ONLY. A fiat amount has its own scale (`CURRENCY_DECIMALS`), and
83
+ * dividing a EUR amount by this constant is off by six orders of magnitude with
84
+ * nothing failing.
85
+ */
86
+ exports.UNITS_PER_COIN = 100000000n;
87
+ /** The spelling of a base-unit amount: digits, no sign, no leading zeros but `0`. */
88
+ exports.BASE_UNIT_PATTERN = /^(0|[1-9][0-9]*)$/;
89
+ /** A signed base-unit amount (a customer balance, a balance transaction's net). */
90
+ exports.SIGNED_BASE_UNIT_PATTERN = /^(0|-?[1-9][0-9]*)$/;
91
+ /**
92
+ * True only for a canonical non-negative integer string in the currency's
93
+ * smallest unit: one or more decimal digits, no sign, no decimal point, no
94
+ * leading zeros (except the literal "0"). Floats and negatives are rejected.
95
+ *
96
+ * Currency-agnostic on purpose — the pattern is about the SPELLING of an
97
+ * amount, not its scale, and the same one is restated as a CHECK in the
98
+ * database (`BASE_UNIT_STRING_PATTERN`), byte-identical.
99
+ */
100
+ function isBaseUnitString(s) {
101
+ return exports.BASE_UNIT_PATTERN.test(s);
102
+ }
103
+ /** FairCoin network identifier, mirroring `@fairco.in/core`'s `NetworkType`. */
104
+ exports.NETWORK_TYPES = ['mainnet', 'testnet'];