@volter/twin-stripe 3.0.0 → 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 (253) hide show
  1. package/README.md +51 -21
  2. package/dist/generated/pack-facts.json +3 -3
  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 +5 -1
  12. package/dist/spec/doc-examples.json +445 -0
  13. package/dist/spec/sources.json +135 -207
  14. package/dist/src/cli.d.ts +0 -1
  15. package/dist/src/cli.js +0 -2
  16. package/dist/src/engine/after-payment.d.ts +0 -1
  17. package/dist/src/engine/after-payment.js +0 -1
  18. package/dist/src/engine/common.d.ts +5 -5
  19. package/dist/src/engine/common.js +13 -11
  20. package/dist/src/engine/connect.d.ts +0 -21
  21. package/dist/src/engine/connect.js +1 -82
  22. package/dist/src/engine/customers.d.ts +0 -8
  23. package/dist/src/engine/customers.js +0 -22
  24. package/dist/src/engine/display.d.ts +0 -3
  25. package/dist/src/engine/display.js +0 -3
  26. package/dist/src/engine/files.d.ts +0 -7
  27. package/dist/src/engine/files.js +0 -10
  28. package/dist/src/engine/invoices.d.ts +6 -9
  29. package/dist/src/engine/invoices.js +56 -29
  30. package/dist/src/engine/issuing.d.ts +6 -8
  31. package/dist/src/engine/issuing.js +19 -10
  32. package/dist/src/engine/ledger.d.ts +0 -1
  33. package/dist/src/engine/ledger.js +0 -1
  34. package/dist/src/engine/oauth.js +1 -2
  35. package/dist/src/engine/refunds.js +2 -27
  36. package/dist/src/engine/stripe.d.ts +2 -7
  37. package/dist/src/engine/stripe.js +34 -83
  38. package/dist/src/engine/subscriptions.d.ts +0 -1
  39. package/dist/src/engine/subscriptions.js +0 -1
  40. package/dist/src/engine/version.d.ts +0 -2
  41. package/dist/src/engine/version.js +17 -6
  42. package/dist/src/fetch.js +2 -2
  43. package/dist/src/generated/surface.gen.json +1 -1
  44. package/dist/src/generated/ui.gen.json +1 -1
  45. package/dist/src/index.js +5 -3
  46. package/dist/src/manifest.js +348 -220
  47. package/dist/src/screens/billing-portal.js +5 -5
  48. package/dist/src/screens/{connect-oauth.d.ts → checkout-js.d.ts} +0 -1
  49. package/dist/src/screens/checkout-js.js +84 -0
  50. package/dist/src/screens/connect-onboarding.js +3 -3
  51. package/dist/src/screens/dashboard.d.ts +1 -1
  52. package/dist/src/screens/dashboard.js +52 -53
  53. package/dist/src/screens/stripe-js.js +53 -93
  54. package/dist/src/semantics/account.d.ts +2 -0
  55. package/dist/src/semantics/account.js +8 -0
  56. package/dist/src/semantics/accounts.js +3 -1
  57. package/dist/src/semantics/around.js +3 -6
  58. package/dist/src/semantics/billing_portal.d.ts +0 -1
  59. package/dist/src/semantics/billing_portal.js +1 -7
  60. package/dist/src/semantics/checkout.d.ts +1 -1
  61. package/dist/src/semantics/checkout.js +18 -15
  62. package/dist/src/semantics/clock.js +1 -7
  63. package/dist/src/semantics/customers.d.ts +1 -2
  64. package/dist/src/semantics/customers.js +32 -38
  65. package/dist/src/semantics/entitlements.d.ts +0 -2
  66. package/dist/src/semantics/entitlements.js +4 -50
  67. package/dist/src/semantics/events.d.ts +2 -3
  68. package/dist/src/semantics/events.js +6 -11
  69. package/dist/src/semantics/index.js +16 -38
  70. package/dist/src/semantics/invoices.d.ts +3 -8
  71. package/dist/src/semantics/invoices.js +134 -127
  72. package/dist/src/semantics/issuing.d.ts +6 -0
  73. package/dist/src/semantics/issuing.js +77 -0
  74. package/dist/src/semantics/payment_intents.d.ts +0 -1
  75. package/dist/src/semantics/payment_intents.js +5 -13
  76. package/dist/src/semantics/payment_methods.d.ts +0 -2
  77. package/dist/src/semantics/payment_methods.js +2 -26
  78. package/dist/src/semantics/payouts.d.ts +1 -0
  79. package/dist/src/semantics/payouts.js +8 -1
  80. package/dist/src/semantics/products.d.ts +1 -3
  81. package/dist/src/semantics/products.js +3 -14
  82. package/dist/src/semantics/refunds.d.ts +1 -2
  83. package/dist/src/semantics/refunds.js +1 -5
  84. package/dist/src/semantics/shared.d.ts +64 -336
  85. package/dist/src/semantics/shared.js +326 -1336
  86. package/dist/src/semantics/states.d.ts +20 -89
  87. package/dist/src/semantics/states.js +116 -334
  88. package/dist/src/semantics/subscriptions.d.ts +1 -2
  89. package/dist/src/semantics/subscriptions.js +23 -145
  90. package/dist/src/semantics/test_helpers.d.ts +2 -5
  91. package/dist/src/semantics/test_helpers.js +121 -43
  92. package/dist/src/semantics/webhook_endpoints.d.ts +2 -0
  93. package/dist/src/semantics/webhook_endpoints.js +26 -0
  94. package/generated/pack-facts.json +3 -3
  95. package/journeys/coverage.json +596 -0
  96. package/journeys/customer-life.json +6108 -0
  97. package/journeys/customer-life.outline.md +371 -0
  98. package/journeys/decisions.json +677 -0
  99. package/journeys/demand.json +706 -0
  100. package/journeys/score.json +853 -0
  101. package/journeys/unreachable.json +102 -0
  102. package/journeys/vendor-examples.json +8010 -0
  103. package/package.json +4 -3
  104. package/spec/SOURCE.md +5 -1
  105. package/spec/doc-examples.json +445 -0
  106. package/spec/sources.json +135 -207
  107. package/src/cli.ts +0 -3
  108. package/src/engine/after-payment.ts +0 -2
  109. package/src/engine/balance.ts +0 -1
  110. package/src/engine/checkout.ts +0 -1
  111. package/src/engine/common.ts +19 -17
  112. package/src/engine/connect.ts +1 -79
  113. package/src/engine/customers.ts +0 -25
  114. package/src/engine/display.ts +2 -3
  115. package/src/engine/files.ts +0 -13
  116. package/src/engine/invoices.ts +64 -33
  117. package/src/engine/issuing.ts +16 -11
  118. package/src/engine/ledger.ts +0 -2
  119. package/src/engine/oauth.ts +1 -2
  120. package/src/engine/onboarding.ts +0 -1
  121. package/src/engine/params.ts +0 -1
  122. package/src/engine/payment-intents.ts +0 -1
  123. package/src/engine/payment-methods.ts +0 -1
  124. package/src/engine/refunds.ts +2 -28
  125. package/src/engine/renewals.ts +0 -1
  126. package/src/engine/stripe.ts +35 -83
  127. package/src/engine/subscriptions.ts +0 -3
  128. package/src/engine/transfers.ts +0 -1
  129. package/src/engine/version.ts +15 -7
  130. package/src/engine/webhooks.ts +0 -2
  131. package/src/fetch.ts +2 -2
  132. package/src/generated/surface.gen.json +1 -1
  133. package/src/generated/ui.gen.json +1 -1
  134. package/src/index.ts +6 -4
  135. package/src/manifest.ts +348 -220
  136. package/src/screens/billing-portal.tsx +5 -7
  137. package/src/screens/checkout-js.ts +80 -0
  138. package/src/screens/checkout.tsx +0 -2
  139. package/src/screens/connect-onboarding.tsx +3 -5
  140. package/src/screens/dashboard.tsx +53 -73
  141. package/src/screens/stripe-js.ts +57 -125
  142. package/src/semantics/account.ts +10 -0
  143. package/src/semantics/account_links.ts +0 -1
  144. package/src/semantics/accounts.ts +8 -7
  145. package/src/semantics/apps.ts +1 -2
  146. package/src/semantics/around.ts +3 -6
  147. package/src/semantics/balance.ts +0 -1
  148. package/src/semantics/balance_transactions.ts +1 -3
  149. package/src/semantics/billing_portal.ts +1 -7
  150. package/src/semantics/charges.ts +1 -6
  151. package/src/semantics/checkout.ts +16 -12
  152. package/src/semantics/clock.ts +1 -8
  153. package/src/semantics/coupons.ts +0 -1
  154. package/src/semantics/customers.ts +32 -35
  155. package/src/semantics/doors.ts +2 -3
  156. package/src/semantics/entitlements.ts +1 -45
  157. package/src/semantics/events.ts +7 -14
  158. package/src/semantics/index.ts +16 -38
  159. package/src/semantics/invoice_payments.ts +1 -3
  160. package/src/semantics/invoices.ts +124 -119
  161. package/src/semantics/issuing.ts +74 -0
  162. package/src/semantics/payment_intents.ts +10 -17
  163. package/src/semantics/payment_methods.ts +2 -25
  164. package/src/semantics/payouts.ts +9 -3
  165. package/src/semantics/prices.ts +0 -1
  166. package/src/semantics/products.ts +4 -14
  167. package/src/semantics/promotion_codes.ts +0 -1
  168. package/src/semantics/radar.ts +1 -3
  169. package/src/semantics/refunds.ts +2 -11
  170. package/src/semantics/shared.ts +350 -1382
  171. package/src/semantics/states.ts +109 -330
  172. package/src/semantics/subscriptions.ts +25 -145
  173. package/src/semantics/test_helpers.ts +109 -43
  174. package/src/semantics/transfers.ts +1 -3
  175. package/src/semantics/webhook_endpoints.ts +27 -0
  176. package/src/server.ts +0 -1
  177. package/dist/src/engine/billing.d.ts +0 -5
  178. package/dist/src/engine/billing.js +0 -6
  179. package/dist/src/engine/charges.d.ts +0 -6
  180. package/dist/src/engine/charges.js +0 -13
  181. package/dist/src/engine/connect-settings.d.ts +0 -16
  182. package/dist/src/engine/connect-settings.js +0 -26
  183. package/dist/src/engine/coupons.d.ts +0 -0
  184. package/dist/src/engine/coupons.js +0 -5
  185. package/dist/src/engine/credit-notes.d.ts +0 -1
  186. package/dist/src/engine/credit-notes.js +0 -5
  187. package/dist/src/engine/disputes.d.ts +0 -0
  188. package/dist/src/engine/disputes.js +0 -9
  189. package/dist/src/engine/entitlements.d.ts +0 -1
  190. package/dist/src/engine/entitlements.js +0 -4
  191. package/dist/src/engine/ephemeral-keys.d.ts +0 -0
  192. package/dist/src/engine/ephemeral-keys.js +0 -4
  193. package/dist/src/engine/front.d.ts +0 -5
  194. package/dist/src/engine/front.js +0 -25
  195. package/dist/src/engine/payment-links.d.ts +0 -1
  196. package/dist/src/engine/payment-links.js +0 -5
  197. package/dist/src/engine/plans.d.ts +0 -6
  198. package/dist/src/engine/plans.js +0 -26
  199. package/dist/src/engine/platform.d.ts +0 -39
  200. package/dist/src/engine/platform.js +0 -34
  201. package/dist/src/engine/products.d.ts +0 -0
  202. package/dist/src/engine/products.js +0 -4
  203. package/dist/src/engine/setup-intents.d.ts +0 -1
  204. package/dist/src/engine/setup-intents.js +0 -4
  205. package/dist/src/engine/subscription-schedules.d.ts +0 -3
  206. package/dist/src/engine/subscription-schedules.js +0 -1
  207. package/dist/src/engine/tax.d.ts +0 -7
  208. package/dist/src/engine/tax.js +0 -28
  209. package/dist/src/engine/terminal.d.ts +0 -4
  210. package/dist/src/engine/terminal.js +0 -20
  211. package/dist/src/engine/test-clocks.d.ts +0 -5
  212. package/dist/src/engine/test-clocks.js +0 -9
  213. package/dist/src/engine/tokens.d.ts +0 -7
  214. package/dist/src/engine/tokens.js +0 -20
  215. package/dist/src/engine/treasury.d.ts +0 -23
  216. package/dist/src/engine/treasury.js +0 -45
  217. package/dist/src/screens/connect-oauth.js +0 -333
  218. package/dist/src/semantics/disputes.d.ts +0 -2
  219. package/dist/src/semantics/disputes.js +0 -5
  220. package/dist/src/semantics/invoiceitems.d.ts +0 -3
  221. package/dist/src/semantics/invoiceitems.js +0 -59
  222. package/dist/src/semantics/setup_intents.d.ts +0 -3
  223. package/dist/src/semantics/setup_intents.js +0 -41
  224. package/dist/src/semantics/subscription_items.d.ts +0 -5
  225. package/dist/src/semantics/subscription_items.js +0 -55
  226. package/dist/src/semantics/subscription_schedules.d.ts +0 -4
  227. package/dist/src/semantics/subscription_schedules.js +0 -60
  228. package/src/engine/billing.ts +0 -16
  229. package/src/engine/charges.ts +0 -19
  230. package/src/engine/connect-settings.ts +0 -23
  231. package/src/engine/coupons.ts +0 -5
  232. package/src/engine/credit-notes.ts +0 -6
  233. package/src/engine/disputes.ts +0 -9
  234. package/src/engine/entitlements.ts +0 -5
  235. package/src/engine/ephemeral-keys.ts +0 -3
  236. package/src/engine/front.ts +0 -31
  237. package/src/engine/payment-links.ts +0 -6
  238. package/src/engine/plans.ts +0 -42
  239. package/src/engine/platform.ts +0 -47
  240. package/src/engine/products.ts +0 -3
  241. package/src/engine/setup-intents.ts +0 -5
  242. package/src/engine/subscription-schedules.ts +0 -10
  243. package/src/engine/tax.ts +0 -39
  244. package/src/engine/terminal.ts +0 -23
  245. package/src/engine/test-clocks.ts +0 -11
  246. package/src/engine/tokens.ts +0 -22
  247. package/src/engine/treasury.ts +0 -47
  248. package/src/screens/connect-oauth.tsx +0 -376
  249. package/src/semantics/disputes.ts +0 -12
  250. package/src/semantics/invoiceitems.ts +0 -59
  251. package/src/semantics/setup_intents.ts +0 -45
  252. package/src/semantics/subscription_items.ts +0 -54
  253. package/src/semantics/subscription_schedules.ts +0 -66
