@volter/twin-stripe 2.0.38 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (402) hide show
  1. package/README.md +112 -207
  2. package/dist/generated/pack-facts.json +94 -0
  3. package/dist/journeys/coverage.json +596 -0
  4. package/dist/journeys/customer-life.json +6108 -0
  5. package/dist/journeys/customer-life.outline.md +371 -0
  6. package/dist/journeys/decisions.json +677 -0
  7. package/dist/journeys/demand.json +706 -0
  8. package/dist/journeys/score.json +853 -0
  9. package/dist/journeys/unreachable.json +102 -0
  10. package/dist/journeys/vendor-examples.json +8010 -0
  11. package/dist/spec/SOURCE.md +18 -0
  12. package/dist/spec/doc-examples.json +445 -0
  13. package/dist/spec/fixtures3.json.gz +0 -0
  14. package/dist/spec/openapi.json.gz +0 -0
  15. package/dist/spec/patches.json +34 -0
  16. package/dist/spec/sources.json +306 -0
  17. package/dist/src/cli.d.ts +0 -1
  18. package/dist/src/cli.js +11 -31
  19. package/dist/src/engine/after-payment.d.ts +8 -0
  20. package/dist/src/engine/after-payment.js +27 -0
  21. package/dist/src/engine/apps-secrets.d.ts +1 -0
  22. package/dist/src/engine/apps-secrets.js +3 -0
  23. package/dist/src/engine/balance.d.ts +5 -0
  24. package/dist/src/engine/balance.js +15 -0
  25. package/dist/src/engine/checkout.d.ts +24 -0
  26. package/dist/src/engine/checkout.js +30 -0
  27. package/dist/src/engine/common.d.ts +19 -0
  28. package/dist/src/engine/common.js +34 -0
  29. package/dist/src/engine/connect.d.ts +45 -0
  30. package/dist/src/engine/connect.js +108 -0
  31. package/dist/src/engine/customers.d.ts +4 -0
  32. package/dist/src/engine/customers.js +8 -0
  33. package/dist/src/engine/display.d.ts +11 -0
  34. package/dist/src/engine/display.js +13 -0
  35. package/dist/src/engine/files.d.ts +11 -0
  36. package/dist/src/engine/files.js +23 -0
  37. package/dist/src/engine/invoices.d.ts +21 -0
  38. package/dist/src/engine/invoices.js +84 -0
  39. package/dist/src/engine/issuing.d.ts +33 -0
  40. package/dist/src/engine/issuing.js +54 -0
  41. package/dist/src/engine/ledger.d.ts +8 -0
  42. package/dist/src/engine/ledger.js +8 -0
  43. package/dist/src/engine/oauth.d.ts +4 -0
  44. package/dist/src/engine/oauth.js +24 -0
  45. package/dist/src/engine/onboarding.d.ts +13 -0
  46. package/dist/src/engine/onboarding.js +42 -0
  47. package/dist/src/{stripe-params.d.ts → engine/params.d.ts} +20 -3
  48. package/dist/src/{stripe-params.js → engine/params.js} +7 -60
  49. package/dist/src/engine/payment-intents.d.ts +10 -0
  50. package/dist/src/engine/payment-intents.js +27 -0
  51. package/dist/src/engine/payment-methods.d.ts +16 -0
  52. package/dist/src/engine/payment-methods.js +22 -0
  53. package/dist/src/engine/radar.d.ts +2 -0
  54. package/dist/src/engine/radar.js +5 -0
  55. package/dist/src/engine/refunds.d.ts +1 -0
  56. package/dist/src/engine/refunds.js +3 -0
  57. package/dist/src/engine/renewals.d.ts +36 -0
  58. package/dist/src/engine/renewals.js +65 -0
  59. package/dist/src/{stripe-twin.d.ts → engine/stripe.d.ts} +12 -45
  60. package/dist/src/{stripe-twin.js → engine/stripe.js} +53 -387
  61. package/dist/src/engine/subscriptions.d.ts +11 -0
  62. package/dist/src/engine/subscriptions.js +30 -0
  63. package/dist/src/engine/transfers.d.ts +2 -0
  64. package/dist/src/engine/transfers.js +1 -0
  65. package/dist/src/{stripe-version.d.ts → engine/version.d.ts} +0 -2
  66. package/dist/src/{stripe-version.js → engine/version.js} +21 -9
  67. package/dist/src/engine/webhook-endpoints.d.ts +1 -0
  68. package/dist/src/engine/webhook-endpoints.js +12 -0
  69. package/dist/src/engine/webhooks.d.ts +31 -0
  70. package/dist/src/engine/webhooks.js +68 -0
  71. package/dist/src/fetch.d.ts +2 -0
  72. package/dist/src/fetch.js +26 -0
  73. package/dist/src/generated/surface.gen.json +1 -1
  74. package/dist/src/generated/ui.gen.json +1 -1
  75. package/dist/src/index.d.ts +5 -14
  76. package/dist/src/index.js +10 -75
  77. package/dist/src/manifest.js +478 -876
  78. package/dist/src/screens/billing-portal.d.ts +3 -0
  79. package/dist/src/screens/{portal.js → billing-portal.js} +32 -58
  80. package/dist/src/screens/checkout-js.d.ts +2 -0
  81. package/dist/src/screens/checkout-js.js +84 -0
  82. package/dist/src/screens/checkout.d.ts +2 -31
  83. package/dist/src/screens/checkout.js +32 -121
  84. package/dist/src/screens/connect-onboarding.d.ts +3 -0
  85. package/dist/src/screens/{onboarding.js → connect-onboarding.js} +38 -104
  86. package/dist/src/screens/dashboard.d.ts +3 -0
  87. package/dist/src/screens/dashboard.js +116 -0
  88. package/dist/src/screens/shared.d.ts +27 -0
  89. package/dist/src/screens/shared.js +87 -0
  90. package/dist/src/screens/stripe-js.d.ts +3 -0
  91. package/dist/src/screens/stripe-js.js +95 -0
  92. package/dist/src/semantics/account.d.ts +2 -0
  93. package/dist/src/semantics/account.js +8 -0
  94. package/dist/src/semantics/account_links.d.ts +2 -0
  95. package/dist/src/semantics/account_links.js +22 -0
  96. package/dist/src/semantics/accounts.d.ts +4 -0
  97. package/dist/src/semantics/accounts.js +40 -0
  98. package/dist/src/semantics/apps.d.ts +4 -0
  99. package/dist/src/semantics/{apps-secrets.js → apps.js} +14 -26
  100. package/dist/src/semantics/around.d.ts +2 -0
  101. package/dist/src/semantics/around.js +13 -0
  102. package/dist/src/semantics/balance.d.ts +2 -11
  103. package/dist/src/semantics/balance.js +3 -194
  104. package/dist/src/semantics/balance_transactions.d.ts +2 -0
  105. package/dist/src/semantics/balance_transactions.js +15 -0
  106. package/dist/src/semantics/billing_portal.d.ts +4 -0
  107. package/dist/src/semantics/billing_portal.js +36 -0
  108. package/dist/src/semantics/charges.d.ts +3 -28
  109. package/dist/src/semantics/charges.js +5 -202
  110. package/dist/src/semantics/checkout.d.ts +3 -20
  111. package/dist/src/semantics/checkout.js +21 -271
  112. package/dist/src/semantics/clock.d.ts +2 -0
  113. package/dist/src/semantics/clock.js +15 -0
  114. package/dist/src/semantics/coupons.d.ts +2 -6
  115. package/dist/src/semantics/coupons.js +2 -60
  116. package/dist/src/semantics/customers.d.ts +5 -6
  117. package/dist/src/semantics/customers.js +47 -413
  118. package/dist/src/semantics/doors.d.ts +23 -0
  119. package/dist/src/semantics/doors.js +73 -0
  120. package/dist/src/semantics/entitlements.d.ts +0 -2
  121. package/dist/src/semantics/entitlements.js +4 -95
  122. package/dist/src/semantics/events.d.ts +11 -0
  123. package/dist/src/semantics/events.js +31 -0
  124. package/dist/src/semantics/index.d.ts +2 -0
  125. package/dist/src/semantics/index.js +85 -0
  126. package/dist/src/semantics/invoice_payments.d.ts +2 -0
  127. package/dist/src/semantics/invoice_payments.js +12 -0
  128. package/dist/src/semantics/invoices.d.ts +11 -18
  129. package/dist/src/semantics/invoices.js +121 -440
  130. package/dist/src/semantics/issuing.d.ts +6 -13
  131. package/dist/src/semantics/issuing.js +58 -556
  132. package/dist/src/semantics/payment_intents.d.ts +3 -0
  133. package/dist/src/semantics/payment_intents.js +71 -0
  134. package/dist/src/semantics/payment_methods.d.ts +3 -0
  135. package/dist/src/semantics/payment_methods.js +15 -0
  136. package/dist/src/semantics/payouts.d.ts +3 -0
  137. package/dist/src/semantics/payouts.js +28 -0
  138. package/dist/src/semantics/prices.d.ts +4 -0
  139. package/dist/src/semantics/prices.js +37 -0
  140. package/dist/src/semantics/products.d.ts +4 -2
  141. package/dist/src/semantics/products.js +12 -138
  142. package/dist/src/semantics/promotion_codes.d.ts +3 -0
  143. package/dist/src/semantics/promotion_codes.js +35 -0
  144. package/dist/src/semantics/radar.d.ts +2 -2
  145. package/dist/src/semantics/radar.js +5 -74
  146. package/dist/src/semantics/refunds.d.ts +2 -9
  147. package/dist/src/semantics/refunds.js +3 -193
  148. package/dist/src/semantics/shared.d.ts +558 -55
  149. package/dist/src/semantics/shared.js +2070 -114
  150. package/dist/src/semantics/states.d.ts +462 -0
  151. package/dist/src/semantics/states.js +634 -0
  152. package/dist/src/semantics/subscriptions.d.ts +6 -11
  153. package/dist/src/semantics/subscriptions.js +37 -530
  154. package/dist/src/semantics/test_helpers.d.ts +3 -0
  155. package/dist/src/semantics/test_helpers.js +125 -0
  156. package/dist/src/semantics/transfers.d.ts +2 -2
  157. package/dist/src/semantics/transfers.js +6 -101
  158. package/dist/src/semantics/webhook_endpoints.d.ts +2 -0
  159. package/dist/src/semantics/webhook_endpoints.js +26 -0
  160. package/dist/src/server.d.ts +7 -0
  161. package/dist/src/server.js +7 -0
  162. package/generated/pack-facts.json +94 -0
  163. package/journeys/coverage.json +596 -0
  164. package/journeys/customer-life.json +6108 -0
  165. package/journeys/customer-life.outline.md +371 -0
  166. package/journeys/decisions.json +677 -0
  167. package/journeys/demand.json +706 -0
  168. package/journeys/score.json +853 -0
  169. package/journeys/unreachable.json +102 -0
  170. package/journeys/vendor-examples.json +8010 -0
  171. package/package.json +11 -20
  172. package/spec/SOURCE.md +18 -0
  173. package/spec/doc-examples.json +445 -0
  174. package/spec/fixtures3.json.gz +0 -0
  175. package/spec/openapi.json.gz +0 -0
  176. package/spec/patches.json +34 -0
  177. package/spec/sources.json +306 -0
  178. package/src/cli.ts +11 -28
  179. package/src/engine/after-payment.ts +29 -0
  180. package/src/engine/apps-secrets.ts +4 -0
  181. package/src/engine/balance.ts +32 -0
  182. package/src/engine/checkout.ts +39 -0
  183. package/src/engine/common.ts +49 -0
  184. package/src/engine/connect.ts +106 -0
  185. package/src/engine/customers.ts +10 -0
  186. package/src/engine/display.ts +18 -0
  187. package/src/engine/files.ts +28 -0
  188. package/src/engine/invoices.ts +102 -0
  189. package/src/engine/issuing.ts +66 -0
  190. package/src/engine/ledger.ts +48 -0
  191. package/src/engine/oauth.ts +18 -0
  192. package/src/engine/onboarding.ts +53 -0
  193. package/src/{stripe-params.ts → engine/params.ts} +7 -56
  194. package/src/engine/payment-intents.ts +32 -0
  195. package/src/engine/payment-methods.ts +24 -0
  196. package/src/engine/radar.ts +6 -0
  197. package/src/engine/refunds.ts +3 -0
  198. package/src/engine/renewals.ts +72 -0
  199. package/src/{stripe-twin.ts → engine/stripe.ts} +57 -400
  200. package/src/engine/subscriptions.ts +37 -0
  201. package/src/engine/transfers.ts +22 -0
  202. package/src/{stripe-version.ts → engine/version.ts} +19 -10
  203. package/src/engine/webhook-endpoints.ts +14 -0
  204. package/src/engine/webhooks.ts +70 -0
  205. package/src/fetch.ts +27 -0
  206. package/src/generated/surface.gen.json +1 -1
  207. package/src/generated/ui.gen.json +1 -1
  208. package/src/index.ts +10 -116
  209. package/src/manifest.ts +480 -904
  210. package/src/screens/{portal.tsx → billing-portal.tsx} +35 -42
  211. package/src/screens/checkout-js.ts +80 -0
  212. package/src/screens/checkout.tsx +32 -96
  213. package/src/screens/{onboarding.tsx → connect-onboarding.tsx} +39 -85
  214. package/src/screens/dashboard.tsx +178 -0
  215. package/src/screens/shared.tsx +84 -0
  216. package/src/screens/stripe-js.ts +102 -0
  217. package/src/semantics/account.ts +10 -0
  218. package/src/semantics/account_links.ts +20 -0
  219. package/src/semantics/accounts.ts +44 -0
  220. package/src/semantics/{apps-secrets.ts → apps.ts} +17 -33
  221. package/src/semantics/around.ts +17 -0
  222. package/src/semantics/balance.ts +6 -208
  223. package/src/semantics/balance_transactions.ts +18 -0
  224. package/src/semantics/billing_portal.ts +45 -0
  225. package/src/semantics/charges.ts +8 -212
  226. package/src/semantics/checkout.ts +25 -276
  227. package/src/semantics/clock.ts +19 -0
  228. package/src/semantics/coupons.ts +5 -68
  229. package/src/semantics/customers.ts +48 -414
  230. package/src/semantics/doors.ts +79 -0
  231. package/src/semantics/entitlements.ts +3 -94
  232. package/src/semantics/events.ts +37 -0
  233. package/src/semantics/index.ts +89 -0
  234. package/src/semantics/invoice_payments.ts +16 -0
  235. package/src/semantics/invoices.ts +112 -441
  236. package/src/semantics/issuing.ts +57 -573
  237. package/src/semantics/payment_intents.ts +76 -0
  238. package/src/semantics/payment_methods.ts +20 -0
  239. package/src/semantics/payouts.ts +29 -0
  240. package/src/semantics/prices.ts +41 -0
  241. package/src/semantics/products.ts +12 -146
  242. package/src/semantics/promotion_codes.ts +38 -0
  243. package/src/semantics/radar.ts +8 -79
  244. package/src/semantics/refunds.ts +4 -216
  245. package/src/semantics/shared.ts +2089 -135
  246. package/src/semantics/states.ts +662 -0
  247. package/src/semantics/subscriptions.ts +39 -542
  248. package/src/semantics/test_helpers.ts +119 -0
  249. package/src/semantics/transfers.ts +10 -132
  250. package/src/semantics/webhook_endpoints.ts +27 -0
  251. package/src/server.ts +7 -0
  252. package/client/dashboard-api.ts +0 -286
  253. package/client/stripe-mirror.css +0 -277
  254. package/client/stripe-mirror.tsx +0 -1559
  255. package/dist/client/dashboard-api.d.ts +0 -107
  256. package/dist/client/dashboard-api.js +0 -238
  257. package/dist/client/dashboard-api.ts +0 -286
  258. package/dist/client/stripe-mirror.bundle.js +0 -236
  259. package/dist/client/stripe-mirror.css +0 -277
  260. package/dist/client/stripe-mirror.d.ts +0 -134
  261. package/dist/client/stripe-mirror.js +0 -859
  262. package/dist/client/stripe-mirror.tsx +0 -1559
  263. package/dist/src/screens/connect-oauth.d.ts +0 -27
  264. package/dist/src/screens/connect-oauth.js +0 -414
  265. package/dist/src/screens/connect-settings.d.ts +0 -22
  266. package/dist/src/screens/connect-settings.js +0 -103
  267. package/dist/src/screens/consent-skin.d.ts +0 -4
  268. package/dist/src/screens/consent-skin.js +0 -18
  269. package/dist/src/screens/financial-connections.d.ts +0 -5
  270. package/dist/src/screens/financial-connections.js +0 -90
  271. package/dist/src/screens/identity.d.ts +0 -5
  272. package/dist/src/screens/identity.js +0 -86
  273. package/dist/src/screens/onboarding.d.ts +0 -13
  274. package/dist/src/screens/portal.d.ts +0 -5
  275. package/dist/src/screens/public-details.d.ts +0 -5
  276. package/dist/src/screens/public-details.js +0 -90
  277. package/dist/src/semantics/after-payment.d.ts +0 -22
  278. package/dist/src/semantics/after-payment.js +0 -99
  279. package/dist/src/semantics/apps-secrets.d.ts +0 -2
  280. package/dist/src/semantics/billing.d.ts +0 -2
  281. package/dist/src/semantics/billing.js +0 -220
  282. package/dist/src/semantics/connect.d.ts +0 -5
  283. package/dist/src/semantics/connect.js +0 -493
  284. package/dist/src/semantics/credit-notes.d.ts +0 -2
  285. package/dist/src/semantics/credit-notes.js +0 -172
  286. package/dist/src/semantics/disputes.d.ts +0 -2
  287. package/dist/src/semantics/disputes.js +0 -51
  288. package/dist/src/semantics/ephemeral-keys.d.ts +0 -2
  289. package/dist/src/semantics/ephemeral-keys.js +0 -34
  290. package/dist/src/semantics/files.d.ts +0 -2
  291. package/dist/src/semantics/files.js +0 -125
  292. package/dist/src/semantics/ledger.d.ts +0 -59
  293. package/dist/src/semantics/ledger.js +0 -200
  294. package/dist/src/semantics/payment-intents.d.ts +0 -18
  295. package/dist/src/semantics/payment-intents.js +0 -452
  296. package/dist/src/semantics/payment-links.d.ts +0 -2
  297. package/dist/src/semantics/payment-links.js +0 -133
  298. package/dist/src/semantics/payment-methods.d.ts +0 -20
  299. package/dist/src/semantics/payment-methods.js +0 -140
  300. package/dist/src/semantics/plans.d.ts +0 -5
  301. package/dist/src/semantics/plans.js +0 -121
  302. package/dist/src/semantics/platform.d.ts +0 -9
  303. package/dist/src/semantics/platform.js +0 -206
  304. package/dist/src/semantics/renewals.d.ts +0 -47
  305. package/dist/src/semantics/renewals.js +0 -281
  306. package/dist/src/semantics/setup-intents.d.ts +0 -2
  307. package/dist/src/semantics/setup-intents.js +0 -84
  308. package/dist/src/semantics/subscription-schedules.d.ts +0 -2
  309. package/dist/src/semantics/subscription-schedules.js +0 -119
  310. package/dist/src/semantics/tax.d.ts +0 -2
  311. package/dist/src/semantics/tax.js +0 -197
  312. package/dist/src/semantics/terminal.d.ts +0 -5
  313. package/dist/src/semantics/terminal.js +0 -182
  314. package/dist/src/semantics/test-clocks.d.ts +0 -6
  315. package/dist/src/semantics/test-clocks.js +0 -73
  316. package/dist/src/semantics/tokens.d.ts +0 -4
  317. package/dist/src/semantics/tokens.js +0 -44
  318. package/dist/src/semantics/treasury.d.ts +0 -2
  319. package/dist/src/semantics/treasury.js +0 -377
  320. package/dist/src/semantics/webhook-endpoints.d.ts +0 -3
  321. package/dist/src/semantics/webhook-endpoints.js +0 -85
  322. package/dist/src/stripe-budget.d.ts +0 -55
  323. package/dist/src/stripe-budget.js +0 -155
  324. package/dist/src/stripe-capabilities.d.ts +0 -3
  325. package/dist/src/stripe-capabilities.js +0 -5836
  326. package/dist/src/stripe-conformance.d.ts +0 -43
  327. package/dist/src/stripe-conformance.js +0 -105
  328. package/dist/src/stripe-connector.d.ts +0 -161
  329. package/dist/src/stripe-connector.js +0 -414
  330. package/dist/src/stripe-emit.d.ts +0 -2
  331. package/dist/src/stripe-emit.js +0 -145
  332. package/dist/src/stripe-events.d.ts +0 -93
  333. package/dist/src/stripe-events.js +0 -392
  334. package/dist/src/stripe-js.d.ts +0 -4
  335. package/dist/src/stripe-js.js +0 -70
  336. package/dist/src/stripe-mirror-ui.d.ts +0 -15
  337. package/dist/src/stripe-mirror-ui.js +0 -87
  338. package/dist/src/stripe-perform-harness.d.ts +0 -9
  339. package/dist/src/stripe-perform-harness.js +0 -26
  340. package/dist/src/stripe-server.d.ts +0 -33
  341. package/dist/src/stripe-server.js +0 -429
  342. package/dist/src/stripe-shared.d.ts +0 -109
  343. package/dist/src/stripe-shared.js +0 -276
  344. package/dist/src/stripe-ui-conformance.d.ts +0 -5
  345. package/dist/src/stripe-ui-conformance.js +0 -79
  346. package/dist/src/stripe-ui-structure.d.ts +0 -3
  347. package/dist/src/stripe-ui-structure.js +0 -168
  348. package/dist/test-fixtures/stripe-known-deviations.json +0 -110
  349. package/dist/test-fixtures/stripe-openapi-operations.SOURCE.md +0 -14
  350. package/dist/test-fixtures/stripe-openapi-operations.json +0 -4717
  351. package/dist/test-fixtures/stripe-schemas.SOURCE.md +0 -35
  352. package/dist/test-fixtures/stripe-schemas.json +0 -3813
  353. package/src/screens/connect-oauth.tsx +0 -400
  354. package/src/screens/connect-settings.tsx +0 -121
  355. package/src/screens/consent-skin.ts +0 -20
  356. package/src/screens/financial-connections.tsx +0 -101
  357. package/src/screens/identity.tsx +0 -96
  358. package/src/screens/public-details.tsx +0 -105
  359. package/src/semantics/after-payment.ts +0 -118
  360. package/src/semantics/billing.ts +0 -216
  361. package/src/semantics/connect.ts +0 -487
  362. package/src/semantics/credit-notes.ts +0 -168
  363. package/src/semantics/disputes.ts +0 -62
  364. package/src/semantics/ephemeral-keys.ts +0 -34
  365. package/src/semantics/files.ts +0 -143
  366. package/src/semantics/ledger.ts +0 -253
  367. package/src/semantics/payment-intents.ts +0 -463
  368. package/src/semantics/payment-links.ts +0 -148
  369. package/src/semantics/payment-methods.ts +0 -145
  370. package/src/semantics/plans.ts +0 -131
  371. package/src/semantics/platform.ts +0 -220
  372. package/src/semantics/renewals.ts +0 -279
  373. package/src/semantics/setup-intents.ts +0 -87
  374. package/src/semantics/subscription-schedules.ts +0 -129
  375. package/src/semantics/tax.ts +0 -220
  376. package/src/semantics/terminal.ts +0 -195
  377. package/src/semantics/test-clocks.ts +0 -77
  378. package/src/semantics/tokens.ts +0 -52
  379. package/src/semantics/treasury.ts +0 -383
  380. package/src/semantics/webhook-endpoints.ts +0 -87
  381. package/src/stripe-budget.ts +0 -181
  382. package/src/stripe-capabilities.ts +0 -5651
  383. package/src/stripe-conformance.ts +0 -124
  384. package/src/stripe-connector.ts +0 -462
  385. package/src/stripe-emit.ts +0 -157
  386. package/src/stripe-events.ts +0 -434
  387. package/src/stripe-js.ts +0 -70
  388. package/src/stripe-mirror-ui.ts +0 -90
  389. package/src/stripe-perform-harness.ts +0 -29
  390. package/src/stripe-server.ts +0 -393
  391. package/src/stripe-shared.ts +0 -297
  392. package/src/stripe-ui-conformance.ts +0 -88
  393. package/src/stripe-ui-structure.ts +0 -182
  394. package/test-fixtures/stripe-known-deviations.json +0 -110
  395. package/test-fixtures/stripe-openapi-operations.json +0 -4717
  396. package/test-fixtures/stripe-schemas.json +0 -3813
  397. /package/dist/src/{screens → engine}/industries.d.ts +0 -0
  398. /package/dist/src/{screens → engine}/industries.js +0 -0
  399. /package/dist/src/{semantics → engine}/test-cards.d.ts +0 -0
  400. /package/dist/src/{semantics → engine}/test-cards.js +0 -0
  401. /package/src/{screens → engine}/industries.ts +0 -0
  402. /package/src/{semantics → engine}/test-cards.ts +0 -0
