@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,21 @@
1
+ // `@peable.to/contracts/vocabulary` — the zod-free half of the contract: the
2
+ // closed value sets (currencies, statuses, event types, error codes) a schema
3
+ // is built from. A bundle that must stay small imports this subpath, never the
4
+ // package root, which constructs every schema at load.
5
+ export * from './billingPortal.js';
6
+ export * from './connect.js';
7
+ export * from './catalog.js';
8
+ export * from './errors.js';
9
+ export * from './invoices.js';
10
+ export * from './events.js';
11
+ export * from './lists.js';
12
+ export * from './money.js';
13
+ export * from './tax.js';
14
+ export * from './subscriptions.js';
15
+ export * from './reporting.js';
16
+ export * from './payments.js';
17
+ export * from './version.js';
18
+ export * from './checkout.js';
19
+ export * from './files.js';
20
+ export * from './merchants.js';
21
+ export * from './paymentMethodConfigurations.js';
@@ -0,0 +1,49 @@
1
+ // Invoices, invoice items, credit notes and the customer balance (ADR 0018
2
+ // §2–4) — the closed value sets their schemas are built from. Zod-free:
3
+ // `@peable.to/shared-types` re-exports them at runtime.
4
+ export const INVOICE_STATUSES = ['draft', 'open', 'paid', 'void', 'uncollectible'];
5
+ /** Why an invoice exists. */
6
+ export const INVOICE_BILLING_REASONS = [
7
+ 'manual',
8
+ 'subscription_create',
9
+ 'subscription_cycle',
10
+ 'subscription_update',
11
+ 'subscription_cancel',
12
+ 'upcoming',
13
+ ];
14
+ /**
15
+ * `automatic_tax.status` — Peable Tax (ADR 0011) is computed before an invoice
16
+ * finalizes (ADR 0018 §2).
17
+ *
18
+ * - `requires_location_inputs` — the customer's location could not be
19
+ * established; the invoice cannot finalize until it can.
20
+ * - `failed` — the calculation failed closed (the provider
21
+ * was unavailable, or disagreed with Peable's registrations); retried.
22
+ * - `complete` — calculated (including `not_registered`,
23
+ * which is a calculation that collects zero).
24
+ */
25
+ export const AUTOMATIC_TAX_STATUSES = ['requires_location_inputs', 'failed', 'complete'];
26
+ /** Where an invoice line comes from: a subscription item's period, or an invoice item. */
27
+ export const INVOICE_LINE_TYPES = ['subscription', 'invoiceitem'];
28
+ /** `pending_invoice_items_behavior` on an invoice create. Default `exclude` (Stripe's). */
29
+ export const PENDING_INVOICE_ITEMS_BEHAVIORS = ['include', 'exclude'];
30
+ export const CREDIT_NOTE_STATUSES = ['issued', 'void'];
31
+ /** `pre_payment` reduces what an open invoice asks for; `post_payment` gives back on a paid one. */
32
+ export const CREDIT_NOTE_TYPES = ['pre_payment', 'post_payment'];
33
+ export const CREDIT_NOTE_REASONS = [
34
+ 'duplicate',
35
+ 'fraudulent',
36
+ 'order_change',
37
+ 'product_unsatisfactory',
38
+ ];
39
+ /** A credit note line: part of an invoice line, or a custom amount. */
40
+ export const CREDIT_NOTE_LINE_TYPES = ['invoice_line_item', 'custom_line_item'];
41
+ export const CUSTOMER_BALANCE_TRANSACTION_TYPES = [
42
+ 'adjustment',
43
+ 'applied_to_invoice',
44
+ 'credit_note',
45
+ 'invoice_overpaid',
46
+ 'unapplied_from_invoice',
47
+ ];
48
+ /** The rails a hosted invoice is paid on: a card through the provider's fields, FairCoin from the payer's wallet. */
49
+ export const PUBLIC_INVOICE_PAYMENT_METHOD_TYPES = ['card', 'faircoin'];
@@ -0,0 +1,19 @@
1
+ // List and search bounds (ADR 0014 D1) — the gateway's, restated so a client
2
+ // can check before it asks.
3
+ export const LIST_LIMIT_DEFAULT = 10;
4
+ export const LIST_LIMIT_MAX = 100;
5
+ export const SEARCH_QUERY_MAX_LENGTH = 1000;
6
+ export const SEARCH_QUERY_MAX_CLAUSES = 10;
7
+ /** A `~` substring needs at least this many characters (Stripe's rule). */
8
+ export const SEARCH_SUBSTRING_MIN_LENGTH = 3;
9
+ /** Every searchable resource, by its path segment (`/v1/<resource>/search`). */
10
+ export const SEARCHABLE_RESOURCES = [
11
+ 'payment_intents',
12
+ 'charges',
13
+ 'customers',
14
+ 'products',
15
+ 'prices',
16
+ 'refunds',
17
+ 'subscriptions',
18
+ 'invoices',
19
+ ];
@@ -0,0 +1,20 @@
1
+ // Merchant vocabulary: the environments a merchant lives in, and the closed
2
+ // sets branding draws from. Every branding value is from a CLOSED set or a
3
+ // validated colour, so nothing a merchant stores can inject markup or a remote
4
+ // font into a payer's page or an email. Zod-free.
5
+ export const MERCHANT_ENVIRONMENTS = ['development', 'staging', 'production'];
6
+ /** The fonts checkout may render in — system stacks only, no remote font is ever loaded. */
7
+ export const BRANDING_FONTS = [
8
+ 'system',
9
+ 'inter',
10
+ 'roboto',
11
+ 'open_sans',
12
+ 'lato',
13
+ 'source_sans',
14
+ 'noto_sans',
15
+ 'serif',
16
+ 'monospace',
17
+ ];
18
+ export const BRANDING_BORDER_STYLES = ['rounded', 'rectangular', 'pill'];
19
+ /** `#rrggbb`, lowercase — the only colour spelling branding stores. */
20
+ export const BRANDING_COLOR_PATTERN = /^#[0-9a-f]{6}$/;
@@ -0,0 +1,98 @@
1
+ // Money vocabulary. Every monetary value moves through the gateway as a
2
+ // canonical integer string in the currency's SMALLEST unit — m⊜ for FairCoin,
3
+ // cents for a fiat currency — so no float ever touches one.
4
+ //
5
+ // Zod-free on purpose: `@peable.to/contracts/vocabulary` is what a bundle that
6
+ // must stay small (the wallet, the hosted checkout) imports at runtime, through
7
+ // `@peable.to/shared-types`.
8
+ /**
9
+ * The currencies this gateway can denominate a payment in: FairCoin on the
10
+ * chain rail, and on the card rail the fiat set the provider settles for the
11
+ * payment methods Orbit offers (cards, wallets, SEPA Debit, iDEAL, Bancontact,
12
+ * EPS). A local method narrows it further per payment
13
+ * (`PAYMENT_METHOD_CURRENCIES` in `paymentMethodConfiguration.ts`).
14
+ *
15
+ * A closed set, and the database mirrors it as a CHECK
16
+ * (`db/schema/valueSets.ts`). ADR 0001 D4: the scale of an amount is a property
17
+ * of its currency and is NOT implied by the field's type, which is why
18
+ * {@link CURRENCY_DECIMALS} exists and why {@link UNITS_PER_COIN} must never be
19
+ * used to interpret a fiat amount.
20
+ */
21
+ export const CURRENCY_CODES = [
22
+ 'FAIR',
23
+ 'EUR',
24
+ 'USD',
25
+ 'GBP',
26
+ 'CHF',
27
+ 'SEK',
28
+ 'NOK',
29
+ 'DKK',
30
+ 'PLN',
31
+ 'CZK',
32
+ 'CAD',
33
+ 'AUD',
34
+ 'JPY',
35
+ ];
36
+ /** Whether an arbitrary string is a currency this gateway knows. */
37
+ export function isCurrencyCode(value) {
38
+ return CURRENCY_CODES.includes(value);
39
+ }
40
+ /**
41
+ * How many decimal places each currency's smallest unit represents — i.e. an
42
+ * amount of `1` means `10^-decimals` of one whole unit.
43
+ *
44
+ * ISO 4217's minor units for every fiat member (JPY has none). FairCoin's 8 is
45
+ * a consensus constant and is pinned against {@link UNITS_PER_COIN} by this
46
+ * package's own tests, so the two spellings of one fact cannot drift.
47
+ */
48
+ export const CURRENCY_DECIMALS = Object.freeze({
49
+ FAIR: 8,
50
+ EUR: 2,
51
+ USD: 2,
52
+ GBP: 2,
53
+ CHF: 2,
54
+ SEK: 2,
55
+ NOK: 2,
56
+ DKK: 2,
57
+ PLN: 2,
58
+ CZK: 2,
59
+ CAD: 2,
60
+ AUD: 2,
61
+ // A zero-decimal currency: an amount of `1` is one yen, never a hundredth of
62
+ // one. The provider counts JPY the same way, so the base unit crosses as is.
63
+ JPY: 0,
64
+ });
65
+ /** The fiat members — every currency the card rail can denominate a payment in. */
66
+ export const FIAT_CURRENCY_CODES = CURRENCY_CODES.filter((code) => code !== 'FAIR');
67
+ /** The decimal places of `currency`'s smallest unit. */
68
+ export function decimalsFor(currency) {
69
+ return CURRENCY_DECIMALS[currency];
70
+ }
71
+ /**
72
+ * Frozen FairCoin consensus constant (smallest units per FAIR). Mirrors
73
+ * `@fairco.in/core`'s branding.ts; inlined to keep this module zero-dependency
74
+ * for a clean CJS+ESM publish — must stay a bigint, never converted to number.
75
+ *
76
+ * FAIRCOIN ONLY. A fiat amount has its own scale (`CURRENCY_DECIMALS`), and
77
+ * dividing a EUR amount by this constant is off by six orders of magnitude with
78
+ * nothing failing.
79
+ */
80
+ export const UNITS_PER_COIN = 100000000n;
81
+ /** The spelling of a base-unit amount: digits, no sign, no leading zeros but `0`. */
82
+ export const BASE_UNIT_PATTERN = /^(0|[1-9][0-9]*)$/;
83
+ /** A signed base-unit amount (a customer balance, a balance transaction's net). */
84
+ export const SIGNED_BASE_UNIT_PATTERN = /^(0|-?[1-9][0-9]*)$/;
85
+ /**
86
+ * True only for a canonical non-negative integer string in the currency's
87
+ * smallest unit: one or more decimal digits, no sign, no decimal point, no
88
+ * leading zeros (except the literal "0"). Floats and negatives are rejected.
89
+ *
90
+ * Currency-agnostic on purpose — the pattern is about the SPELLING of an
91
+ * amount, not its scale, and the same one is restated as a CHECK in the
92
+ * database (`BASE_UNIT_STRING_PATTERN`), byte-identical.
93
+ */
94
+ export function isBaseUnitString(s) {
95
+ return BASE_UNIT_PATTERN.test(s);
96
+ }
97
+ /** FairCoin network identifier, mirroring `@fairco.in/core`'s `NetworkType`. */
98
+ export const NETWORK_TYPES = ['mainnet', 'testnet'];
@@ -0,0 +1,33 @@
1
+ // Payment method breadth on the card rail (`pmc_…`, `pmd_…`). Zod-free.
2
+ /**
3
+ * The methods a configuration can turn on.
4
+ *
5
+ * `apple_pay` and `google_pay` are WALLETS over a card: a payment made with one
6
+ * is a `card` payment, so they appear here and never in a PaymentIntent's
7
+ * `payment_method_types`. `bizum` is listed because merchants ask for it and the
8
+ * honest answer is a reason, not an absence: the provider does not offer it.
9
+ *
10
+ * Deliberately absent: the provider's own consumer wallet (its brand on Orbit's
11
+ * checkout, `payment-provider-boundary.md`) and giropay (discontinued by the
12
+ * scheme).
13
+ */
14
+ export const PAYMENT_METHOD_CONFIGURATION_TYPES = [
15
+ 'card',
16
+ 'apple_pay',
17
+ 'google_pay',
18
+ 'sepa_debit',
19
+ 'ideal',
20
+ 'bancontact',
21
+ 'eps',
22
+ 'bizum',
23
+ ];
24
+ /**
25
+ * Why a method cannot be offered whatever the merchant chooses.
26
+ *
27
+ * - `provider_unsupported` — the processing provider does not offer it;
28
+ * - `requires_card` — a wallet rides on card payments, and card is off.
29
+ */
30
+ export const PAYMENT_METHOD_UNAVAILABLE_REASONS = [
31
+ 'provider_unsupported',
32
+ 'requires_card',
33
+ ];
@@ -0,0 +1,192 @@
1
+ // The payments vocabulary (ADR 0014 D5): the closed value sets the payment
2
+ // intent, charge, refund, dispute, setup intent, social and test-helper
3
+ // contracts are built from. Zod-free, so the wallet and the shared types read
4
+ // them without bundling a schema.
5
+ /**
6
+ * Which rail moves the money (ADR 0001 D1). On the INTENT, not on the merchant:
7
+ * one merchant takes both, and the rail decides which fields mean anything.
8
+ */
9
+ export const PAYMENT_INTENT_RAILS = ['faircoin', 'card'];
10
+ /**
11
+ * Stripe's seven statuses, and no others (ADR 0019). The FairCoin rail walks
12
+ * four of them (`requires_action` → `processing` → `succeeded` | `canceled`); a
13
+ * card walks all seven. The order is the lifecycle table's
14
+ * (`@peable.to/shared-types`), which the database CHECK is rendered from.
15
+ */
16
+ export const PAYMENT_INTENT_STATUSES = [
17
+ 'requires_payment_method',
18
+ 'requires_confirmation',
19
+ 'requires_action',
20
+ 'processing',
21
+ 'requires_capture',
22
+ 'succeeded',
23
+ 'canceled',
24
+ ];
25
+ /**
26
+ * Why an intent was cancelled — Stripe's reasons, plus `underpaid` (FairCoin
27
+ * only: a transaction paid less than the amount).
28
+ */
29
+ export const PAYMENT_INTENT_CANCELLATION_REASONS = [
30
+ 'abandoned',
31
+ 'automatic',
32
+ 'duplicate',
33
+ 'fraudulent',
34
+ 'requested_by_customer',
35
+ 'underpaid',
36
+ ];
37
+ /** The reasons a MERCHANT may give `POST /v1/payment_intents/:id/cancel`. */
38
+ export const MERCHANT_CANCELLATION_REASONS = [
39
+ 'abandoned',
40
+ 'duplicate',
41
+ 'fraudulent',
42
+ 'requested_by_customer',
43
+ ];
44
+ /** When a card is captured: at confirmation, or by `POST …/capture` (card only). */
45
+ export const PAYMENT_INTENT_CAPTURE_METHODS = ['automatic', 'manual'];
46
+ /** Card only: keep the payment method on the customer for later (ADR 0016). */
47
+ export const PAYMENT_INTENT_SETUP_FUTURE_USAGES = ['on_session', 'off_session'];
48
+ /** The card-rail types a PaymentIntent can carry in `payment_method_types`. */
49
+ export const CARD_RAIL_PAYMENT_METHOD_TYPES = [
50
+ 'card',
51
+ 'sepa_debit',
52
+ 'ideal',
53
+ 'bancontact',
54
+ 'eps',
55
+ ];
56
+ /**
57
+ * Every payment method type a PaymentIntent can carry: `faircoin` on the chain
58
+ * rail, the card rail's otherwise. Wallets (Apple Pay, Google Pay) are `card`.
59
+ */
60
+ export const PAYMENT_METHOD_TYPES = ['faircoin', ...CARD_RAIL_PAYMENT_METHOD_TYPES];
61
+ /** The kinds of `last_payment_error` (and a SetupIntent's `last_setup_error`). */
62
+ export const PAYMENT_ERROR_TYPES = ['card_error', 'payment_error', 'api_error'];
63
+ /** How the payer's client continues: a confirmation credential, or a redirect. */
64
+ export const CLIENT_ACTION_KINDS = ['client_secret', 'redirect'];
65
+ // ---------------------------------------------------------------------------
66
+ // Refunds and settlements
67
+ // ---------------------------------------------------------------------------
68
+ /**
69
+ * Where one refund stands — the MONEY's own lifecycle, not the payment's.
70
+ * `canceled` only through `POST /v1/refunds/:id/cancel`.
71
+ */
72
+ export const REFUND_STATUSES = ['pending', 'succeeded', 'failed', 'canceled'];
73
+ /** Stripe's refund reasons. */
74
+ export const REFUND_REASONS = ['duplicate', 'fraudulent', 'requested_by_customer'];
75
+ /**
76
+ * Who created a refund. `provider`: it appeared at the acquirer (a dashboard
77
+ * refund, a dispute's resolution) and was imported, without an `external_ref`.
78
+ */
79
+ export const REFUND_ORIGINS = ['merchant', 'provider'];
80
+ /** Where a payment's settlement figures stand. `unknown` is not zero. */
81
+ export const SETTLEMENT_STATUSES = ['available', 'pending', 'unknown'];
82
+ // ---------------------------------------------------------------------------
83
+ // Disputes
84
+ // ---------------------------------------------------------------------------
85
+ /**
86
+ * Where a dispute stands. `needs_response` and `under_review` are open; `won`
87
+ * and `lost` are terminal. There is deliberately no `closed`.
88
+ */
89
+ export const DISPUTE_STATUSES = ['needs_response', 'under_review', 'won', 'lost'];
90
+ /** Why the cardholder disputed — Stripe's enum; an unmapped network reason reads `general`. */
91
+ export const DISPUTE_REASONS = [
92
+ 'bank_cannot_process',
93
+ 'check_returned',
94
+ 'credit_not_processed',
95
+ 'customer_initiated',
96
+ 'debit_not_authorized',
97
+ 'duplicate',
98
+ 'fraudulent',
99
+ 'general',
100
+ 'incorrect_account_details',
101
+ 'insufficient_funds',
102
+ 'noncompliant',
103
+ 'product_not_received',
104
+ 'product_unacceptable',
105
+ 'subscription_canceled',
106
+ 'unrecognized',
107
+ ];
108
+ /**
109
+ * The TEXT evidence fields — the network's names, never a Peable paraphrase: a
110
+ * merchant assembling a defence reads their acquirer's guidance, and renamed
111
+ * fields would make it not apply. The Stripe adapter's name map is a total
112
+ * `Record` over this set, so a field added here does not compile until it
113
+ * carries it.
114
+ */
115
+ export const DISPUTE_TEXT_EVIDENCE_FIELDS = [
116
+ 'access_activity_log',
117
+ 'billing_address',
118
+ 'cancellation_policy_disclosure',
119
+ 'cancellation_rebuttal',
120
+ 'customer_email_address',
121
+ 'customer_name',
122
+ 'customer_purchase_ip',
123
+ 'duplicate_charge_explanation',
124
+ 'product_description',
125
+ 'refund_policy_disclosure',
126
+ 'refund_refusal_explanation',
127
+ 'service_date',
128
+ 'shipping_address',
129
+ 'shipping_carrier',
130
+ 'shipping_date',
131
+ 'shipping_tracking_number',
132
+ 'uncategorized_text',
133
+ ];
134
+ /** The FILE evidence fields: each names a `file_…` of purpose `dispute_evidence`. */
135
+ export const DISPUTE_FILE_EVIDENCE_FIELDS = [
136
+ 'cancellation_policy',
137
+ 'customer_communication',
138
+ 'customer_signature',
139
+ 'duplicate_charge_documentation',
140
+ 'receipt',
141
+ 'refund_policy',
142
+ 'service_documentation',
143
+ 'shipping_documentation',
144
+ 'uncategorized_file',
145
+ ];
146
+ /** The provider's ceiling on one TEXT evidence field, restated where the request is parsed. */
147
+ export const DISPUTE_EVIDENCE_TEXT_MAX = 20000;
148
+ // ---------------------------------------------------------------------------
149
+ // SetupIntents
150
+ // ---------------------------------------------------------------------------
151
+ export const SETUP_INTENT_STATUSES = [
152
+ 'requires_payment_method',
153
+ 'requires_confirmation',
154
+ 'requires_action',
155
+ 'processing',
156
+ 'canceled',
157
+ 'succeeded',
158
+ ];
159
+ export const SETUP_INTENT_USAGES = ['on_session', 'off_session'];
160
+ export const SETUP_INTENT_CANCELLATION_REASONS = [
161
+ 'abandoned',
162
+ 'duplicate',
163
+ 'requested_by_customer',
164
+ ];
165
+ // ---------------------------------------------------------------------------
166
+ // Social payments and enrichment
167
+ // ---------------------------------------------------------------------------
168
+ /**
169
+ * Longest `source.app` of a social payment: an app slug, not a label. The
170
+ * column CHECK reads the same bound.
171
+ */
172
+ export const SOCIAL_SOURCE_APP_MAX_LENGTH = 32;
173
+ /**
174
+ * Longest `source.ref` of a social payment. The bound is the whole defence: the
175
+ * value is opaque, so nothing downstream would notice it growing.
176
+ */
177
+ export const SOCIAL_SOURCE_REF_MAX_LENGTH = 128;
178
+ /** Which side of a social payment the caller was on. */
179
+ export const SOCIAL_PAYMENT_DIRECTIONS = ['sent', 'received'];
180
+ /** Where a transaction's counterparty identity came from. */
181
+ export const ENRICHMENT_KINDS = ['merchant', 'user', 'unknown'];
182
+ /** How many addresses one `POST /v1/enrich` resolves (and one social history lists). */
183
+ export const ENRICH_MAX_ADDRESSES = 50;
184
+ // ---------------------------------------------------------------------------
185
+ // Test helpers
186
+ // ---------------------------------------------------------------------------
187
+ /**
188
+ * What `simulate_faircoin_payment` pretends the payer did: `settled` paid the
189
+ * full amount (`processing` → `succeeded`); `underpaid` sent less
190
+ * (`processing` → `canceled`, `cancellation_reason: 'underpaid'`).
191
+ */
192
+ export const SIMULATED_FAIRCOIN_OUTCOMES = ['settled', 'underpaid'];
@@ -0,0 +1,24 @@
1
+ // Reporting and request-log vocabulary: the report types Peable produces, a
2
+ // run's lifecycle, and the methods and status classes a request log is
3
+ // filtered by. Zod-free, like every vocabulary module.
4
+ /**
5
+ * Every report Peable produces, by Stripe's versioned id: the trailing `.1` is
6
+ * the column layout's version, so a layout can change under a new id without
7
+ * changing a report a merchant already parses. The layouts themselves are
8
+ * `REPORT_TYPE_LAYOUTS` in `@peable.to/shared-types/reporting`.
9
+ */
10
+ export const REPORT_TYPE_IDS = [
11
+ 'payments.itemized.1',
12
+ 'balance.summary.1',
13
+ 'balance_transactions.itemized.1',
14
+ 'payouts.itemized.1',
15
+ 'refunds.itemized.1',
16
+ 'disputes.itemized.1',
17
+ ];
18
+ export const REPORT_RUN_STATUSES = ['pending', 'succeeded', 'failed'];
19
+ /** The HTTP methods a request log records. */
20
+ export const REQUEST_LOG_METHODS = ['GET', 'POST', 'DELETE', 'PATCH', 'PUT'];
21
+ /** A request-log `status` filter's class form (`4xx` is 400–499). */
22
+ export const REQUEST_LOG_STATUS_CLASSES = ['2xx', '3xx', '4xx', '5xx'];
23
+ /** How long a request log is kept (and served). */
24
+ export const REQUEST_LOG_RETENTION_DAYS = 30;
@@ -0,0 +1,57 @@
1
+ // Subscriptions (ADR 0018 §1) — the closed value sets their schemas are built
2
+ // from. Zod-free: `@peable.to/shared-types` re-exports them at runtime.
3
+ /**
4
+ * Where a subscription stands — Stripe's eight.
5
+ *
6
+ * - `incomplete` — the first invoice is not paid yet; expires to
7
+ * `incomplete_expired` when nobody pays it in time.
8
+ * - `incomplete_expired` — terminal: the first invoice was never paid.
9
+ * - `trialing` — in a trial; nothing is charged until it ends.
10
+ * - `active` — in good standing.
11
+ * - `past_due` — a renewal invoice failed; dunning is retrying it.
12
+ * - `unpaid` — dunning gave up and the merchant's final action
13
+ * is `unpaid`: invoices are still created, access
14
+ * should be withdrawn.
15
+ * - `canceled` — terminal.
16
+ * - `paused` — a trial ended with no payment method and the
17
+ * trial's end behaviour was `pause`; resumed with
18
+ * `POST /v1/subscriptions/:id/resume`.
19
+ */
20
+ export const SUBSCRIPTION_STATUSES = [
21
+ 'incomplete',
22
+ 'incomplete_expired',
23
+ 'trialing',
24
+ 'active',
25
+ 'past_due',
26
+ 'unpaid',
27
+ 'canceled',
28
+ 'paused',
29
+ ];
30
+ /** `status=` on a subscription list: a status, `all` (including canceled), or `ended`. */
31
+ export const SUBSCRIPTION_LIST_STATUSES = [...SUBSCRIPTION_STATUSES, 'all', 'ended'];
32
+ /** How the subscription's invoices are collected. FairCoin is always `send_invoice`. */
33
+ export const COLLECTION_METHODS = ['charge_automatically', 'send_invoice'];
34
+ /** How a change mid-period is billed. */
35
+ export const PRORATION_BEHAVIORS = ['create_prorations', 'none', 'always_invoice'];
36
+ /** The proration behaviours a subscription CREATE accepts: there is nothing to invoice at once yet. */
37
+ export const CREATE_PRORATION_BEHAVIORS = [
38
+ 'create_prorations',
39
+ 'none',
40
+ ];
41
+ /** What a create does when the first invoice cannot be paid at once. */
42
+ export const PAYMENT_BEHAVIORS = [
43
+ 'allow_incomplete',
44
+ 'default_incomplete',
45
+ 'error_if_incomplete',
46
+ ];
47
+ /** What happens to the invoices of a subscription whose collection is paused. */
48
+ export const PAUSE_COLLECTION_BEHAVIORS = ['keep_as_draft', 'mark_uncollectible', 'void'];
49
+ /** What a trial ending with no payment method does (`trial_settings.end_behavior`). */
50
+ export const TRIAL_END_BEHAVIORS = ['cancel', 'create_invoice', 'pause'];
51
+ /** Why a subscription was cancelled. */
52
+ export const SUBSCRIPTION_CANCELLATION_REASONS = [
53
+ 'cancellation_requested',
54
+ 'payment_failed',
55
+ ];
56
+ /** `billing_cycle_anchor` on a resume: a new period now (the default), or the anchor kept. */
57
+ export const RESUME_BILLING_CYCLE_ANCHORS = ['now', 'unchanged'];