@@ -1,26 +1,15 @@
1
1
  import type { EventsDecl, Handler, HandlerContext } from '@volter/world-core';
2
2
  import { type StripeAuthRequestOutcome } from '../engine/webhooks.js';
3
3
  import { type Outcome } from '../engine/after-payment.js';
4
- import { cardError, type CheckoutItem, declineFor, type StripeResponse } from '../engine/stripe.js';
4
+ import { cardError, declineFor, type StripeResponse } from '../engine/stripe.js';
5
5
  import { type EnteredCard } from '../engine/checkout.js';
6
6
  import { type Find, type Row } from '../engine/common.js';
7
- import { type ConnectOAuthSettings } from '../engine/connect-settings.js';
8
7
  /** Stripe's events: `Stripe-Signature: t=…,v1=…` over `${t}.${body}` keyed by the endpoint's secret
9
8
  * (docs.stripe.com/webhooks#verify-manually); the Event object (docs.stripe.com/api/events/object) kept as the account's
10
9
  * own (`GET /v1/events`), whether or not an endpoint takes it; an endpoint live while `enabled`, taking the types its
11
10
  * `enabled_events` names (`*` all, `<family>.*` a family), and a Connect endpoint (`connect: true`) its connected
12
11
  * accounts' events ("Connected accounts" scope, docs.stripe.com/connect/webhooks), any other the account's own. */
13
12
  export declare const STRIPE_EVENTS: EventsDecl;
14
- export type Reads = Pick<HandlerContext, 'rowsRaw'>;
15
- /** Whether a connected account's OAuth connection to the platform was revoked (deauthorized, or its code reused). */
16
- export declare function connectionRevoked(ctx: Reads, account: string): boolean;
17
- /** The connected account an OAuth key acts as — the connection's current access_token (sk_test_oauth_…) or its
18
- * stripe_publishable_key (pk_test_oauth_…) — with the scope it was issued; undefined for any other key, and null for an
19
- * OAuth-shaped key no live connection holds (revoked, replaced by a refresh, or never issued). */
20
- export declare function oauthKeyAccount(ctx: Reads, key: string): {
21
- account: string;
22
- scope: string;
23
- } | null | undefined;
24
13
  /** A customer's now: its test clock's frozen time when it is on one (docs.stripe.com/billing/testing/test-clocks), the
25
14
  * World's otherwise. */