@@ -0,0 +1,306 @@
1
+ {
2
+ "archive:https://registry.npmjs.org/@stripe/stripe-js/-/stripe-js-8.6.0.tgz#sha256=13e61419e9076ab440cc636e34d3ea5df3fc62bbf2d6a80d3fd718e8cd47f0a2!/package/dist/stripe-js/checkout.d.ts": {
3
+ "status": 200,
4
+ "checked": "2026-10-03",
5
+ "sha256": "13e61419e9076ab440cc636e34d3ea5df3fc62bbf2d6a80d3fd718e8cd47f0a2",
6
+ "quotes": {
7
+ "export interface StripeCheckoutSession": true,
8
+ "loadActions: () => Promise<StripeCheckoutLoadActionsResult>": true
9
+ }
10
+ },
11
+ "https://docs.stripe.com/api/authentication": {
12
+ "status": 200,
13
+ "checked": "2026-09-30",
14
+ "quotes": {
15
+ "API requests without authentication also fail.": true
16
+ }
17
+ },
18
+ "https://docs.stripe.com/api/balance_transactions/object#balance_transaction_object-status": {
19
+ "status": 200,
20
+ "checked": "2026-09-30"
21
+ },
22
+ "https://docs.stripe.com/api/billing/meter/create": {
23
+ "status": 200,
24
+ "checked": "2026-10-03",
25
+ "quotes": {
26
+ "stripe_customer_id": true
27
+ }
28
+ },
29
+ "https://docs.stripe.com/api/charges/object#charge_object-refunded": {
30
+ "status": 200,
31
+ "checked": "2026-10-03"
32
+ },
33
+ "https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-payment_status": {
34
+ "status": 200,
35
+ "checked": "2026-09-30"
36
+ },
37
+ "https://docs.stripe.com/api/checkout/sessions/object#checkout_session_object-status": {
38
+ "status": 200,
39
+ "checked": "2026-09-30"
40
+ },
41
+ "https://docs.stripe.com/api/invoices/create_preview.md?query=subscription_details": {
42
+ "status": 200,
43
+ "checked": "2026-10-04",
44
+ "quotes": {
45
+ "The default value is": true,
46
+ "forces the proration to be calculated as though the update was done at the specified time.": true,
47
+ "The time given must be within the current subscription period": true,
48
+ "cannot be set to": true,
49
+ "Disable creating prorations in this request.": true,
50
+ "Always invoice immediately for prorations.": true
51
+ }
52
+ },
53
+ "https://docs.stripe.com/api/invoices/pay": {
54
+ "status": 200,
55
+ "checked": "2026-09-30"
56
+ },
57
+ "https://docs.stripe.com/api/invoices/void": {
58
+ "status": 200,
59
+ "checked": "2026-09-30"
60
+ },
61
+ "https://docs.stripe.com/api/issuing/authorizations/decline": {
62
+ "status": 200,
63
+ "checked": "2026-09-30"
64
+ },
65
+ "https://docs.stripe.com/api/issuing/authorizations/test_mode_capture": {
66
+ "status": 200,
67
+ "checked": "2026-09-30"
68
+ },
69
+ "https://docs.stripe.com/api/issuing/cards/create": {
70
+ "status": 200,
71
+ "checked": "2026-10-03",
72
+ "quotes": {
73
+ "Whether authorizations can be approved on this card. May be blocked from activating cards depending on past-due Cardholder requirements. Defaults to inactive.": true,
74
+ "Defaults to inactive": true
75
+ }
76
+ },
77
+ "https://docs.stripe.com/api/issuing/cards/update": {
78
+ "status": 200,
79
+ "checked": "2026-09-30"
80
+ },
81
+ "https://docs.stripe.com/api/payment_intents/cancel": {
82
+ "status": 200,
83
+ "checked": "2026-10-03"
84
+ },
85
+ "https://docs.stripe.com/api/payment_intents/confirm": {
86
+ "status": 200,
87
+ "checked": "2026-09-30"
88
+ },
89
+ "https://docs.stripe.com/api/plans/create": {
90
+ "status": 200,
91
+ "checked": "2026-10-03",
92
+ "quotes": {
93
+ "It replaces the Plans API and is backwards compatible to simplify your migration.": true
94
+ }
95
+ },
96
+ "https://docs.stripe.com/api/promotion_codes/update": {
97
+ "status": 200,
98
+ "checked": "2026-09-30"
99
+ },
100
+ "https://docs.stripe.com/api/subscriptions/cancel": {
101
+ "status": 200,
102
+ "checked": "2026-09-30"
103
+ },
104
+ "https://docs.stripe.com/api/subscriptions/object": {
105
+ "status": 200,
106
+ "checked": "2026-10-03",
107
+ "quotes": {
108
+ "subscription_items?subscription=": true
109
+ }
110
+ },
111
+ "https://docs.stripe.com/api/subscriptions/update#update_subscription-trial_end": {
112
+ "status": 200,
113
+ "checked": "2026-09-30"
114
+ },
115
+ "https://docs.stripe.com/billing/customer/balance": {
116
+ "status": 200,
117
+ "checked": "2026-10-03",
118
+ "quotes": {
119
+ "Represents the starting value of the customer invoice balance when a customer is created using the API with a non-zero invoice balance.": true,
120
+ "All modifications to the invoice balance are recorded as Transactions": true,
121
+ "All Transactions created with the API or in the Dashboard have a type value of adjustment": true
122
+ }
123
+ },
124
+ "https://docs.stripe.com/billing/subscriptions/build-subscriptions": {
125
+ "status": 200,
126
+ "checked": "2026-09-30"
127
+ },
128
+ "https://docs.stripe.com/billing/subscriptions/cancel#cancel-at-end-of-cycle": {
129
+ "status": 200,
130
+ "checked": "2026-09-30"
131
+ },
132
+ "https://docs.stripe.com/billing/subscriptions/overview#payment-status": {
133
+ "status": 200,
134
+ "checked": "2026-09-30"
135
+ },
136
+ "https://docs.stripe.com/billing/subscriptions/prorations": {
137
+ "status": 200,
138
+ "checked": "2026-10-04",
139
+ "quotes": {
140
+ "Unused time on original 10 USD plan (credit)": true,
141
+ "Remaining time on new 20 USD plan (debit)": true,
142
+ "The current billing period’s start and end times are used to calculate the cost of the subscription before and after the change.": true,
143
+ "By default, Stripe calculates prorations down to the second.": true,
144
+ "When calculating proration credits or debits, Stripe uses the subscription’s discounted price, not the original price.": true,
145
+ "The prorated amount is calculated as soon as the API updates the subscription.": true,
146
+ "creates a non-proration debit, even when the debit covers a partial billing period.": true,
147
+ "no additional discounts are applied to the proration line items themselves": true
148
+ }
149
+ },
150
+ "https://docs.stripe.com/billing/subscriptions/trials": {
151
+ "status": 200,
152
+ "checked": "2026-09-30"
153
+ },
154
+ "https://docs.stripe.com/billing/subscriptions/trials/free-trials#adding-a-new-trial-to-a-subscription-previously-in-a-trial": {
155
+ "status": 200,
156
+ "checked": "2026-09-30"
157
+ },
158
+ "https://docs.stripe.com/billing/subscriptions/upgrade-downgrade#immediate-payment": {
159
+ "status": 200,
160
+ "checked": "2026-09-30"
161
+ },
162
+ "https://docs.stripe.com/changelog/clover/2025-09-30/polymorphic-coupon": {
163
+ "status": 200,
164
+ "checked": "2026-10-03",
165
+ "quotes": {
166
+ "Moves the top-level coupon field on Promotion Codes to promotion.coupon": true,
167
+ "When you retrieve Promotion Codes, they don’t auto-expand the promotion.coupon field": true
168
+ }
169
+ },
170
+ "https://docs.stripe.com/connect/account-capabilities": {
171
+ "status": 200,
172
+ "checked": "2026-10-03",
173
+ "quotes": {
174
+ "If a connected account has both card_payments and transfers": true
175
+ }
176
+ },
177
+ "https://docs.stripe.com/connect/authentication": {
178
+ "status": 200,
179
+ "checked": "2026-10-03",
180
+ "quotes": {
181
+ "Stripe-Account header": true
182
+ }
183
+ },
184
+ "https://docs.stripe.com/connect/destination-charges#issue-refunds": {
185
+ "status": 200,
186
+ "checked": "2026-10-03"
187
+ },
188
+ "https://docs.stripe.com/customer-management": {
189
+ "status": 200,
190
+ "checked": "2026-09-30"
191
+ },
192
+ "https://docs.stripe.com/invoicing/integration": {
193
+ "status": 200,
194
+ "checked": "2026-10-02",
195
+ "quotes": {
196
+ "To finalize a draft invoice, use the Dashboard, send it to the customer, or pay it.": true
197
+ }
198
+ },
199
+ "https://docs.stripe.com/invoicing/integration/workflow-transitions#finalized": {
200
+ "status": 200,
201
+ "checked": "2026-09-30"
202
+ },
203
+ "https://docs.stripe.com/issuing/cards/physical/create-design.md?testing-method=with-code": {
204
+ "status": 200,
205
+ "checked": "2026-09-30",
206
+ "quotes": {
207
+ "Use the [Files API](https://docs.stripe.com/api/files/create.md) to upload a .PNG file of your card logo, and specify the purpose as `issuing_logo`.": true
208
+ }
209
+ },
210
+ "https://docs.stripe.com/issuing/controls/real-time-authorizations": {
211
+ "status": 200,
212
+ "checked": "2026-09-30"
213
+ },
214
+ "https://docs.stripe.com/issuing/purchases/authorizations": {
215
+ "status": 200,
216
+ "checked": "2026-09-30"
217
+ },
218
+ "https://docs.stripe.com/issuing/testing": {
219
+ "status": 200,
220
+ "checked": "2026-10-03",
221
+ "quotes": {
222
+ "Before you create test transactions, you must add test funds to the Issuing balance on your account.": true,
223
+ "You can create test top-ups in the Dashboard, or with the Top-ups API": true
224
+ }
225
+ },
226
+ "https://docs.stripe.com/keys": {
227
+ "status": 200,
228
+ "checked": "2026-09-30",
229
+ "quotes": {
230
+ "Publishable keys": true
231
+ }
232
+ },
233
+ "https://docs.stripe.com/payments/ach-direct-debit/accept-a-payment?payment-ui=direct-api": {
234
+ "status": 200,
235
+ "checked": "2026-09-30"
236
+ },
237
+ "https://docs.stripe.com/payments/checkout/how-checkout-works": {
238
+ "status": 200,
239
+ "checked": "2026-09-30"
240
+ },
241
+ "https://docs.stripe.com/payments/paymentintents/lifecycle": {
242
+ "status": 200,
243
+ "checked": "2026-09-30"
244
+ },
245
+ "https://docs.stripe.com/payouts": {
246
+ "status": 200,
247
+ "checked": "2026-10-03",
248
+ "quotes": {
249
+ "paid": true
250
+ }
251
+ },
252
+ "https://docs.stripe.com/payouts#payout-statuses": {
253
+ "status": 200,
254
+ "checked": "2026-09-30"
255
+ },
256
+ "https://docs.stripe.com/radar/lists": {
257
+ "status": 200,
258
+ "checked": "2026-10-03",
259
+ "quotes": {
260
+ "Use the Dashboard or the API to create lists.": true,
261
+ "Enter a name for the list": true,
262
+ "Select the type of list to create.": true,
263
+ "Click Add to save your new list.": true
264
+ }
265
+ },
266
+ "https://docs.stripe.com/rate-limits": {
267
+ "status": 200,
268
+ "checked": "2026-10-01",
269
+ "quotes": {
270
+ "25 requests per second": true
271
+ }
272
+ },
273
+ "https://docs.stripe.com/refunds": {
274
+ "status": 200,
275
+ "checked": "2026-09-30"
276
+ },
277
+ "https://docs.stripe.com/search": {
278
+ "status": 200,
279
+ "checked": "2026-10-03",
280
+ "quotes": {
281
+ "Substring match operator (substrings must be a minimum of 3 characters)": true
282
+ }
283
+ },
284
+ "https://docs.stripe.com/testing": {
285
+ "status": 200,
286
+ "checked": "2026-10-02",
287
+ "quotes": {
288
+ "Generic decline 4000 0000 0000 0002": true,
289
+ "This card requires authentication on all transactions, regardless of how the card is set up.": true
290
+ }
291
+ },
292
+ "https://docs.stripe.com/webhooks": {
293
+ "status": 200,
294
+ "checked": "2026-09-30",
295
+ "quotes": {
296
+ "register a webhook endpoint, Stripe pushes real-time data to it when": true
297
+ }
298
+ },
299
+ "https://github.com/stripe/stripe-mock/issues/31": {
300
+ "status": 200,
301
+ "checked": "2026-10-03",
302
+ "quotes": {
303
+ "Unrecognized request URL (GET: /v1/test).": true
304
+ }
305
+ }
306
+ }
package/dist/src/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
- #!/usr/bin/env node
2
1
  export {};
package/dist/src/cli.js CHANGED
@@ -1,39 +1,19 @@
1
- #!/usr/bin/env node
2
- import { keepProcessAlive } from '@volter/world-core/lifecycle';
3
- // world-stripe CLI: serve the Stripe API twin, the mirror UI, or run conformance.
4
1
  import { hasFlag, optionValue } from '@volter/world-core/args';
5
- import { createStripeTwinServer } from "./stripe-server.js";
6
- import { createStripeMirrorServer } from "./stripe-mirror-ui.js";
2
+ import { keepProcessAlive } from '@volter/world-core/lifecycle';
3
+ import { createStripeTwinServer } from "./server.js";
7
4
  const [cmd, ...rest] = process.argv.slice(2);
8
5
  const port = Number(optionValue(rest, '--port', '0')) || undefined;
9
6
  const root = optionValue(rest, '--root') || undefined;
10
- const readOnly = hasFlag(rest, '--read-only'); // a twin accepts writes unless started read-only
11
- if (cmd === 'serve') {
12
- const s = await createStripeTwinServer({ readOnly, ...(root ? { root } : {}), ...(port ? { port } : {}) });
13
- process.stdout.write(`stripe twin (spec-correct API)${readOnly ? ' [read-only]' : ''} at http://127.0.0.1:${s.port}\n`);
14
- await keepProcessAlive();
15
- }
16
- else if (cmd === 'mirror') {
17
- const s = await createStripeMirrorServer({ ...(root ? { root } : {}), ...(port ? { port } : {}) });
18
- process.stdout.write(`stripe mirror UI (dashboard) at http://127.0.0.1:${s.port}\n`);
7
+ const readOnly = hasFlag(rest, '--read-only');
8
+ // the World's managed Postgres, which the runtime binds a pack declaring managedDatabase to
9
+ const database = optionValue(rest, '--database') || undefined;
10
+ // the World's scenario file, for a model vendor's turns
11
+ const scenarioPath = optionValue(rest, '--scenario') || undefined;
12
+ if (cmd === 'serve' || cmd === undefined) {
13
+ const s = await createStripeTwinServer({ readOnly, ...(root ? { root } : {}), ...(port ? { port } : {}), ...(database ? { database } : {}), ...(scenarioPath ? { scenarioPath } : {}) });
14
+ process.stdout.write(`stripe twin${readOnly ? ' [read-only]' : ''} at http://127.0.0.1:${s.port}\n`);
19
15
  await keepProcessAlive();
20
16
  }
21
- else if (cmd === 'emit') {
22
- // DELIVER: fire a signed, vendor-shaped event synthesized from twin state at the app's
23
- // registered webhook endpoint(s). `emit --list` shows what's emittable right now.
24
- const { runEmitCli } = await import('@volter/world-core');
25
- const { stripeEmitter } = await import("./stripe-emit.js");
26
- process.exit(await runEmitCli(stripeEmitter, rest));
27
- }
28
- else if (cmd === 'conformance') {
29
- // dev-only; lazy so the bin runs without @volter/world-tooling
30
- const { checkStripeConformance, loadStripeKnownDeviations, loadStripeSchemas, stripeCoverage } = await import("./stripe-conformance.js");
31
- const [schemas, known] = await Promise.all([loadStripeSchemas(), loadStripeKnownDeviations()]);
32
- const report = checkStripeConformance(schemas, { ...(root ? { root } : {}), known });
33
- process.stdout.write(`${JSON.stringify({ ...report, coverage: stripeCoverage(schemas, { ...(root ? { root } : {}) }) }, null, 2)}\n`);
34
- if (!report.ok)
35
- process.exitCode = 1;
36
- }
37
17
  else {
38
- process.stdout.write('Usage: world-stripe serve|mirror|emit|conformance [--port N] [--root DIR] [--read-only]\n world-stripe emit --list [--root DIR] | emit <event.type> <subject-id> [--root DIR] [--endpoint URL|we_id] [--json]\n');
18
+ process.stdout.write('Usage: world-stripe serve [--port N] [--root DIR] [--read-only] [--database URL] [--scenario FILE]\n');
39
19
  }
@@ -0,0 +1,8 @@
1
+ export type Outcome = 'dispute' | 'dispute_not_received' | 'inquiry' | 'review' | 'available';
2
+ /** The test cards whose success Stripe follows with its own act, by number and by their documented test names. */
3
+ export declare const AFTER_SUCCESS_CARDS: Record<string, {
4
+ brand: string;
5
+ number: string;
6
+ outcome: Outcome;
7
+ }>;
8
+ export declare const BY_NUMBER: Record<string, Outcome>;
@@ -0,0 +1,27 @@
1
+ // What Stripe does itself once a payment succeeds, which no API call asks for:
2
+ // - a test card that is disputed opens a dispute on its charge (docs.stripe.com/testing#disputes: 4000000000000259
3
+ // "charge succeeds, then disputed as fraudulent", 4000000000002685 disputed as product not received,
4
+ // 4000000000001976 an inquiry), and Stripe debits the disputed
5
+ // amount and its dispute fee from the balance (docs.stripe.com/disputes/how-disputes-work);
6
+ // - a test card Radar scores as elevated risk opens a review of its charge (docs.stripe.com/testing#fraud-prevention:
7
+ // 4000000000009235, "elevated risk", which Radar places in review; docs.stripe.com/radar/reviews);
8
+ // - a charge a platform makes with `application_fee_amount` earns the platform an application fee, from the connected
9
+ // account it pays (a destination charge's `transfer_data.destination`, or the account a direct charge is made on;
10
+ // docs.stripe.com/connect/destination-charges, docs.stripe.com/connect/direct-charges);
11
+ // - a bank account verified by micro-deposits for a payment or a setup carries a mandate, the customer's acceptance
12
+ // of debits (docs.stripe.com/payments/ach-direct-debit/accept-a-payment, docs.stripe.com/api/mandates).
13
+ //
14
+ // Where the documentation stops and the twin decides: evidence is due seven days after a dispute opens (Stripe's
15
+ // deadline depends on the card network); the dispute fee is 1500 cents in any currency (Stripe's US fee is $15); an
16
+ // elevated-risk review's risk score is 67 (Radar's elevated band); the application is `ca_twin`.
17
+ import { BYPASS_PENDING_CARDS } from "./test-cards.js";
18
+ /** The test cards whose success Stripe follows with its own act, by number and by their documented test names. */
19
+ export const AFTER_SUCCESS_CARDS = {
20
+ pm_card_createDispute: { brand: 'visa', number: '4000000000000259', outcome: 'dispute' },
21
+ pm_card_createDisputeProductNotReceived: { brand: 'visa', number: '4000000000002685', outcome: 'dispute_not_received' },
22
+ pm_card_createDisputeInquiry: { brand: 'visa', number: '4000000000001976', outcome: 'inquiry' },
23
+ pm_card_riskLevelElevated: { brand: 'visa', number: '4000000000009235', outcome: 'review' },
24
+ // its funds go straight to the available balance (ledger.ts reads it; no act follows here)
25
+ ...Object.fromEntries(Object.entries(BYPASS_PENDING_CARDS).map(([name, c]) => [name, { ...c, outcome: 'available' }])),
26
+ };
27
+ export const BY_NUMBER = Object.fromEntries(Object.values(AFTER_SUCCESS_CARDS).map((c) => [c.number, c.outcome]));
@@ -0,0 +1 @@
1
+ export declare const SECRET = "apps.secret";
@@ -0,0 +1,3 @@
1
+ // Apps secret-store semantics: a secret is named within a scope (the account, or one user); setting
2
+ // the same name in the same scope overwrites it. The scope is kept as a bookkeeping key.
3
+ export const SECRET = 'apps.secret';
@@ -0,0 +1,5 @@
1
+ import type { Row } from './common.js';
2
+ export declare const DAY = 86400;
3
+ export declare const DAYS: string[];
4
+ /** The first scheduled payout time on or after `from`: midnight UTC of a day the schedule pays out on. */
5
+ export declare function payoutDay(from: number, schedule: Row): number;
@@ -0,0 +1,15 @@
1
+ export const DAY = 86_400;
2
+ export const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
3
+ /** The first scheduled payout time on or after `from`: midnight UTC of a day the schedule pays out on. */
4
+ export function payoutDay(from, schedule) {
5
+ const first = Math.ceil(from / DAY) * DAY;
6
+ const pays = (day) => {
7
+ const d = new Date(day * 1000);
8
+ if (schedule.interval === 'weekly')
9
+ return DAYS[d.getUTCDay()] === String(schedule.weekly_anchor ?? 'monday');
10
+ if (schedule.interval === 'monthly')
11
+ return d.getUTCDate() === Math.min(Number(schedule.monthly_anchor ?? 1), new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth() + 1, 0)).getUTCDate());
12
+ return true;
13
+ };
14
+ return Array.from({ length: 62 }, (_, i) => first + i * DAY).find(pays) ?? first;
15
+ }
@@ -0,0 +1,24 @@
1
+ import type { Row } from './common.js';
2
+ export declare const CS = "checkout.session";
3
+ /** The payment method types a session takes: the list a caller pinned to an earlier version gives as
4
+ * payment_method_types ("A list of the types of payment methods (e.g., `card`) this Checkout Session can accept", the
5
+ * parameter the served version's allowed_payment_method_types is described against: "Unlike `payment_method_types`,
6
+ * this acts as a filter on the dynamically computed set of eligible payment methods", docs.stripe.com/api/checkout/
7
+ * sessions/create), else the allowed_payment_method_types of the served one, else card. Where the documentation stops
8
+ * and the twin decides: an allowed list is answered whole (the twin does not compute eligibility), and without one the
9
+ * session takes card (the account's enabled methods are not modelled). */
10
+ export declare function sessionMethodTypes(params: Row): string[];
11
+ /** Metadata passed on to what a session makes (payment_intent_data[metadata], subscription_data[metadata]) as a
12
+ * create's own is kept: "Individual keys can be unset by posting an empty value to them. All keys can be unset by
13
+ * posting an empty value to `metadata`" (every metadata parameter, docs.stripe.com/api/metadata), so a key posted
14
+ * empty is not set, and metadata posted empty is {} (./front.ts createMetadata, the top-level case). */
15
+ export declare function nestedMetadata(given: unknown): Row | undefined;
16
+ /** The card the customer entered on the page. */
17
+ export type EnteredCard = {
18
+ number: string;
19
+ exp_month: number;
20
+ exp_year: number;
21
+ };
22
+ /** A line item of a one-time Price: a stored Price, or an inline `price_data`, without `recurring` ("Line items with
23
+ * one-time Prices will be on the initial invoice only", docs.stripe.com/api/checkout/sessions/create). */
24
+ export declare function isOneTime(item: Row, priceData?: Row | null): boolean;
@@ -0,0 +1,30 @@
1
+ export const CS = 'checkout.session';
2
+ /** The payment method types a session takes: the list a caller pinned to an earlier version gives as
3
+ * payment_method_types ("A list of the types of payment methods (e.g., `card`) this Checkout Session can accept", the
4
+ * parameter the served version's allowed_payment_method_types is described against: "Unlike `payment_method_types`,
5
+ * this acts as a filter on the dynamically computed set of eligible payment methods", docs.stripe.com/api/checkout/
6
+ * sessions/create), else the allowed_payment_method_types of the served one, else card. Where the documentation stops
7
+ * and the twin decides: an allowed list is answered whole (the twin does not compute eligibility), and without one the
8
+ * session takes card (the account's enabled methods are not modelled). */
9
+ export function sessionMethodTypes(params) {
10
+ const given = Array.isArray(params.payment_method_types) ? params.payment_method_types : params.allowed_payment_method_types;
11
+ return Array.isArray(given) && given.length ? given.map(String) : ['card'];
12
+ }
13
+ /** Metadata passed on to what a session makes (payment_intent_data[metadata], subscription_data[metadata]) as a
14
+ * create's own is kept: "Individual keys can be unset by posting an empty value to them. All keys can be unset by
15
+ * posting an empty value to `metadata`" (every metadata parameter, docs.stripe.com/api/metadata), so a key posted
16
+ * empty is not set, and metadata posted empty is {} (./front.ts createMetadata, the top-level case). */
17
+ export function nestedMetadata(given) {
18
+ if (given === '')
19
+ return {};
20
+ if (!given || typeof given !== 'object' || Array.isArray(given))
21
+ return undefined;
22
+ return Object.fromEntries(Object.entries(given).filter(([, v]) => v !== ''));
23
+ }
24
+ /** A line item of a one-time Price: a stored Price, or an inline `price_data`, without `recurring` ("Line items with
25
+ * one-time Prices will be on the initial invoice only", docs.stripe.com/api/checkout/sessions/create). */
26
+ export function isOneTime(item, priceData) {
27
+ if (priceData)
28
+ return !priceData.recurring;
29
+ return !!item.price && typeof item.price === 'object' && !item.price.recurring;
30
+ }
@@ -0,0 +1,19 @@
1
+ export type Row = Record<string, unknown>;
2
+ /** Keep the rows whose field equals the request's parameter of the same name, for each name given. */
3
+ /** A list's range filter on a unix time (`created[gte]=…&created[lt]=…`, or one exact time). */
4
+ export declare function inRange(t: unknown, v: unknown): boolean;
5
+ export declare const SPEC_FIELDS: Map<string, Set<string>>;
6
+ /** A stored subject of any stored type, tombstones included, in the pack's view: what the pack's
7
+ * shared helpers look a price, a payment method or a card up by, read from the context's tree. */
8
+ export type Find = (storedType: string, id: string) => Row | undefined;
9
+ /** An account's external_accounts, "External accounts (bank accounts and debit cards) currently attached to this
10
+ * account" (docs.stripe.com/api/accounts/object), as the list its example answers. */
11
+ export declare const externalList: (account: string, data: Row[]) => Row;
12
+ /** A removed discount as Stripe answers it: the discount, marked deleted (docs.stripe.com/api/discounts/delete). */
13
+ export declare function deletedDiscount(d: Row, now: unknown): Row;
14
+ /** A refund's destination_details for a card charge: "If this is a `card` refund, this hash contains the transaction
15
+ * specific details" and its `type` "can be `refund`, `reversal`, or `pending`" — a reversal, where "The original charge
16
+ * will drop off the bank statement altogether", for an authorization released uncaptured, else a refund, "a credit entry
17
+ * on the bank statement" (docs.stripe.com/api/refunds/object). The network's reference number the twin never has. A
18
+ * charge not paid by card answers none. */
19
+ export declare function refundDestination(charge: Row, type: 'refund' | 'reversal'): Row;
@@ -0,0 +1,34 @@
1
+ // Stripe's shared computation over rows already read: the fields each object's spec gives, a row as Stripe answers it,
2
+ // and the list and refund shapes (the handlers' shared behaviour is ../semantics/shared.ts).
3
+ import surface from '../generated/surface.gen.json' with { type: 'json' };
4
+ /** Keep the rows whose field equals the request's parameter of the same name, for each name given. */
5
+ /** A list's range filter on a unix time (`created[gte]=…&created[lt]=…`, or one exact time). */
6
+ export function inRange(t, v) {
7
+ const at = Number(t);
8
+ const r = (v && typeof v === 'object' ? v : { gte: v, lte: v });
9
+ return (r.gt === undefined || at > Number(r.gt)) && (r.gte === undefined || at >= Number(r.gte)) && (r.lt === undefined || at < Number(r.lt)) && (r.lte === undefined || at <= Number(r.lte));
10
+ }
11
+ export const SPEC_FIELDS = new Map(surface.resources.map((r) => [r.name, new Set(r.fields.map((f) => f.name))]));
12
+ /** An account's external_accounts, "External accounts (bank accounts and debit cards) currently attached to this
13
+ * account" (docs.stripe.com/api/accounts/object), as the list its example answers. */
14
+ export const externalList = (account, data) => ({ object: 'list', data, has_more: false, total_count: data.length, url: `/v1/accounts/${account}/external_accounts` });
15
+ /** A removed discount as Stripe answers it: the discount, marked deleted (docs.stripe.com/api/discounts/delete). */
16
+ export function deletedDiscount(d, now) {
17
+ const coupon = d.coupon && typeof d.coupon === 'object' ? String(d.coupon.id) : typeof d.coupon === 'string' ? d.coupon : null;
18
+ return {
19
+ id: d.id ?? `di_${coupon ?? 'twin'}`, object: 'discount', deleted: true, checkout_session: d.checkout_session ?? null, customer: d.customer ?? null,
20
+ invoice: d.invoice ?? null, invoice_item: d.invoice_item ?? null, promotion_code: d.promotion_code ?? null, subscription: d.subscription ?? null,
21
+ subscription_item: d.subscription_item ?? null, source: d.source ?? { type: 'coupon', coupon }, start: d.start ?? now,
22
+ };
23
+ }
24
+ /** A refund's destination_details for a card charge: "If this is a `card` refund, this hash contains the transaction
25
+ * specific details" and its `type` "can be `refund`, `reversal`, or `pending`" — a reversal, where "The original charge
26
+ * will drop off the bank statement altogether", for an authorization released uncaptured, else a refund, "a credit entry
27
+ * on the bank statement" (docs.stripe.com/api/refunds/object). The network's reference number the twin never has. A
28
+ * charge not paid by card answers none. */
29
+ export function refundDestination(charge, type) {
30
+ const pmd = charge.payment_method_details;
31
+ if (pmd && pmd.type !== 'card')
32
+ return {};
33
+ return { destination_details: { type: 'card', card: { reference: null, reference_status: null, reference_type: null, type } } };
34
+ }
@@ -0,0 +1,45 @@
1
+ import { type Row } from './common.js';
2
+ export declare const PLATFORM_CREATED = 1767225600;
3
+ /** The platform's own account as Stripe's default has it, before anything is written to it. */
4
+ export declare const platformAccountDefault: () => Row;
5
+ /** A new Express account owes what its hosted onboarding will ask for (screens/connect-onboarding.tsx; the US sets
6
+ * docs.stripe.com/connect/required-verification-information lists), or, where the twin does not model the set, the
7
+ * generic list. */
8
+ export declare function expressRequirements(params: Row): Row;
9
+ /** The controller an account made with a `type` has: "Each of the three account types maps to values in the
10
+ * `controller` hash", Standard to losses.payments `stripe`, fees.payer `account`, requirement_collection `stripe` and
11
+ * a `full` dashboard, Express to `application`, `application_express`, `stripe` and `express`, Custom to
12
+ * `application`, `application_custom`, `application` and `none`; each "type": "application", "is_controller": true
13
+ * (docs.stripe.com/connect/migrate-to-controller-properties). */
14
+ export declare function controllerOf(type: string): Row;
15
+ /** What a Custom account still owes, from what the platform has given for it, as Stripe's requirements endpoint lists it
16
+ * for a US account with no Stripe Dashboard and the full service agreement
17
+ * (docs.stripe.com/_endpoint/get-requirements-for-setups, the data behind
18
+ * docs.stripe.com/connect/required-verification-information). With transfers alone, a company owes business_profile.url,
19
+ * company.name, an external account and tos_acceptance.date and .ip at once (capability_limit_amount -1: paused until
20
+ * given) and company.tax_id before $3,000 of payouts (payout_limit_amount 300000); an individual owes the url, its
21
+ * first and last name, the bank account and the terms at once, and its date of birth and ssn_last_4 before $3,000 of
22
+ * payouts. Requesting card_payments adds business_profile.mcc and the entity's address at once (and an individual's
23
+ * email and ssn_last_4). A company with card_payments owes, at once, business_profile.mcc, its address, that its owners
24
+ * are provided, each owner's name and email, and its representative's name, email, address, title and ssn_last_4; and
25
+ * in time its phone, its statement descriptor and its representative's date of birth and phone (the endpoint's answer
26
+ * for US / dashboard none / full terms / company / card_payments and transfers, saved in scratch as
27
+ * req-custom-company-cards-transfers.json: capability_limit_amount -1 for the first, none for the second). The
28
+ * representative and the owners are the account's persons (relationship.representative, relationship.owner).
29
+ * Where the documentation stops and the twin decides: what has no limit, or is owed before $3,000 of payouts, is
30
+ * eventually_due and blocks nothing (the twin keeps no payout total against it); an owner field is met when every
31
+ * person marked owner has it (none marked: met). */
32
+ export declare const at_path: (a: Row, path: string) => unknown;
33
+ export declare const CARD_COMPANY_NOW: string[];
34
+ export declare const CARD_COMPANY_LATER: string[];
35
+ export declare const CARD_INDIVIDUAL_NOW: string[];
36
+ export declare const personHas: (p: Row, field: string) => boolean;
37
+ export declare const met: (a: Row, bank: boolean, field: string, persons?: Row[]) => boolean;
38
+ export declare function customRequirements(a: Row, bank: boolean, persons?: Row[]): {
39
+ now: string[];
40
+ later: string[];
41
+ };
42
+ /** A request's company or individual as Stripe keeps it: a tax id or SSN given is kept only as provided (the Account
43
+ * object answers company.tax_id_provided and individual.ssn_last_4_provided, never the numbers;
44
+ * docs.stripe.com/api/accounts/object). */
45
+ export declare function keptKyc(params: Row): Row;