26
15
  export declare function clockNow(ctx: HandlerContext, customer: unknown): number;
@@ -63,7 +52,6 @@ export declare function advanceBilling(ctx: HandlerContext, only?: (sub: Row) =>
63
52
  /** The earliest move that has come due, made at its moment; false when none has. */
64
53
  export declare function billingStep(ctx: HandlerContext, at: (t: number) => Promise<HandlerContext>, only?: (sub: Row) => boolean): Promise<boolean>;
65
54
  export declare const account: (ctx: HandlerContext) => string | undefined;
66
- export declare const payoutMissing: (ctx: HandlerContext, id: string) => Response;
67
55
  /** The acting account's Balance object (docs.stripe.com/api/balance/balance_object). */
68
56
  export declare function balanceBody(ctx: HandlerContext, acct?: string | undefined): Row;
69
57
  /** Time's arrivals, written: each of the acting account's payouts whose arrival date has come moves pending → paid
@@ -99,104 +87,20 @@ export declare function afterCharge(ctx: HandlerContext, chargeId: string, charg
99
87
  export declare function openReview(ctx: HandlerContext, chargeId: string, pi: {
100
88
  payment_intent: string | null;
101
89
  }): Promise<void>;
102
- /** The mandate a verified bank account carries for a payment (single use) or a setup (multi use). */
103
- export declare function mintMandate(ctx: HandlerContext, paymentMethod: unknown, use: 'single_use' | 'multi_use', amount?: number, currency?: string): Promise<string>;
104
90
  export declare const customerMissing: (ctx: HandlerContext, id: string) => Response;
105
- /** The discount a customer's `coupon` makes, a parameter of API versions before the served one. */
106
- export declare function customerDiscount(ctx: HandlerContext, couponId: string): Row | Response;
107
- /** A tax ID for its owner: the account itself, or one of its customers. */
108
- export declare function makeTaxId(ctx: HandlerContext, customer: string | undefined): Promise<Response>;
109
- /** The owner a top-level tax-ID call names: the account itself unless `owner[type]=customer` names a customer
110
- * (docs.stripe.com/api/tax_ids/list: owner defaults to self). */
111
- export declare function ownerOf(ctx: HandlerContext): {
112
- customer?: string;
113
- } | Response;
114
- export declare function cashBalance(ctx: HandlerContext, customer: string): Row;
115
- /** Automatic reconciliation (docs.stripe.com/payments/customer-balance/reconciliation): funds that arrive pay the
116
- * customer's open invoices that take bank transfers (payment_method_types customer_balance), the one whose number
117
- * the transfer's reference names first, then the oldest. Where the documentation stops and the twin decides: an
118
- * invoice is paid only when the balance covers all of what remains; a smaller balance waits for more funds. */
119
- export declare function reconcile(ctx: HandlerContext, customer: string, currency: string, reference: string | null): Promise<void>;
120
- /** The customer's source the path names, or undefined. */
121
- export declare const customerSource: (ctx: HandlerContext) => Row | undefined;
122
- export declare const sourceMissing: (ctx: HandlerContext) => Response;
123
- /** The intent the path names, and the machine's refusal when this operation may not move it. */
124
- export declare function load(ctx: HandlerContext, operationId: string): {
125
- si: Row;
126
- } | {
127
- answer: Response;
128
- };
129
91
  /** The request event asked of the endpoint, signed with its secret and rendered in the event's API version, and its
130
92
  * answer read as the decision. */
131
93
  export declare function askForAuthorization(ctx: HandlerContext, url: string, event: Record<string, unknown>, secret: string): Promise<StripeAuthRequestOutcome>;
132
94
  /** Stripe's refusal of a call a publishable key may not make, or undefined when the key may make it. */
133
95
  export declare function publishableKeyRefused(ctx: HandlerContext): Response | undefined;
134
- export declare function revokedAccountRefused(ctx: HandlerContext): Response | undefined;
135
96
  /** The platform's own keys, as the dashboard's API keys page makes them (the `appCredentials` door): a secret key and a
136
97
  * publishable key, held by their SHA-256. A request with no key is refused, as is a platform key Stripe never issued
137
- * ("Invalid API Key provided"); a connected account's OAuth key is checked where it is read (actingAsOAuthKey). */
98
+ * ("Invalid API Key provided"). */
138
99
  export declare function platformKeyRefused(ctx: HandlerContext, request: Request): Response | undefined;
139
- export declare function actingAsOAuthKey(ctx: HandlerContext, request: Request): Promise<Request | Response>;
140
100
  export declare function withMetadata(ctx: HandlerContext, request: Request): Request;
141
- /** `disabled` switches delivery off or back on (docs.stripe.com/api/webhook_endpoints/update#update_webhook_endpoint-disabled). */
142
- export declare function switchDelivery(ctx: HandlerContext, id: string, we: Row, fields: Row, off: boolean): Promise<Response>;
143
- /** Whether a stored event is the acting account's (no `account`: the platform's). */
144
- export declare const ownEvent: (ctx: HandlerContext, e: Row) => boolean;
145
- export declare const faMissing: (ctx: HandlerContext, id: string, status?: number) => Response;
146
- export declare const metadataOf: (ctx: HandlerContext) => unknown;
147
- /** The account's bank address once financial_addresses.aba is active: "The FinancialAccount gains a FinancialAddress
148
- * when the `financial_addresses.aba` feature is active", and "A FinancialAddress is not added until the
149
- * financial_addresses.aba feature has been activated" (docs.stripe.com/treasury/account-management/financial-accounts),
150
- * whose test example answers "bank_name": "Stripe Test Bank", "routing_number": "000000001" and the networks "ach",
151
- * "us_domestic_wire", "rtp"; "The full account_number is only returned if the request expands it" (the same page).
152
- * Where the documentation stops and the twin decides: the account number is ten digits drawn from the account's id,
153
- * answered by its last four (the full number is null: expanding it is not modelled), and the holder's name is the
154
- * platform account's business name, its dashboard name or, with neither, its id. */
155
- export declare function abaAddress(ctx: HandlerContext, faId: string): Row;
156
- export declare const addressesOf: (ctx: HandlerContext, faId: string, active: string[]) => Row[];
157
- /** Post a flow's double entry: a ledger transaction with its net balance impact, and its one entry. */
158
- export declare function post(ctx: HandlerContext, o: {
159
- financial_account: string;
160
- amount: number;
161
- currency: string;
162
- flow: string;
163
- flow_type: string;
164
- status: 'open' | 'posted';
165
- balance_impact: Row;
166
- description: string;
167
- flowDetailKey?: string;
168
- }): Promise<string>;
169
- /** The request's funding account, or the refusal. */
170
- export declare function fundingAccount(ctx: HandlerContext): string | Response;
171
- /** Where an outbound flow sends its money, as the served spec's payment method details give it: the bank account's
172
- * holder type, last four digits and routing number from what the request sent (a saved method's, or the test bank's
173
- * when none is given), and its billing details (required): the name and email sent, the address lines null where not
174
- * given. Where the documentation stops and the twin decides: a saved method's details are the test bank's. */
175
- export declare function destinationDetails(ctx: HandlerContext, dest: string | null): Row;
176
- /** An outbound payment that names no destination: "You must provide either destination_payment_method or
177
- * destination_payment_method_data" (the served spec's outbound payment create). */
178
- export declare function noDestination(ctx: HandlerContext): Response;
179
- /** The bank account an inbound transfer may pull from: "You must first set up the account-attached payment method for
180
- * inbound flows and verify the bank account using a SetupIntent", and invalid ones ("of unsupported types, containing
181
- * an unverified bank account, or not set up for inbound flows") "throw the same errors as in live mode"
182
- * (docs.stripe.com/treasury/moving-money/financial-accounts/into/inbound-transfers). A payment method is set up for
183
- * inbound flows by a SetupIntent whose flow_directions holds `inbound`, and verified when that SetupIntent succeeded
184
- * ("The bank account has been instantly verified or verification isn't necessary", its `succeeded` status,
185
- * docs.stripe.com/treasury/connect/legacy/v1/moving-money/working-with-bankaccount-objects).
186
- * Where the documentation stops and the twin decides: the page quotes no error, so the twin answers the documented code
187
- * for the class, payment_method_unexpected_state ("The provided payment method's state was incompatible with the
188
- * operation you were trying to perform", docs.stripe.com/error-codes), in its own words; an existing verified
189
- * BankAccount (`ba_`), which the page also allows, is not checked. Answers the payment method, or the refusal. */
190
- export declare function inboundOrigin(ctx: HandlerContext, origin: string): Row | Response | undefined;
191
- export declare function received(kind: 'received_credit' | 'received_debit'): Handler;
192
- /** Cancel a flow still processing; an outbound one must also still be cancelable. */
193
- export declare function cancel(resource: string, param: string, name: string, operationId: string, op: string, checkCancelable: boolean): Handler;
194
- export declare function ledger(resource: string, spec: Record<string, (r: Row, v: unknown) => boolean>): Handler;
195
101
  export declare function scopeKeyOf(ctx: HandlerContext): string;
196
102
  export declare const named: (ctx: HandlerContext, name: string) => Row | undefined;
197
103
  export declare const invoiceMissing: (ctx: HandlerContext, id: string) => Response;
198
- /** Write a draft's line list and the totals derived from it. */
199
- export declare function writeLines(ctx: HandlerContext, invoiceId: string, next: Row[]): Promise<Row>;
200
104
  /** Paying an invoice with nothing to pay it: "If not set, defaults to the subscription's default payment method, if any,
201
105
  * or to the default payment method in the customer's invoice settings" (docs.stripe.com/api/invoices/object,
202
106
  * default_payment_method), and none of them is set. */
@@ -204,62 +108,24 @@ export declare function nothingToPayWith(ctx: HandlerContext): Response;
204
108
  /** A subscription waiting on the invoice paid through the invoice's own pay (incomplete on its first, past_due on a
205
109
  * failed renewal) is active again. */
206
110
  export declare function activatedByPayment(ctx: HandlerContext, subId: string): Promise<void>;
207
- /** Re-derive a draft's lines from the items still on it: an item that changed or was deleted moves the invoice with it. */
208
- export declare function resyncDraftLines(ctx: HandlerContext, invoiceId: string): Promise<void>;
209
- /** An item priced by a Price: its unit amount times the quantity, in its currency (docs.stripe.com/api/invoiceitems/create#create_invoiceitem-pricing). */
210
- export declare function pricedItem(ctx: HandlerContext, priceRef: string, qty: number): {
211
- amount: number;
212
- currency: string | undefined;
213
- } | Response;
214
- export declare const itemMissing: (ctx: HandlerContext, id: string) => Response;
215
- /** A draft invoice another object makes (an accepted quote): its customer's, with an invoice item per line the
216
- * object gives, and the object named as its parent. Answers the invoice's id. */
217
- export declare function draftInvoiceFor(ctx: HandlerContext, customer: string, currency: string, parent: Row, lines: Array<{
218
- price: unknown;
219
- quantity: number;
220
- amount: number;
221
- description: unknown;
222
- }>): Promise<string>;
223
- /** A customer's pending invoice item, made before the invoice, pulled onto it (docs.stripe.com/api/invoices/create#create_invoice-pending_invoice_items_behavior). */
224
- export declare function pullPendingItem(ctx: HandlerContext, invoiceId: string, inv: Row, item: Row, now: number): Promise<void>;
225
111
  /** The invoice the path names, and the machine's refusal when this operation may not move it. */
226
112
  export declare function invoicesLoad(ctx: HandlerContext, operationId: string): {
227
113
  inv: Row;
228
114
  } | {
229
115
  answer: Response;
230
116
  };
117
+ /** A draft finalized on its way to being paid: numbered, open, its PaymentIntent opened (PostInvoicesInvoiceFinalize). */
118
+ export declare function finalizeForPayment(ctx: HandlerContext, inv: Row, id: string): Promise<Row>;
231
119
  /** The PaymentIntent a charge_automatically invoice with a balance gets when it is finalized; it
232
120
  * waits for confirmation when the invoice already names a default payment method. */
233
121
  export declare function openPaymentIntent(ctx: HandlerContext, piId: string, inv: Row, invoiceId: string): Promise<void>;
234
122
  export declare function finalizedFields(ctx: HandlerContext, inv: Row, now: number): Row;
235
- export declare function editLines(kind: 'add' | 'update' | 'remove'): Handler;
236
- export declare const noteMissing: (ctx: HandlerContext, id: string) => Response;
237
- /** The credit note the request describes (the `amount` form: one custom line), or Stripe's refusal. */
238
- export declare function build(ctx: HandlerContext, id: string): Row | Response;
239
- /** The invoice's credit-note sums, from its issued credit notes; a pre-payment credit lowers what is owed. */
240
- export declare function syncInvoice(ctx: HandlerContext, invoiceId: string): Promise<void>;
241
- /** What a post-payment credit pays back: "Refunds: create a new refund (using refund_amount)"; "Customer balance credit:
242
- * credit the customer's balance (using credit_amount) which will be automatically applied to their next invoice when
243
- * it's finalized" (docs.stripe.com/api/credit_notes/create). The refund is made on the invoice's charge as a refund
244
- * call makes it (refunds.ts); the credit is a customer balance transaction of type credit_note. Where the documentation
245
- * stops and the twin decides: the refund carries no reason of its own. */
246
- export declare function payBack(ctx: HandlerContext, id: string, cn: Row): Promise<Row | Response>;
247
123
  /** A coupon for a fixed amount off, in its currency (docs.stripe.com/api/coupons/create#create_coupon-amount_off). */
248
124
  export declare function amountOffOf(ctx: HandlerContext, params: Record<string, unknown>): number | Response;
249
125
  /** Time's lapsing of coupons, caught up to the World's clock: a valid coupon whose redeem_by has passed is no longer
250
126
  * valid from that moment (manifest.ts). Where the documentation stops and the twin decides: the lapse sends no event
251
127
  * (the events page names none for it). */
252
128
  export declare function lapseCoupons(ctx: HandlerContext): Promise<void>;
253
- export declare const planMissing: (ctx: HandlerContext, id: string) => Response;
254
- /** A recurring price the Plans API still answers: one whose plan was deleted is not a plan any more. */
255
- export declare const recurring: (ctx: HandlerContext, p: Row | undefined) => p is Row;
256
- /** The request's line items resolved against their prices, or the refusal for a missing price. */
257
- export declare function resolved(ctx: HandlerContext): CheckoutItem[] | Response;
258
- /** A page of the line items a stored object carries. */
259
- export declare function linePage(ctx: HandlerContext, holder: Row): Response;
260
- export declare const linkMissing: (ctx: HandlerContext, id: string) => Response;
261
- export declare const quoteMissing: (ctx: HandlerContext, id: string) => Response;
262
- export declare function move(action: 'finalize' | 'accept' | 'cancel', operationId: string): Handler;
263
129
  export declare const sessionMissing: (ctx: HandlerContext, id: string) => Response;
264
130
  /** The discount a session is created with (discounts[0][promotion_code] or [coupon]), or Stripe's refusal: an unknown
265
131
  * code or coupon, and one that has expired or been deactivated, are refused at create
@@ -296,20 +162,10 @@ export declare function completeSession(ctx: HandlerContext, id: string, existin
296
162
  export declare const send: (ctx: HandlerContext, r: StripeResponse) => Response;
297
163
  /** Stripe's error body: an invalid_request_error with the message, and the code when there is one. */
298
164
  export declare const fail: (ctx: HandlerContext, message: string, status?: number, code?: string) => Response;
299
- /** A file parameter whose description requires a purpose refuses a file of another one. The served spec requires it
300
- * on every such parameter ("Must have a `purpose` value of `issuing_logo`", personalization designs' card_logo;
301
- * "The file's `purpose` must be one of the following: …", file links' file). Where the documentation stops and the
302
- * twin decides: Stripe documents no error for it (docs.stripe.com/error-codes names none), so the twin answers the
303
- * 400 invalid_request_error it answers for an unknown file, naming the parameter and the purposes allowed. */
304
- export declare function filePurposeRefused(ctx: HandlerContext, param: string, allowed: readonly string[]): Response | undefined;
305
165
  /** The request's path, as the list envelope's `url` carries it. */
306
166
  export declare const path: (ctx: HandlerContext) => string;
307
167
  /** A path parameter, by the name the spec gives it. */
308
168
  export declare const at: (ctx: HandlerContext, name: string) => string;
309
- /** An update's fields laid over what is stored, as the derived core does: a nested hash is merged into the stored one,
310
- * not put in its place (Stripe updates only the keys a request names; docs.stripe.com/api/metadata and each update
311
- * reference), and an empty string unsets a key. */
312
- export declare function mergeUpdate(ctx: HandlerContext, resource: string, id: string, fields: Row): Row;
313
169
  /** A resource's rows in Stripe's list order: newest first by `timeField`, ties by mint order (as the derived core breaks them). */
314
170
  /** A subject's bookkeeping field (`_…`): kept on the stored row, never in the wire view ctx.get and ctx.rows answer. */
315
171
  export declare const kept: (ctx: HandlerContext, resource: string, row: Row, key: string) => unknown;
@@ -338,6 +194,7 @@ export declare function commonAsOf(ctx: HandlerContext, t: Row): Row;
338
194
  export declare function expandRow(ctx: HandlerContext, resource: string, body: Row, paths: string[][]): Row;
339
195
  /** One resource with the request's `expand[]` applied. */
340
196
  export declare const expanded: (ctx: HandlerContext, resource: string, body: Row) => Row;
197
+ export declare const resourceView: (ctx: HandlerContext, resource: string, id: string) => Row | undefined;
341
198
  /** Stripe's list envelope over rows already in list order: a page, `has_more`, and `expand[]=data.*`. */
342
199
  export declare function list(ctx: HandlerContext, resource: string, items: Row[]): Response;
343
200
  /** Stripe's search over a resource's rows (`query` in its search language). */
@@ -354,29 +211,6 @@ export declare function created(ctx: HandlerContext, resource: string, params: R
354
211
  export declare const finder: (ctx: Pick<HandlerContext, "rowsRaw">) => Find;
355
212
  /** The account's external_accounts list, rewritten from its external accounts after one is added or removed. */
356
213
  export declare function syncExternals(ctx: HandlerContext, account: string): Promise<void>;
357
- /** A decision over the rows and the write it makes, taken together: the read and the write follow one another with
358
- * nothing between them (a code spent once, a connection revoked once). */
359
- export declare function decide<T>(ctx: HandlerContext, decision: (rows: (resource: string) => Row[]) => {
360
- value: T;
361
- write?: {
362
- resource: string;
363
- id: string;
364
- fields: Row;
365
- operation: string;
366
- };
367
- }): Promise<T>;
368
- export declare const catalog: (ctx: HandlerContext, data: Row[]) => Response;
369
- export declare const orderMissing: (ctx: HandlerContext, id: string) => Response;
370
- /** Each pending report run completes, caught up before anything is answered: "When the run completes, Stripe updates
371
- * the object, and it has a status of succeeded. It also has a nested result object, containing a URL that you can use
372
- * to access the file", the guide's example a File of purpose report_run and type csv (docs.stripe.com/reports/api).
373
- * "Most runs complete within a few minutes" (the same page). Where the documentation stops and the twin decides: a run
374
- * completes one minute after it was created (the guide's example: created 1580832900, succeeded_at 1580832960), and
375
- * its CSV holds the report type's header row alone (its size that row's bytes). */
376
- export declare function finishReportRuns(ctx: HandlerContext): Promise<void>;
377
- /** A feature whose lookup_key an unarchived feature already has: "A unique key you provide as your own system identifier"
378
- * (docs.stripe.com/api/entitlements/feature/create). */
379
- export declare function lookupKeyTaken(ctx: HandlerContext, lookupKey: string): Response;
380
214
  export declare const pmMissing: (ctx: HandlerContext, id: string) => Response;
381
215
  /** The card a charge was paid with, as its payment_method_details reports it
382
216
  * (docs.stripe.com/api/charges/object#charge_object-payment_method_details): a stored PaymentMethod's card, a
@@ -395,26 +229,6 @@ export declare function methodFromData(ctx: HandlerContext, data: unknown): Prom
395
229
  * payment_method_options[us_bank_account][verification_method]=microdeposits with a us_bank_account method
396
230
  * ("Microdeposit only verification", docs.stripe.com/payments/ach-direct-debit/set-up-payment). */
397
231
  export declare function microdepositsAsked(ctx: HandlerContext, params: Row, intent: Row, pm: string | undefined): boolean;
398
- export declare const scheduleMissing: (ctx: HandlerContext, id: string) => Response;
399
- /** A schedule's phases as Stripe answers them (the served spec's subscription_schedule_phase_configuration): each
400
- * starts where the last ended (the first at the schedule's start_date, "now" or a timestamp), and ends at its
401
- * end_date or after its duration ("duration: interval, interval_count", the served spec's phases[] parameter) on the
402
- * calendar; its currency is its first price's, each item carries its price, quantity and (empty) discounts. Where the
403
- * documentation stops and the twin decides: a phase with neither lasts one interval of its first price. */
404
- export declare function phasesOf(ctx: HandlerContext, given: Row[], start: number): Row[];
405
- export declare function end(kind: 'cancel' | 'release'): Handler;
406
- /** A token asked for none of what a token holds. */
407
- export declare function noTokenSource(ctx: HandlerContext): Response;
408
- /** A bank account token's account, as the legacy BankAccount object holds it. */
409
- export declare function bankAccountOf(ctx: HandlerContext, ba: Row): Row;
410
- export declare const productMissing: (ctx: HandlerContext, id: string) => Response;
411
- /** A product deleted while it has prices: "Deleting a product is only possible if it has no prices associated with it"
412
- * (docs.stripe.com/api/products/delete). */
413
- export declare function pricedProductRefused(ctx: HandlerContext): Response;
414
- /** A feature attached to a product that already has it. */
415
- export declare function alreadyAttached(ctx: HandlerContext): Response;
416
- export declare const productFeature: (ctx: HandlerContext) => Row | undefined;
417
- export declare const featureMissing: (ctx: HandlerContext) => Response;
418
232
  /** A tiered price: tiers_mode and tiers, each tier with up_to and a unit or flat amount; no single unit_amount, and
419
233
  * the last tier's up_to null (∞) (docs.stripe.com/products-prices/pricing-models#tiered-pricing). */
420
234
  export declare function tieredPrice(ctx: HandlerContext, params: Row): Promise<Response>;
@@ -440,12 +254,8 @@ export declare function authorizeCharge(ctx: HandlerContext, piId: string, pi: R
440
254
  * already paid (a duplicate confirm) or void (voiding ends what it collects).
441
255
  */
442
256
  export declare function payInvoiceOf(ctx: HandlerContext, pi: Row, operationId: string, actor?: 'vendor'): Promise<void>;
443
- /** The intent the path names, and the machine's refusal when this operation may not move it. */
444
- export declare function paymentIntentsLoad(ctx: HandlerContext, operationId: string): {
445
- pi: Record<string, unknown>;
446
- } | {
447
- answer: Response;
448
- };
257
+ /** An invoice-linked intent read back from a live account; the served create API cannot set invoice. */
258
+ export declare function finishInvoiceIntent(ctx: HandlerContext, invoice: Row, invoiceId: string, operationId: string, actor?: 'vendor'): Promise<void>;
449
259
  /** The type of the payment method an intent is paid with: its PaymentMethod's, or a documented test name's (pm_card_*,
450
260
  * tok_* a card; pm_usBankAccount_* a US bank account), else unknown. */
451
261
  export declare function methodType(ctx: HandlerContext, method: unknown): string | undefined;
@@ -458,10 +268,9 @@ export declare function methodType(ctx: HandlerContext, method: unknown): string
458
268
  * twin answers payment_intent_invalid_parameter ("One or more provided parameters wasn't allowed for the given
459
269
  * operation on the PaymentIntent", docs.stripe.com/error-codes), param payment_method. */
460
270
  export declare function methodNotAllowed(ctx: HandlerContext, existing: Row, params: Row): Response | undefined;
271
+ export declare function intentFields(params: Record<string, unknown>): Record<string, unknown>;
461
272
  /** Confirm an intent the confirm machine allows to move: the confirm action, and a create with `confirm=true`. */
462
273
  export declare function confirmIntent(ctx: HandlerContext, existing: Record<string, unknown>, params: Record<string, unknown>): Promise<Response>;
463
- /** An increment that does not raise the authorization. */
464
- export declare function incrementTooSmall(ctx: HandlerContext): Response;
465
274
  /** Whether the method an intent is confirmed with is a bank debit: a us_bank_account PaymentMethod, or one of Stripe's
466
275
  * test bank accounts named as one (pm_usBankAccount_*, pm_us_bank_account). */
467
276
  export declare function isBankDebit(ctx: HandlerContext, method: unknown): boolean;
@@ -471,7 +280,7 @@ export declare function staysProcessing(ctx: HandlerContext, method: unknown): b
471
280
  * settle at this instant, unless its test account stays processing. */
472
281
  export declare function beginBankDebit(ctx: HandlerContext, id: string, fields: Row): Promise<Row>;
473
282
  /** Time's settling of bank debits, caught up to the World's clock: each processing debit whose moment has come succeeds
474
- * then, its Charge made (naming the mandate it ran under) and the invoice it collects for paid. */
283
+ * then, its Charge made and the invoice it collects for paid. */
475
284
  export declare function settleBankDebits(ctx: HandlerContext): Promise<void>;
476
285
  /** A customer_balance intent funded from the customer's cash balance: paid when the balance covers it ("If the customer
477
286
  * already has a balance high enough to cover the payment amount, the PaymentIntent immediately succeeds"), else
@@ -479,6 +288,14 @@ export declare function settleBankDebits(ctx: HandlerContext): Promise<void>;
479
288
  * shows a requires_action status ... next_action ... display_bank_transfer_instructions" with the amount_remaining
480
289
  * (docs.stripe.com/payments/bank-transfers/accept-a-payment). Answers the intent as written. */
481
290
  export declare function fundFromCashBalance(ctx: HandlerContext, pi: Row, fields?: Row): Promise<Row>;
291
+ /** A customer_balance intent the customer's funded cash balance pays: its ledger records what was applied, and the intent
292
+ * succeeds with its charge. */
293
+ export declare function payFromCashBalance(ctx: HandlerContext, pi: Row, fields: Row, o: {
294
+ customer: string;
295
+ currency: string;
296
+ available: number;
297
+ amount: number;
298
+ }): Promise<Row>;
482
299
  /** Whether a charge's funds go straight to the available balance: a bypass card as a raw number, a test name (pm_card_*
483
300
  * or tok_*), or a stored PaymentMethod made from one (which records it as what follows its success, after-payment.ts);
484
301
  * or a US bank account, stored or one of Stripe's test bank accounts named as one (pm_usBankAccount_*). */
@@ -501,9 +318,6 @@ export declare function availableAt(ctx: HandlerContext, account: string | undef
501
318
  export declare function fundsDueBetween(ctx: HandlerContext, account: string | undefined, currency: string, from: number, until: number): number[];
502
319
  /** A dispute's debit, at once: the disputed amount and the dispute fee (the twin's 1500 cents, Stripe's US $15). */
503
320
  export declare function settleDispute(ctx: HandlerContext, disputeId: string, amount: number, currency: string): Promise<string>;
504
- /** A won dispute's credit, at once: the disputed amount returned (docs.stripe.com/disputes/how-disputes-work). Where the
505
- * documentation stops and the twin decides: the dispute fee is not returned. */
506
- export declare function settleDisputeWon(ctx: HandlerContext, disputeId: string, amount: number, currency: string): Promise<string>;
507
321
  /** An account's ledger entries an automatic payout has not yet paid out: every entry on its payments balance that no
508
322
  * automatic payout took (the automatic payouts' own debits excluded), as stored. */
509
323
  export declare function unpaidEntries(ctx: HandlerContext, account: string | undefined): Row[];
@@ -516,14 +330,8 @@ export declare function settlePayout(ctx: HandlerContext, payoutId: string, amou
516
330
  * charge's funds' availability) comes (a plain transfer, with no `fromCharge`, moves funds available already).
517
331
  * Answers the platform's entry. */
518
332
  export declare function settleTransfer(ctx: HandlerContext, transferId: string, amount: number, currency: string, destination: string, fromCharge?: number, fromPending?: boolean): Promise<string>;
519
- /** A transfer reversal's two entries: back into the platform's balance, out of the destination's. */
520
- export declare function settleTransferReversal(ctx: HandlerContext, reversalId: string, amount: number, currency: string, destination: string): Promise<string>;
521
333
  /** A direct charge's application fee: out of the connected account's balance, into the platform's. */
522
334
  export declare function settleApplicationFee(ctx: HandlerContext, feeId: string, amount: number, currency: string, account: string): Promise<string>;
523
- /** A top-up's credit, to the payments balance or, with `destination_balance=issuing`, to Issuing's
524
- * (docs.stripe.com/issuing/funding/balance). Where the documentation stops and the twin decides: a test-mode top-up
525
- * is available at once. */
526
- export declare function settleTopup(ctx: HandlerContext, topupId: string, amount: number, currency: string, destination: string): Promise<string>;
527
335
  /** Time's settlements, written: each entry on the acting account's balance whose funds came due by the World's clock
528
336
  * moves pending → available (the clock's move the machine allows), so a settlement is recorded once. A read already
529
337
  * sees it (asOf); the record is what lets Stripe's balance.available be sent once (./front.ts, the drain).
@@ -542,40 +350,6 @@ export declare const mine: (ctx: HandlerContext) => Set<unknown>;
542
350
  export declare const chargeMissing: (ctx: HandlerContext, id: string) => Response;
543
351
  /** Every egress of a charge carries its refunds, derived from the refund rows in list order. */
544
352
  export declare function chargeBody(ctx: HandlerContext, c: Row): Row;
545
- /** A Charges-API charge a declining test card refuses: a 402 card_error naming the failed charge Stripe records for the
546
- * attempt (docs.stripe.com/declines). */
547
- export declare function declinedCharge(ctx: HandlerContext, decline: {
548
- code: string;
549
- decline_code?: string;
550
- message: string;
551
- }): Promise<Response>;
552
- /** A charge's fraud report: "user_report … Assessments reported by you. If set, possible values of are `safe` and
553
- * `fraudulent`" (docs.stripe.com/api/charges/object, fraud_details). */
554
- export declare function fraudReport(ctx: HandlerContext, existing: Row, fd: Row): Row | Response;
555
- /** A capture=false charge refunded while uncaptured: its authorization is released by the refund, as it would be
556
- * "automatically refunded if uncaptured" (spec/openapi.json.gz, `capture_before`). The charge stays uncaptured and
557
- * becomes refunded in full, a Refund records the release, and no money moves: none was ever received. Written as
558
- * charge.refunded. Where the documentation stops and the twin decides: Stripe's basil change ("Partially capturing or
559
- * canceling payments no longer creates a Refund", docs.stripe.com/changelog/basil/2025-03-31/remove-refund-from-partial-
560
- * capture-and-payment-cancellation-flow) names partial capture and cancellation, not a refund asked for, so a refund
561
- * still makes one; its reason is null and it has no balance transaction. Answers the Refund. */
562
- export declare function releaseAuthorization(ctx: HandlerContext, ch: Row, operationId: string, given?: Row): Promise<Row>;
563
- /** A PaymentIntent's authorization released by its cancel: "For PaymentIntents with a `status` of `requires_capture`, the
564
- * remaining `amount_capturable` is automatically refunded" (docs.stripe.com/api/payment_intents/cancel), and since basil
565
- * a cancellation makes no Refund: "`amount_captured` will be 0 instead of `nil` in payment cancellation flows",
566
- * "`amount_refunded` will no longer be updated by these actions", "`refunded` will no longer be `true` for payment
567
- * cancellation flows", and no charge.refunded is sent (docs.stripe.com/changelog/basil/2025-03-31/remove-refund-from-
568
- * partial-capture-and-payment-cancellation-flow). The charge stays uncaptured; nothing is written as an event. */
569
- export declare function cancelAuthorization(ctx: HandlerContext, ch: Row): Promise<Row>;
570
- /** An authorized charge captured, by the charge's capture or its PaymentIntent's: what is captured credits the balance.
571
- * Written as charge.captured, "Occurs whenever a previously uncaptured charge is captured" (docs.stripe.com/api/events/types).
572
- * A partial capture releases the rest with no Refund and leaves amount_refunded and refunded as they were: "The following
573
- * flows no longer result in a `Refund` object created and linked to the payment: Partial capture", "`amount_refunded`
574
- * will no longer be updated by these actions", and "There will only be a single balance transaction for partial captures"
575
- * (docs.stripe.com/changelog/basil/2025-03-31/remove-refund-from-partial-capture-and-payment-cancellation-flow).
576
- * The caller has asked the machine whether it may capture. */
577
- export declare function captureAuthorization(ctx: HandlerContext, ch: Row, toCapture: number, _operationId: string): Promise<Row>;
578
- export declare const chargeRefund: (ctx: HandlerContext) => Row | Response;
579
353
  export declare const subMissing: (ctx: HandlerContext, id: string) => Response;
580
354
  /** A coupon that replaces the subscription's discount, or an empty one that clears it (docs.stripe.com/api/subscriptions/update#update_subscription-discounts). */
581
355
  export declare function replacedDiscounts(ctx: HandlerContext, couponId: string, sub: Row): Row[] | Response;
@@ -673,16 +447,10 @@ export declare function inlinePrice(ctx: HandlerContext, d: Row): Promise<string
673
447
  /** A new subscription's items, each its own subscription_item as Stripe keeps it (/v1/subscription_items/{id}). */
674
448
  export declare function storeItems(ctx: HandlerContext, subId: string, items: Row[]): Promise<void>;
675
449
  export declare function syncItems(ctx: HandlerContext, subId: string): Promise<void>;
676
- /** A subscription item with its billing period: its subscription's (basil moved the period onto the items). */
677
- export declare const withPeriod: (ctx: HandlerContext, si: Row) => Row;
678
- export declare const subscriptionsItemMissing: (ctx: HandlerContext, id: string) => Response;
679
450
  export declare const listMissing: (ctx: HandlerContext, id: string, status?: number) => Response;
680
451
  /** A value list's list_items, "List of items contained within this value list" (the served spec), kept in step with
681
452
  * its items, at the address the fixture names (/v1/radar/value_list_items?value_list=…). */
682
453
  export declare function radarSyncItems(ctx: HandlerContext, listId: string): Promise<void>;
683
- /** A requested move of a state field the machine declares, legal or refused; a value the machine
684
- * does not name is written as given, as the hand-written route did. */
685
- export declare function requestedMove(ctx: HandlerContext, resource: string, operationId: string, current: unknown, values: string[]): Response | undefined;
686
454
  /** An authorization as every egress carries it: its card embedded in full. */
687
455
  export declare function withCard(ctx: HandlerContext, a: Row): Row;
688
456
  export declare const authMissing: (ctx: HandlerContext, id: string) => Response;
@@ -737,36 +505,13 @@ export declare function answeredByEndpoint(ctx: HandlerContext, outcome: {
737
505
  }) => Row;
738
506
  decline: (reason: string, message: string | null) => Promise<Response>;
739
507
  }): Promise<Response>;
740
- export declare const disputeMissing: (ctx: HandlerContext, id: string) => Response;
741
- export declare const designMissing: (ctx: HandlerContext, id: string) => Response;
742
- export declare function review(action: 'activate' | 'deactivate' | 'reject', operationId: string): Handler;
743
- /**
744
- * Create a refund and land it on its charge. An omitted amount is the whole remaining balance. The
745
- * charge's write records `charge.refunded`, the event Stripe sends carrying the charge's new totals;
746
- * `refunded` is true only at the full amount.
747
- */
748
- /** A reason Stripe does not take (docs.stripe.com/api/refunds/create#create_refund-reason). */
749
- export declare function badReason(ctx: HandlerContext): Response;
750
- /** A bank-transfer payment refunded with origin=customer_balance goes back to the cash balance
751
- * (docs.stripe.com/payments/customer-balance/refunding). */
752
- export declare function backToCashBalance(ctx: HandlerContext, customer: string, currency: string, amount: number, refundId: string): Promise<void>;
753
- /** A capture=false charge's refund, which releases its whole authorization (see the header). */
754
- export declare function refundUncaptured(ctx: HandlerContext, charge: Row, amount: number, remaining: number, params: Row): Promise<Response>;
755
- export declare function refundCharge(ctx: HandlerContext, charge: Row, params: Row): Promise<Response>;
756
508
  /** Time's settling of held refunds, caught up to the World's clock: each refund held for want of balance, oldest first,
757
509
  * is made at the first moment the account's available balance covers it (the funds that come due then), its debit
758
510
  * written then, as `refund.updated`. Where the documentation stops and the twin decides: a held refund is made the
759
511
  * moment the balance covers it. */
760
512
  export declare function settleHeldRefunds(ctx: HandlerContext): Promise<void>;
761
- /** The charge a refund aims at: named directly, or reached through its PaymentIntent. */
762
- export declare function target(ctx: HandlerContext): Row | Response;
763
- export declare const refundMissing: (ctx: HandlerContext, id: string) => Response;
764
- /** Each advancing clock whose advance has taken its time reaches its target, caught up before anything is answered:
765
- * its frozen_time moves, it is ready, and its customers' trials and periods that ended by then end
766
- * (./renewals.ts advanceBilling). The advance's own write is when it began (the kernel's updatedAt). */
767
- export declare function finishClockAdvances(ctx: HandlerContext): Promise<void>;
768
- /** What the platform saved, or the settings a new platform starts with (OAuth off, no redirect URI). */
769
- export declare function connectOAuthSettings(ctx: Pick<HandlerContext, 'rowsRaw'>): ConnectOAuthSettings;
513
+ /** A pending refund can enter this surface only through the vendor-backed refund refresh. */
514
+ export declare function settleOneHeldRefund(ctx: HandlerContext, r: Row, now: number): Promise<void>;
770
515
  export declare const accountMissing: (ctx: HandlerContext, id: string, status?: number) => Response;
771
516
  /** The account, tombstones included where the hand-written routes looked past a deletion. */
772
517
  export declare const accountRow: (ctx: HandlerContext, id: string) => Row | undefined;
@@ -777,67 +522,12 @@ export declare const accountRow: (ctx: HandlerContext, id: string) => Row | unde
777
522
  export declare function connectReview(ctx: HandlerContext, id: string): Promise<void>;
778
523
  /** The review of a Custom account (see review). */
779
524
  export declare function reviewCustom(ctx: HandlerContext, id: string, account: Row): Promise<void>;
780
- export declare const personMissing: (ctx: HandlerContext) => Response;
781
- export declare const accountPerson: (ctx: HandlerContext) => Row | undefined;
782
- export declare const externalMissing: (ctx: HandlerContext) => Response;
783
- export declare const accountExternal: (ctx: HandlerContext) => Row | undefined;
784
- /** Whether the platform may create, update or delete an account's external accounts: "A platform can create, update, or
785
- * delete external accounts only for connected accounts without access to either the full Stripe or Express Dashboard
786
- * and where the platform is responsible for negative balances" (docs.stripe.com/connect/payouts-bank-accounts); it can
787
- * still view an Express account's ("A platform can view the external accounts of connected accounts that don’t have
788
- * access to the full Stripe Dashboard"). Where the documentation stops and the twin decides: the refusal. Stripe's
789
- * pages give no error code for it; the twin answers 403, which the errors page gives as "The API key doesn’t have
790
- * permissions to perform the request" (docs.stripe.com/api/errors), with the twin's own wording. The create page says
791
- * it too: "You can only specify connected accounts where account.controller.requirement_collection is `application`"
792
- * (docs.stripe.com/api/external_account_bank_accounts/create). */
793
- export declare function refuseExternalWrite(ctx: HandlerContext, account: string): Response | undefined;
794
- /** Update and delete by id, finding tombstones as the hand-written routes did, with Stripe's own operation names. */
795
- export declare function patch(resource: string, param: string, missing: string, op: string): Handler;
796
- export declare function patchRow(ctx: HandlerContext, resource: string, param: string, missing: string, op: string): Promise<Response>;
797
- export declare const updateReader: Handler;
798
- export declare function remove(resource: string, param: string, missing: string, op: string, object: string): Handler;
799
- export declare const readerMissing: (ctx: HandlerContext, id: string) => Response;
800
- /** A card presented to a reader with no payment in progress. */
801
- export declare function nothingToPresent(ctx: HandlerContext): Response;
802
- /** Under manual capture the presented card only holds the amount (docs.stripe.com/terminal/payments/collect-card-payment#capture-payment):
803
- * the hold is an uncaptured charge, as an online authorization's is (authorizeCharge), which the intent's capture takes. */
804
- export declare function holdForCapture(ctx: HandlerContext, piId: string, pi: Record<string, unknown>, pm: string, amount: number): Promise<void>;
805
- /** Time's settling of top-ups, caught up to the World's clock: a pending top-up succeeds on its expected_availability_date,
806
- * its funds entered then in the balance it names. */
807
- export declare function settleTopups(ctx: HandlerContext): Promise<void>;
808
- export declare const disputesDisputeMissing: (ctx: HandlerContext, id: string) => Response;
809
- /** Evidence staged without submitting it (submit=false), or on a dispute already under review or decided. */
810
- export declare function keepEvidence(ctx: HandlerContext, id: string, fields: Row): Promise<Response>;
811
- export declare const meterMissing: (ctx: HandlerContext, id: string) => Response;
812
- export declare function activation(kind: 'deactivate' | 'reactivate'): Handler;
813
- export declare const grantMissing: (ctx: HandlerContext, id: string) => Response;
814
- export declare function endGrant(kind: 'expire' | 'void'): Handler;
815
- export declare function alertMove(kind: 'activate' | 'deactivate' | 'archive', operationId: string): Handler;
816
- export declare const transferMissing: (ctx: HandlerContext, id: string) => Response;
817
525
  /** A transfer to an account whose transfers capability is not active. */
818
526
  export declare function transfersInactive(ctx: HandlerContext): Response;
819
527
  /** A transfer from a charge whose funds have settled: "With a source_transaction, the transfer request returns success
820
528
  * regardless of your available balance if the related charge hasn't settled yet" (docs.stripe.com/connect/separate-
821
529
  * charges-and-transfers), so a settled one comes out of the available balance. */
822
530
  export declare function settledSourceRefused(ctx: HandlerContext, amount: number, currency: string): Response | undefined;
823
- /** An application fee refunded to its whole through its own refunds endpoint: the fee machine's move, or its refusal. */
824
- export declare function feeFullyRefunded(ctx: HandlerContext, resource: string, flag: string, id: string): Response | undefined;
825
- /** Take `amount` (the remainder by default) back out of a parent's total, as a child row appended to its list. */
826
- export declare function giveBack(ctx: HandlerContext, o: {
827
- parent: Row;
828
- parentResource: string;
829
- child: string;
830
- childFields: (amount: number) => Row;
831
- childDefaults: Row;
832
- doneField: string;
833
- flag: string;
834
- listUrl: string;
835
- op: string;
836
- tooLarge: (remaining: number) => string;
837
- /** what the money movement itself writes, once the child exists */
838
- settle?: (child: Row, amount: number) => Promise<void>;
839
- }): Promise<Response>;
840
- export declare const feeMissing: (ctx: HandlerContext, id: string) => Response;
841
531
  /** An earlier version's payment_method_types refused: the first value that names no payment method type the
842
532
  * operation takes, in the intent's words or (a Checkout Session) the enum's. */
843
533
  export declare function unknownMethodType(ctx: HandlerContext, opId: string, given: unknown): Response | undefined;
@@ -845,13 +535,51 @@ export declare function unknownMethodType(ctx: HandlerContext, opId: string, giv
845
535
  export declare const noLongerSupported: (ctx: HandlerContext, version: string) => Response;
846
536
  /** Stripe's refusal of a request whose top-level parameters the operation does not take, or undefined. */
847
537
  export declare function refuseParameters(ctx: HandlerContext): Response | undefined;
848
- /** A file's links, kept in step with the links made to it, at the address Stripe lists them
849
- * (/v1/file_links?file=…, the File object's example). */
850
- export declare function syncLinks(ctx: HandlerContext, fileId: string): Promise<void>;
851
- export declare const calcMissing: (ctx: HandlerContext, id: string) => Response;
852
- /** A page of the line items a stored object carries. */
853
- export declare function taxLinePage(ctx: HandlerContext, holder: Row): Response;
854
- export declare const txMissing: (ctx: HandlerContext, id: string, status?: number) => Response;
855
538
  /** An answer in the shape of the API version the caller is served (./version.ts), a webhook endpoint's `secret` shown
856
539
  * only at its creation ("Only returned at creation", docs.stripe.com/api/webhook_endpoints/object). */
857
540
  export declare function rendered(request: Request, res: Response): Promise<Response>;
541
+ /** Write a draft's line list and the totals derived from it. */
542
+ export declare function writeLines(ctx: HandlerContext, invoiceId: string, next: Row[]): Promise<Row>;
543
+ /** A customer's pending invoice item, made before the invoice, pulled onto it (docs.stripe.com/api/invoices/create#create_invoice-pending_invoice_items_behavior). */
544
+ export declare function pullPendingItem(ctx: HandlerContext, invoiceId: string, inv: Row, item: Row, now: number): Promise<void>;
545
+ /** The intent the path names, and the machine's refusal when this operation may not move it. */
546
+ export declare function paymentIntentsLoad(ctx: HandlerContext, operationId: string): {
547
+ pi: Record<string, unknown>;
548
+ } | {
549
+ answer: Response;
550
+ };
551
+ /** A transfer reversal's two entries: back into the platform's balance, out of the destination's. */
552
+ export declare function settleTransferReversal(ctx: HandlerContext, reversalId: string, amount: number, currency: string, destination: string): Promise<string>;
553
+ /** A capture=false charge refunded while uncaptured: its authorization is released by the refund, as it would be
554
+ * "automatically refunded if uncaptured" (spec/openapi.json.gz, `capture_before`). The charge stays uncaptured and
555
+ * becomes refunded in full, a Refund records the release, and no money moves: none was ever received. Written as
556
+ * charge.refunded. Where the documentation stops and the twin decides: Stripe's basil change ("Partially capturing or
557
+ * canceling payments no longer creates a Refund", docs.stripe.com/changelog/basil/2025-03-31/remove-refund-from-partial-
558
+ * capture-and-payment-cancellation-flow) names partial capture and cancellation, not a refund asked for, so a refund
559
+ * still makes one; its reason is null and it has no balance transaction. Answers the Refund. */
560
+ export declare function releaseAuthorization(ctx: HandlerContext, ch: Row, operationId: string, given?: Row): Promise<Row>;
561
+ /** A PaymentIntent's authorization released by its cancel: "For PaymentIntents with a `status` of `requires_capture`, the
562
+ * remaining `amount_capturable` is automatically refunded" (docs.stripe.com/api/payment_intents/cancel), and since basil
563
+ * a cancellation makes no Refund: "`amount_captured` will be 0 instead of `nil` in payment cancellation flows",
564
+ * "`amount_refunded` will no longer be updated by these actions", "`refunded` will no longer be `true` for payment
565
+ * cancellation flows", and no charge.refunded is sent (docs.stripe.com/changelog/basil/2025-03-31/remove-refund-from-
566
+ * partial-capture-and-payment-cancellation-flow). The charge stays uncaptured; nothing is written as an event. */
567
+ export declare function cancelAuthorization(ctx: HandlerContext, ch: Row): Promise<Row>;
568
+ /**
569
+ * Create a refund and land it on its charge. An omitted amount is the whole remaining balance. The
570
+ * charge's write records `charge.refunded`, the event Stripe sends carrying the charge's new totals;
571
+ * `refunded` is true only at the full amount.
572
+ */
573
+ /** A reason Stripe does not take (docs.stripe.com/api/refunds/create#create_refund-reason). */
574
+ export declare function badReason(ctx: HandlerContext): Response;
575
+ /** A bank-transfer payment refunded with origin=customer_balance goes back to the cash balance
576
+ * (docs.stripe.com/payments/customer-balance/refunding). */
577
+ export declare function backToCashBalance(ctx: HandlerContext, customer: string, currency: string, amount: number, refundId: string): Promise<void>;
578
+ /** A capture=false charge's refund, which releases its whole authorization (see the header). */
579
+ export declare function refundUncaptured(ctx: HandlerContext, charge: Row, amount: number, remaining: number, params: Row): Promise<Response>;
580
+ export declare function refundCharge(ctx: HandlerContext, charge: Row, params: Row): Promise<Response>;
581
+ /** The charge a refund aims at: named directly, or reached through its PaymentIntent. */
582
+ export declare function target(ctx: HandlerContext): Row | Response;
583
+ /** A pending invoice item contributes to a preview only on its customer's next invoice. */
584
+ export declare function pendingPreviewItem(ii: Row, customer: string, currency: string, now: number): Row | undefined;
585
+ export declare function pendingPreviewLines(ctx: HandlerContext, customer: string, currency: string, now: number): Row[];