@fantastic.dev/better-stripe 0.41.0 → 0.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +1 -1
  3. package/dist/client/balanceFundingWorkflow/client.d.ts +172 -0
  4. package/dist/client/balanceFundingWorkflow/client.d.ts.map +1 -0
  5. package/dist/client/balanceFundingWorkflow/client.js +289 -0
  6. package/dist/client/balanceFundingWorkflow/client.js.map +1 -0
  7. package/dist/client/billing/balanceFunding.d.ts +5 -0
  8. package/dist/client/billing/balanceFunding.d.ts.map +1 -1
  9. package/dist/client/billing/balanceFunding.js +30 -0
  10. package/dist/client/billing/balanceFunding.js.map +1 -1
  11. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +1388 -2
  12. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  13. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +710 -17
  14. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  15. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +1420 -34
  16. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  17. package/dist/client/connect/payoutSyncTestHelpers.d.ts +694 -1
  18. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  19. package/dist/client/costRecovery-invoices.d.ts +3 -2
  20. package/dist/client/costRecovery-invoices.d.ts.map +1 -1
  21. package/dist/client/costRecovery-invoices.js +10 -5
  22. package/dist/client/costRecovery-invoices.js.map +1 -1
  23. package/dist/client/costRecovery.d.ts +4 -2
  24. package/dist/client/costRecovery.d.ts.map +1 -1
  25. package/dist/client/costRecovery.js +2 -2
  26. package/dist/client/costRecovery.js.map +1 -1
  27. package/dist/client/index.d.ts +3 -0
  28. package/dist/client/index.d.ts.map +1 -1
  29. package/dist/client/index.js +4 -0
  30. package/dist/client/index.js.map +1 -1
  31. package/dist/client/processingCostReconciliation/client.d.ts +14 -0
  32. package/dist/client/processingCostReconciliation/client.d.ts.map +1 -0
  33. package/dist/client/processingCostReconciliation/client.js +35 -0
  34. package/dist/client/processingCostReconciliation/client.js.map +1 -0
  35. package/dist/client/processingCostReconciliation/contracts.d.ts +172 -0
  36. package/dist/client/processingCostReconciliation/contracts.d.ts.map +1 -0
  37. package/dist/client/processingCostReconciliation/contracts.js +55 -0
  38. package/dist/client/processingCostReconciliation/contracts.js.map +1 -0
  39. package/dist/client/processingCostReconciliation/invoiceFunding.d.ts +15 -0
  40. package/dist/client/processingCostReconciliation/invoiceFunding.d.ts.map +1 -0
  41. package/dist/client/processingCostReconciliation/invoiceFunding.js +195 -0
  42. package/dist/client/processingCostReconciliation/invoiceFunding.js.map +1 -0
  43. package/dist/client/processingCostReconciliation/provider.d.ts +9 -0
  44. package/dist/client/processingCostReconciliation/provider.d.ts.map +1 -0
  45. package/dist/client/processingCostReconciliation/provider.js +148 -0
  46. package/dist/client/processingCostReconciliation/provider.js.map +1 -0
  47. package/dist/client/settlement/processingCostHistory.d.ts +12 -0
  48. package/dist/client/settlement/processingCostHistory.d.ts.map +1 -0
  49. package/dist/client/settlement/processingCostHistory.js +20 -0
  50. package/dist/client/settlement/processingCostHistory.js.map +1 -0
  51. package/dist/client/settlement/processingCosts.d.ts +3 -0
  52. package/dist/client/settlement/processingCosts.d.ts.map +1 -1
  53. package/dist/client/settlement/processingCosts.js +27 -7
  54. package/dist/client/settlement/processingCosts.js.map +1 -1
  55. package/dist/component/_generated/api.d.ts +36 -0
  56. package/dist/component/_generated/api.d.ts.map +1 -1
  57. package/dist/component/_generated/api.js.map +1 -1
  58. package/dist/component/_generated/component.d.ts +988 -0
  59. package/dist/component/_generated/component.d.ts.map +1 -1
  60. package/dist/component/balanceFunding/helpers.d.ts +42 -0
  61. package/dist/component/balanceFunding/helpers.d.ts.map +1 -1
  62. package/dist/component/balanceFunding/internal/actions.d.ts +39 -0
  63. package/dist/component/balanceFunding/internal/actions.d.ts.map +1 -0
  64. package/dist/component/balanceFunding/internal/actions.js +80 -0
  65. package/dist/component/balanceFunding/internal/actions.js.map +1 -0
  66. package/dist/component/balanceFunding/internal/mutations.d.ts +55 -0
  67. package/dist/component/balanceFunding/internal/mutations.d.ts.map +1 -0
  68. package/dist/component/balanceFunding/internal/mutations.js +54 -0
  69. package/dist/component/balanceFunding/internal/mutations.js.map +1 -0
  70. package/dist/component/balanceFunding/internal/queries.d.ts +116 -0
  71. package/dist/component/balanceFunding/internal/queries.d.ts.map +1 -0
  72. package/dist/component/balanceFunding/internal/queries.js +35 -0
  73. package/dist/component/balanceFunding/internal/queries.js.map +1 -0
  74. package/dist/component/balanceFunding/internal/workflow.d.ts +10 -0
  75. package/dist/component/balanceFunding/internal/workflow.d.ts.map +1 -0
  76. package/dist/component/balanceFunding/internal/workflow.js +31 -0
  77. package/dist/component/balanceFunding/internal/workflow.js.map +1 -0
  78. package/dist/component/balanceFunding/lifecycleHandlers.d.ts +126 -0
  79. package/dist/component/balanceFunding/lifecycleHandlers.d.ts.map +1 -1
  80. package/dist/component/balanceFunding/mutations.d.ts +419 -16
  81. package/dist/component/balanceFunding/mutations.d.ts.map +1 -1
  82. package/dist/component/balanceFunding/mutations.js +24 -0
  83. package/dist/component/balanceFunding/mutations.js.map +1 -1
  84. package/dist/component/balanceFunding/preparationHandlers.d.ts +42 -0
  85. package/dist/component/balanceFunding/preparationHandlers.d.ts.map +1 -1
  86. package/dist/component/balanceFunding/queries.d.ts +78 -0
  87. package/dist/component/balanceFunding/queries.d.ts.map +1 -1
  88. package/dist/component/balanceFunding/queries.js +35 -0
  89. package/dist/component/balanceFunding/queries.js.map +1 -1
  90. package/dist/component/balanceFunding/receipt.d.ts +5 -0
  91. package/dist/component/balanceFunding/receipt.d.ts.map +1 -0
  92. package/dist/component/balanceFunding/receipt.js +37 -0
  93. package/dist/component/balanceFunding/receipt.js.map +1 -0
  94. package/dist/component/balanceFunding/schema.d.ts +506 -2
  95. package/dist/component/balanceFunding/schema.d.ts.map +1 -1
  96. package/dist/component/balanceFunding/schema.js +2 -0
  97. package/dist/component/balanceFunding/schema.js.map +1 -1
  98. package/dist/component/balanceFunding/stateHandlers.d.ts +42 -0
  99. package/dist/component/balanceFunding/stateHandlers.d.ts.map +1 -1
  100. package/dist/component/balanceFunding/workflowControl.d.ts +19 -0
  101. package/dist/component/balanceFunding/workflowControl.d.ts.map +1 -0
  102. package/dist/component/balanceFunding/workflowControl.js +149 -0
  103. package/dist/component/balanceFunding/workflowControl.js.map +1 -0
  104. package/dist/component/balanceFunding/workflowSchema.d.ts +356 -0
  105. package/dist/component/balanceFunding/workflowSchema.d.ts.map +1 -0
  106. package/dist/component/balanceFunding/workflowSchema.js +48 -0
  107. package/dist/component/balanceFunding/workflowSchema.js.map +1 -0
  108. package/dist/component/balanceFunding/workflowState.d.ts +157 -0
  109. package/dist/component/balanceFunding/workflowState.d.ts.map +1 -0
  110. package/dist/component/balanceFunding/workflowState.js +194 -0
  111. package/dist/component/balanceFunding/workflowState.js.map +1 -0
  112. package/dist/component/balanceFunding/workflowValidators.d.ts +306 -0
  113. package/dist/component/balanceFunding/workflowValidators.d.ts.map +1 -0
  114. package/dist/component/balanceFunding/workflowValidators.js +27 -0
  115. package/dist/component/balanceFunding/workflowValidators.js.map +1 -0
  116. package/dist/component/earnings/triggers.d.ts +388 -2
  117. package/dist/component/earnings/triggers.d.ts.map +1 -1
  118. package/dist/component/payoutRelease/queries.d.ts +2 -2
  119. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  120. package/dist/component/processingCostReconciliation/adoption.d.ts +29 -0
  121. package/dist/component/processingCostReconciliation/adoption.d.ts.map +1 -0
  122. package/dist/component/processingCostReconciliation/adoption.js +58 -0
  123. package/dist/component/processingCostReconciliation/adoption.js.map +1 -0
  124. package/dist/component/processingCostReconciliation/bridge.d.ts +45 -0
  125. package/dist/component/processingCostReconciliation/bridge.d.ts.map +1 -0
  126. package/dist/component/processingCostReconciliation/bridge.js +41 -0
  127. package/dist/component/processingCostReconciliation/bridge.js.map +1 -0
  128. package/dist/component/processingCostReconciliation/helpers.d.ts +327 -0
  129. package/dist/component/processingCostReconciliation/helpers.d.ts.map +1 -0
  130. package/dist/component/processingCostReconciliation/helpers.js +39 -0
  131. package/dist/component/processingCostReconciliation/helpers.js.map +1 -0
  132. package/dist/component/processingCostReconciliation/mutations.d.ts +303 -0
  133. package/dist/component/processingCostReconciliation/mutations.d.ts.map +1 -0
  134. package/dist/component/processingCostReconciliation/mutations.js +121 -0
  135. package/dist/component/processingCostReconciliation/mutations.js.map +1 -0
  136. package/dist/component/processingCostReconciliation/queries.d.ts +422 -0
  137. package/dist/component/processingCostReconciliation/queries.d.ts.map +1 -0
  138. package/dist/component/processingCostReconciliation/queries.js +19 -0
  139. package/dist/component/processingCostReconciliation/queries.js.map +1 -0
  140. package/dist/component/processingCostReconciliation/rollback.d.ts +21 -0
  141. package/dist/component/processingCostReconciliation/rollback.d.ts.map +1 -0
  142. package/dist/component/processingCostReconciliation/rollback.js +54 -0
  143. package/dist/component/processingCostReconciliation/rollback.js.map +1 -0
  144. package/dist/component/processingCostReconciliation/schema.d.ts +2460 -0
  145. package/dist/component/processingCostReconciliation/schema.d.ts.map +1 -0
  146. package/dist/component/processingCostReconciliation/schema.js +137 -0
  147. package/dist/component/processingCostReconciliation/schema.js.map +1 -0
  148. package/dist/component/processingCostReconciliation/steps.d.ts +306 -0
  149. package/dist/component/processingCostReconciliation/steps.d.ts.map +1 -0
  150. package/dist/component/processingCostReconciliation/steps.js +149 -0
  151. package/dist/component/processingCostReconciliation/steps.js.map +1 -0
  152. package/dist/component/processingCostReconciliation/validation.d.ts +13 -0
  153. package/dist/component/processingCostReconciliation/validation.d.ts.map +1 -0
  154. package/dist/component/processingCostReconciliation/validation.js +61 -0
  155. package/dist/component/processingCostReconciliation/validation.js.map +1 -0
  156. package/dist/component/processingCostReconciliation/workflow.d.ts +105 -0
  157. package/dist/component/processingCostReconciliation/workflow.d.ts.map +1 -0
  158. package/dist/component/processingCostReconciliation/workflow.js +33 -0
  159. package/dist/component/processingCostReconciliation/workflow.js.map +1 -0
  160. package/dist/component/schema.d.ts +694 -1
  161. package/dist/component/schema.js +2 -0
  162. package/dist/component/schema.js.map +1 -1
  163. package/package.json +1 -1
  164. package/src/client/balanceFundingWorkflow/capture.test.ts +144 -0
  165. package/src/client/balanceFundingWorkflow/client.ts +419 -0
  166. package/src/client/billing/balanceFunding.ts +50 -0
  167. package/src/client/costRecovery-invoices.ts +19 -4
  168. package/src/client/costRecovery.ts +4 -2
  169. package/src/client/index.ts +15 -0
  170. package/src/client/processingCostReconciliation/client.ts +75 -0
  171. package/src/client/processingCostReconciliation/contracts.ts +176 -0
  172. package/src/client/processingCostReconciliation/invoiceFunding.ts +270 -0
  173. package/src/client/processingCostReconciliation/invoiceProvider.test.ts +353 -0
  174. package/src/client/processingCostReconciliation/provider.test.ts +324 -0
  175. package/src/client/processingCostReconciliation/provider.ts +178 -0
  176. package/src/client/settlement/processingCostHistory.ts +31 -0
  177. package/src/client/settlement/processingCosts.ts +50 -15
  178. package/src/component/_generated/api.ts +36 -0
  179. package/src/component/_generated/component.ts +1094 -0
  180. package/src/component/balanceFunding/internal/actions.ts +107 -0
  181. package/src/component/balanceFunding/internal/mutations.ts +66 -0
  182. package/src/component/balanceFunding/internal/queries.ts +34 -0
  183. package/src/component/balanceFunding/internal/workflow.ts +49 -0
  184. package/src/component/balanceFunding/mutations.ts +34 -0
  185. package/src/component/balanceFunding/queries.ts +38 -0
  186. package/src/component/balanceFunding/receipt.ts +48 -0
  187. package/src/component/balanceFunding/schema.ts +2 -0
  188. package/src/component/balanceFunding/scopeLookup.test.ts +94 -0
  189. package/src/component/balanceFunding/workflow.fixtures.ts +366 -0
  190. package/src/component/balanceFunding/workflow.test.ts +552 -0
  191. package/src/component/balanceFunding/workflowControl.ts +198 -0
  192. package/src/component/balanceFunding/workflowSchema.ts +78 -0
  193. package/src/component/balanceFunding/workflowState.ts +285 -0
  194. package/src/component/balanceFunding/workflowValidators.ts +40 -0
  195. package/src/component/processingCostReconciliation/adoption.test.ts +206 -0
  196. package/src/component/processingCostReconciliation/adoption.ts +77 -0
  197. package/src/component/processingCostReconciliation/bridge.ts +50 -0
  198. package/src/component/processingCostReconciliation/helpers.ts +55 -0
  199. package/src/component/processingCostReconciliation/invoice.test.ts +152 -0
  200. package/src/component/processingCostReconciliation/mutations.ts +148 -0
  201. package/src/component/processingCostReconciliation/queries.ts +18 -0
  202. package/src/component/processingCostReconciliation/rollback.ts +72 -0
  203. package/src/component/processingCostReconciliation/schema.ts +191 -0
  204. package/src/component/processingCostReconciliation/state.test.ts +407 -0
  205. package/src/component/processingCostReconciliation/steps.ts +168 -0
  206. package/src/component/processingCostReconciliation/validation.ts +79 -0
  207. package/src/component/processingCostReconciliation/workflow.test.ts +329 -0
  208. package/src/component/processingCostReconciliation/workflow.ts +50 -0
  209. package/src/component/schema.ts +2 -0
@@ -9,6 +9,517 @@ export declare const scope: {
9
9
  };
10
10
  export declare function setup(amounts?: number[], currency?: string): Promise<{
11
11
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
12
+ processingCostReconciliationOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
13
+ accountId: string;
14
+ claimKey: string;
15
+ currency: string;
16
+ definitionVersion: number;
17
+ expectedRevision: number;
18
+ failure?: {
19
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
20
+ retryable: true;
21
+ status: "not_ready";
22
+ } | {
23
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
24
+ retryable: false;
25
+ status: "conflict";
26
+ } | {
27
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
28
+ retryable: false;
29
+ status: "rejected";
30
+ } | {
31
+ reason: "history_incomplete" | "provider_outcome_unknown";
32
+ retryable: false;
33
+ status: "unknown";
34
+ } | undefined;
35
+ importHook?: string | undefined;
36
+ maxAttempts: number;
37
+ policy: {
38
+ liability: {
39
+ disputeCosts: "all" | "none";
40
+ processingCosts: "all" | "none" | "uncovered";
41
+ };
42
+ rounding: "ceil" | "floor" | "nearest";
43
+ sellingFee: number;
44
+ };
45
+ projection?: string | undefined;
46
+ provider: string;
47
+ providerApiVersion: string;
48
+ requestKey: string;
49
+ result?: {
50
+ claim: {
51
+ _creationTime: number;
52
+ _id: import("convex/values").GenericId<"recoveryClaims">;
53
+ accountId: string;
54
+ amountDue: number;
55
+ claimKey: string;
56
+ collectedAmount: number;
57
+ currency: string;
58
+ openingCollection?: {
59
+ amountDue: number;
60
+ collectedAmount: number;
61
+ operationKey: string;
62
+ revision: number;
63
+ } | undefined;
64
+ outstanding: number;
65
+ reservedAmount: number;
66
+ revision: number;
67
+ scopeKey: string;
68
+ sign: "negative" | "positive" | "zero";
69
+ sourceChargeId: string;
70
+ sourceGross: number;
71
+ sourceProcessingFee: number;
72
+ };
73
+ deficit: {
74
+ amountDue: number;
75
+ currency: string;
76
+ disputeLiability: number;
77
+ processingLiability: number;
78
+ retainedFee: number;
79
+ };
80
+ observation: {
81
+ currency: string;
82
+ disputeFees: number;
83
+ gross: number;
84
+ originalProcessingFee: number;
85
+ paymentIntentId: string;
86
+ principalReturned: number;
87
+ processingFee: number;
88
+ provenance: {
89
+ customerAccountId: string;
90
+ invoiceId: string;
91
+ invoicePaymentId: string;
92
+ recoveryInvoiceItemId?: string | undefined;
93
+ stripePriceId?: string | undefined;
94
+ stripeProductId?: string | undefined;
95
+ subscriptionId?: string | undefined;
96
+ };
97
+ sourceChargeId: string;
98
+ };
99
+ rollbackClaim?: {
100
+ _creationTime: number;
101
+ _id: import("convex/values").GenericId<"recoveryClaims">;
102
+ accountId: string;
103
+ amountDue: number;
104
+ claimKey: string;
105
+ collectedAmount: number;
106
+ currency: string;
107
+ openingCollection?: {
108
+ amountDue: number;
109
+ collectedAmount: number;
110
+ operationKey: string;
111
+ revision: number;
112
+ } | undefined;
113
+ outstanding: number;
114
+ reservedAmount: number;
115
+ revision: number;
116
+ scopeKey: string;
117
+ sign: "negative" | "positive" | "zero";
118
+ sourceChargeId: string;
119
+ sourceGross: number;
120
+ sourceProcessingFee: number;
121
+ } | undefined;
122
+ } | undefined;
123
+ retryDelayMs: number;
124
+ rollback?: {
125
+ expectedRevision: number;
126
+ groupKey: string;
127
+ } | undefined;
128
+ scopeKey: string;
129
+ source: {
130
+ customerAccountId: string;
131
+ gross: number;
132
+ invoiceId?: string | undefined;
133
+ kind: "sale";
134
+ paymentIntentId: string;
135
+ stripeAccountId?: string | undefined;
136
+ stripePriceId?: string | undefined;
137
+ stripeProductId?: string | undefined;
138
+ subscriptionId?: string | undefined;
139
+ } | {
140
+ gross: number;
141
+ groupKey: string;
142
+ kind: "invoice_recovery";
143
+ paymentIntentId: string;
144
+ };
145
+ status: "completed" | "conflict" | "queued" | "rejected" | "running" | "unknown" | "waiting";
146
+ version: number;
147
+ workflowId?: string | undefined;
148
+ }, {
149
+ accountId: import("convex/values").VString<string, "required">;
150
+ scopeKey: import("convex/values").VString<string, "required">;
151
+ currency: import("convex/values").VString<string, "required">;
152
+ claimKey: import("convex/values").VString<string, "required">;
153
+ source: import("convex/values").VUnion<{
154
+ customerAccountId: string;
155
+ gross: number;
156
+ invoiceId?: string | undefined;
157
+ kind: "sale";
158
+ paymentIntentId: string;
159
+ stripeAccountId?: string | undefined;
160
+ stripePriceId?: string | undefined;
161
+ stripeProductId?: string | undefined;
162
+ subscriptionId?: string | undefined;
163
+ } | {
164
+ gross: number;
165
+ groupKey: string;
166
+ kind: "invoice_recovery";
167
+ paymentIntentId: string;
168
+ }, [import("convex/values").VObject<{
169
+ customerAccountId: string;
170
+ gross: number;
171
+ invoiceId?: string | undefined;
172
+ kind: "sale";
173
+ paymentIntentId: string;
174
+ stripeAccountId?: string | undefined;
175
+ stripePriceId?: string | undefined;
176
+ stripeProductId?: string | undefined;
177
+ subscriptionId?: string | undefined;
178
+ }, {
179
+ kind: import("convex/values").VLiteral<"sale", "required">;
180
+ paymentIntentId: import("convex/values").VString<string, "required">;
181
+ gross: import("convex/values").VFloat64<number, "required">;
182
+ customerAccountId: import("convex/values").VString<string, "required">;
183
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
184
+ subscriptionId: import("convex/values").VString<string | undefined, "optional">;
185
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
186
+ stripePriceId: import("convex/values").VString<string | undefined, "optional">;
187
+ stripeProductId: import("convex/values").VString<string | undefined, "optional">;
188
+ }, "required", "customerAccountId" | "gross" | "invoiceId" | "kind" | "paymentIntentId" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId">, import("convex/values").VObject<{
189
+ gross: number;
190
+ groupKey: string;
191
+ kind: "invoice_recovery";
192
+ paymentIntentId: string;
193
+ }, {
194
+ kind: import("convex/values").VLiteral<"invoice_recovery", "required">;
195
+ paymentIntentId: import("convex/values").VString<string, "required">;
196
+ gross: import("convex/values").VFloat64<number, "required">;
197
+ groupKey: import("convex/values").VString<string, "required">;
198
+ }, "required", "gross" | "groupKey" | "kind" | "paymentIntentId">], "required", "customerAccountId" | "gross" | "groupKey" | "invoiceId" | "kind" | "paymentIntentId" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId">;
199
+ policy: import("convex/values").VObject<{
200
+ liability: {
201
+ disputeCosts: "all" | "none";
202
+ processingCosts: "all" | "none" | "uncovered";
203
+ };
204
+ rounding: "ceil" | "floor" | "nearest";
205
+ sellingFee: number;
206
+ }, {
207
+ sellingFee: import("convex/values").VFloat64<number, "required">;
208
+ liability: import("convex/values").VObject<{
209
+ disputeCosts: "all" | "none";
210
+ processingCosts: "all" | "none" | "uncovered";
211
+ }, {
212
+ processingCosts: import("convex/values").VUnion<"all" | "none" | "uncovered", [import("convex/values").VLiteral<"uncovered", "required">, import("convex/values").VLiteral<"all", "required">, import("convex/values").VLiteral<"none", "required">], "required", never>;
213
+ disputeCosts: import("convex/values").VUnion<"all" | "none", [import("convex/values").VLiteral<"all", "required">, import("convex/values").VLiteral<"none", "required">], "required", never>;
214
+ }, "required", "disputeCosts" | "processingCosts">;
215
+ rounding: import("convex/values").VUnion<"ceil" | "floor" | "nearest", [import("convex/values").VLiteral<"nearest", "required">, import("convex/values").VLiteral<"floor", "required">, import("convex/values").VLiteral<"ceil", "required">], "required", never>;
216
+ }, "required", "liability" | "liability.disputeCosts" | "liability.processingCosts" | "rounding" | "sellingFee">;
217
+ expectedRevision: import("convex/values").VFloat64<number, "required">;
218
+ rollback: import("convex/values").VObject<{
219
+ expectedRevision: number;
220
+ groupKey: string;
221
+ } | undefined, {
222
+ groupKey: import("convex/values").VString<string, "required">;
223
+ expectedRevision: import("convex/values").VFloat64<number, "required">;
224
+ }, "optional", "expectedRevision" | "groupKey">;
225
+ provider: import("convex/values").VString<string, "required">;
226
+ projection: import("convex/values").VString<string | undefined, "optional">;
227
+ importHook: import("convex/values").VString<string | undefined, "optional">;
228
+ providerApiVersion: import("convex/values").VString<string, "required">;
229
+ definitionVersion: import("convex/values").VFloat64<number, "required">;
230
+ maxAttempts: import("convex/values").VFloat64<number, "required">;
231
+ retryDelayMs: import("convex/values").VFloat64<number, "required">;
232
+ requestKey: import("convex/values").VString<string, "required">;
233
+ version: import("convex/values").VFloat64<number, "required">;
234
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
235
+ status: import("convex/values").VUnion<"completed" | "conflict" | "queued" | "rejected" | "running" | "unknown" | "waiting", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"waiting", "required">, import("convex/values").VLiteral<"completed", "required">, import("convex/values").VLiteral<"conflict", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">], "required", never>;
236
+ failure: import("convex/values").VUnion<{
237
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
238
+ retryable: true;
239
+ status: "not_ready";
240
+ } | {
241
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
242
+ retryable: false;
243
+ status: "conflict";
244
+ } | {
245
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
246
+ retryable: false;
247
+ status: "rejected";
248
+ } | {
249
+ reason: "history_incomplete" | "provider_outcome_unknown";
250
+ retryable: false;
251
+ status: "unknown";
252
+ } | undefined, [import("convex/values").VObject<{
253
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
254
+ retryable: true;
255
+ status: "not_ready";
256
+ }, {
257
+ status: import("convex/values").VLiteral<"not_ready", "required">;
258
+ reason: import("convex/values").VUnion<"fee_pending" | "history_incomplete" | "provider_pending", [import("convex/values").VLiteral<"provider_pending", "required">, import("convex/values").VLiteral<"fee_pending", "required">, import("convex/values").VLiteral<"history_incomplete", "required">], "required", never>;
259
+ retryable: import("convex/values").VLiteral<true, "required">;
260
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
261
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
262
+ retryable: false;
263
+ status: "conflict";
264
+ }, {
265
+ status: import("convex/values").VLiteral<"conflict", "required">;
266
+ reason: import("convex/values").VUnion<"identity_changed" | "revision_changed" | "scope_busy", [import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"revision_changed", "required">, import("convex/values").VLiteral<"identity_changed", "required">], "required", never>;
267
+ retryable: import("convex/values").VLiteral<false, "required">;
268
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
269
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
270
+ retryable: false;
271
+ status: "rejected";
272
+ }, {
273
+ status: import("convex/values").VLiteral<"rejected", "required">;
274
+ reason: import("convex/values").VUnion<"currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source", [import("convex/values").VLiteral<"invalid_scope", "required">, import("convex/values").VLiteral<"unsupported_source", "required">, import("convex/values").VLiteral<"policy_invalid", "required">, import("convex/values").VLiteral<"payment_not_payable", "required">, import("convex/values").VLiteral<"currency_mismatch", "required">], "required", never>;
275
+ retryable: import("convex/values").VLiteral<false, "required">;
276
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
277
+ reason: "history_incomplete" | "provider_outcome_unknown";
278
+ retryable: false;
279
+ status: "unknown";
280
+ }, {
281
+ status: import("convex/values").VLiteral<"unknown", "required">;
282
+ reason: import("convex/values").VUnion<"history_incomplete" | "provider_outcome_unknown", [import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"history_incomplete", "required">], "required", never>;
283
+ retryable: import("convex/values").VLiteral<false, "required">;
284
+ }, "required", "reason" | "retryable" | "status">], "optional", "reason" | "retryable" | "status">;
285
+ result: import("convex/values").VObject<{
286
+ claim: {
287
+ _creationTime: number;
288
+ _id: import("convex/values").GenericId<"recoveryClaims">;
289
+ accountId: string;
290
+ amountDue: number;
291
+ claimKey: string;
292
+ collectedAmount: number;
293
+ currency: string;
294
+ openingCollection?: {
295
+ amountDue: number;
296
+ collectedAmount: number;
297
+ operationKey: string;
298
+ revision: number;
299
+ } | undefined;
300
+ outstanding: number;
301
+ reservedAmount: number;
302
+ revision: number;
303
+ scopeKey: string;
304
+ sign: "negative" | "positive" | "zero";
305
+ sourceChargeId: string;
306
+ sourceGross: number;
307
+ sourceProcessingFee: number;
308
+ };
309
+ deficit: {
310
+ amountDue: number;
311
+ currency: string;
312
+ disputeLiability: number;
313
+ processingLiability: number;
314
+ retainedFee: number;
315
+ };
316
+ observation: {
317
+ currency: string;
318
+ disputeFees: number;
319
+ gross: number;
320
+ originalProcessingFee: number;
321
+ paymentIntentId: string;
322
+ principalReturned: number;
323
+ processingFee: number;
324
+ provenance: {
325
+ customerAccountId: string;
326
+ invoiceId: string;
327
+ invoicePaymentId: string;
328
+ recoveryInvoiceItemId?: string | undefined;
329
+ stripePriceId?: string | undefined;
330
+ stripeProductId?: string | undefined;
331
+ subscriptionId?: string | undefined;
332
+ };
333
+ sourceChargeId: string;
334
+ };
335
+ rollbackClaim?: {
336
+ _creationTime: number;
337
+ _id: import("convex/values").GenericId<"recoveryClaims">;
338
+ accountId: string;
339
+ amountDue: number;
340
+ claimKey: string;
341
+ collectedAmount: number;
342
+ currency: string;
343
+ openingCollection?: {
344
+ amountDue: number;
345
+ collectedAmount: number;
346
+ operationKey: string;
347
+ revision: number;
348
+ } | undefined;
349
+ outstanding: number;
350
+ reservedAmount: number;
351
+ revision: number;
352
+ scopeKey: string;
353
+ sign: "negative" | "positive" | "zero";
354
+ sourceChargeId: string;
355
+ sourceGross: number;
356
+ sourceProcessingFee: number;
357
+ } | undefined;
358
+ } | undefined, {
359
+ claim: import("convex/values").VObject<{
360
+ _creationTime: number;
361
+ _id: import("convex/values").GenericId<"recoveryClaims">;
362
+ accountId: string;
363
+ amountDue: number;
364
+ claimKey: string;
365
+ collectedAmount: number;
366
+ currency: string;
367
+ openingCollection?: {
368
+ amountDue: number;
369
+ collectedAmount: number;
370
+ operationKey: string;
371
+ revision: number;
372
+ } | undefined;
373
+ outstanding: number;
374
+ reservedAmount: number;
375
+ revision: number;
376
+ scopeKey: string;
377
+ sign: "negative" | "positive" | "zero";
378
+ sourceChargeId: string;
379
+ sourceGross: number;
380
+ sourceProcessingFee: number;
381
+ }, {
382
+ accountId: import("convex/values").VString<string, "required">;
383
+ scopeKey: import("convex/values").VString<string, "required">;
384
+ currency: import("convex/values").VString<string, "required">;
385
+ claimKey: import("convex/values").VString<string, "required">;
386
+ sourceChargeId: import("convex/values").VString<string, "required">;
387
+ sourceGross: import("convex/values").VFloat64<number, "required">;
388
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
389
+ amountDue: import("convex/values").VFloat64<number, "required">;
390
+ revision: import("convex/values").VFloat64<number, "required">;
391
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
392
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
393
+ outstanding: import("convex/values").VFloat64<number, "required">;
394
+ sign: import("convex/values").VUnion<"negative" | "positive" | "zero", [import("convex/values").VLiteral<"positive", "required">, import("convex/values").VLiteral<"negative", "required">, import("convex/values").VLiteral<"zero", "required">], "required", never>;
395
+ openingCollection: import("convex/values").VObject<{
396
+ amountDue: number;
397
+ collectedAmount: number;
398
+ operationKey: string;
399
+ revision: number;
400
+ } | undefined, {
401
+ operationKey: import("convex/values").VString<string, "required">;
402
+ amountDue: import("convex/values").VFloat64<number, "required">;
403
+ revision: import("convex/values").VFloat64<number, "required">;
404
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
405
+ }, "optional", "amountDue" | "collectedAmount" | "operationKey" | "revision">;
406
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
407
+ _creationTime: import("convex/values").VFloat64<number, "required">;
408
+ }, "required", "_creationTime" | "_id" | "accountId" | "amountDue" | "claimKey" | "collectedAmount" | "currency" | "openingCollection" | "openingCollection.amountDue" | "openingCollection.collectedAmount" | "openingCollection.operationKey" | "openingCollection.revision" | "outstanding" | "reservedAmount" | "revision" | "scopeKey" | "sign" | "sourceChargeId" | "sourceGross" | "sourceProcessingFee">;
409
+ rollbackClaim: import("convex/values").VObject<{
410
+ _creationTime: number;
411
+ _id: import("convex/values").GenericId<"recoveryClaims">;
412
+ accountId: string;
413
+ amountDue: number;
414
+ claimKey: string;
415
+ collectedAmount: number;
416
+ currency: string;
417
+ openingCollection?: {
418
+ amountDue: number;
419
+ collectedAmount: number;
420
+ operationKey: string;
421
+ revision: number;
422
+ } | undefined;
423
+ outstanding: number;
424
+ reservedAmount: number;
425
+ revision: number;
426
+ scopeKey: string;
427
+ sign: "negative" | "positive" | "zero";
428
+ sourceChargeId: string;
429
+ sourceGross: number;
430
+ sourceProcessingFee: number;
431
+ } | undefined, {
432
+ accountId: import("convex/values").VString<string, "required">;
433
+ scopeKey: import("convex/values").VString<string, "required">;
434
+ currency: import("convex/values").VString<string, "required">;
435
+ claimKey: import("convex/values").VString<string, "required">;
436
+ sourceChargeId: import("convex/values").VString<string, "required">;
437
+ sourceGross: import("convex/values").VFloat64<number, "required">;
438
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
439
+ amountDue: import("convex/values").VFloat64<number, "required">;
440
+ revision: import("convex/values").VFloat64<number, "required">;
441
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
442
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
443
+ outstanding: import("convex/values").VFloat64<number, "required">;
444
+ sign: import("convex/values").VUnion<"negative" | "positive" | "zero", [import("convex/values").VLiteral<"positive", "required">, import("convex/values").VLiteral<"negative", "required">, import("convex/values").VLiteral<"zero", "required">], "required", never>;
445
+ openingCollection: import("convex/values").VObject<{
446
+ amountDue: number;
447
+ collectedAmount: number;
448
+ operationKey: string;
449
+ revision: number;
450
+ } | undefined, {
451
+ operationKey: import("convex/values").VString<string, "required">;
452
+ amountDue: import("convex/values").VFloat64<number, "required">;
453
+ revision: import("convex/values").VFloat64<number, "required">;
454
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
455
+ }, "optional", "amountDue" | "collectedAmount" | "operationKey" | "revision">;
456
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
457
+ _creationTime: import("convex/values").VFloat64<number, "required">;
458
+ }, "optional", "_creationTime" | "_id" | "accountId" | "amountDue" | "claimKey" | "collectedAmount" | "currency" | "openingCollection" | "openingCollection.amountDue" | "openingCollection.collectedAmount" | "openingCollection.operationKey" | "openingCollection.revision" | "outstanding" | "reservedAmount" | "revision" | "scopeKey" | "sign" | "sourceChargeId" | "sourceGross" | "sourceProcessingFee">;
459
+ deficit: import("convex/values").VObject<{
460
+ amountDue: number;
461
+ currency: string;
462
+ disputeLiability: number;
463
+ processingLiability: number;
464
+ retainedFee: number;
465
+ }, {
466
+ currency: import("convex/values").VString<string, "required">;
467
+ retainedFee: import("convex/values").VFloat64<number, "required">;
468
+ processingLiability: import("convex/values").VFloat64<number, "required">;
469
+ disputeLiability: import("convex/values").VFloat64<number, "required">;
470
+ amountDue: import("convex/values").VFloat64<number, "required">;
471
+ }, "required", "amountDue" | "currency" | "disputeLiability" | "processingLiability" | "retainedFee">;
472
+ observation: import("convex/values").VObject<{
473
+ currency: string;
474
+ disputeFees: number;
475
+ gross: number;
476
+ originalProcessingFee: number;
477
+ paymentIntentId: string;
478
+ principalReturned: number;
479
+ processingFee: number;
480
+ provenance: {
481
+ customerAccountId: string;
482
+ invoiceId: string;
483
+ invoicePaymentId: string;
484
+ recoveryInvoiceItemId?: string | undefined;
485
+ stripePriceId?: string | undefined;
486
+ stripeProductId?: string | undefined;
487
+ subscriptionId?: string | undefined;
488
+ };
489
+ sourceChargeId: string;
490
+ }, {
491
+ paymentIntentId: import("convex/values").VString<string, "required">;
492
+ sourceChargeId: import("convex/values").VString<string, "required">;
493
+ currency: import("convex/values").VString<string, "required">;
494
+ gross: import("convex/values").VFloat64<number, "required">;
495
+ originalProcessingFee: import("convex/values").VFloat64<number, "required">;
496
+ processingFee: import("convex/values").VFloat64<number, "required">;
497
+ disputeFees: import("convex/values").VFloat64<number, "required">;
498
+ principalReturned: import("convex/values").VFloat64<number, "required">;
499
+ provenance: import("convex/values").VObject<{
500
+ customerAccountId: string;
501
+ invoiceId: string;
502
+ invoicePaymentId: string;
503
+ recoveryInvoiceItemId?: string | undefined;
504
+ stripePriceId?: string | undefined;
505
+ stripeProductId?: string | undefined;
506
+ subscriptionId?: string | undefined;
507
+ }, {
508
+ invoiceId: import("convex/values").VString<string, "required">;
509
+ invoicePaymentId: import("convex/values").VString<string, "required">;
510
+ recoveryInvoiceItemId: import("convex/values").VString<string | undefined, "optional">;
511
+ customerAccountId: import("convex/values").VString<string, "required">;
512
+ subscriptionId: import("convex/values").VString<string | undefined, "optional">;
513
+ stripePriceId: import("convex/values").VString<string | undefined, "optional">;
514
+ stripeProductId: import("convex/values").VString<string | undefined, "optional">;
515
+ }, "required", "customerAccountId" | "invoiceId" | "invoicePaymentId" | "recoveryInvoiceItemId" | "stripePriceId" | "stripeProductId" | "subscriptionId">;
516
+ }, "required", "currency" | "disputeFees" | "gross" | "originalProcessingFee" | "paymentIntentId" | "principalReturned" | "processingFee" | "provenance" | "provenance.customerAccountId" | "provenance.invoiceId" | "provenance.invoicePaymentId" | "provenance.recoveryInvoiceItemId" | "provenance.stripePriceId" | "provenance.stripeProductId" | "provenance.subscriptionId" | "sourceChargeId">;
517
+ }, "optional", "claim" | "claim._creationTime" | "claim._id" | "claim.accountId" | "claim.amountDue" | "claim.claimKey" | "claim.collectedAmount" | "claim.currency" | "claim.openingCollection" | "claim.openingCollection.amountDue" | "claim.openingCollection.collectedAmount" | "claim.openingCollection.operationKey" | "claim.openingCollection.revision" | "claim.outstanding" | "claim.reservedAmount" | "claim.revision" | "claim.scopeKey" | "claim.sign" | "claim.sourceChargeId" | "claim.sourceGross" | "claim.sourceProcessingFee" | "deficit" | "deficit.amountDue" | "deficit.currency" | "deficit.disputeLiability" | "deficit.processingLiability" | "deficit.retainedFee" | "observation" | "observation.currency" | "observation.disputeFees" | "observation.gross" | "observation.originalProcessingFee" | "observation.paymentIntentId" | "observation.principalReturned" | "observation.processingFee" | "observation.provenance" | "observation.provenance.customerAccountId" | "observation.provenance.invoiceId" | "observation.provenance.invoicePaymentId" | "observation.provenance.recoveryInvoiceItemId" | "observation.provenance.stripePriceId" | "observation.provenance.stripeProductId" | "observation.provenance.subscriptionId" | "observation.sourceChargeId" | "rollbackClaim" | "rollbackClaim._creationTime" | "rollbackClaim._id" | "rollbackClaim.accountId" | "rollbackClaim.amountDue" | "rollbackClaim.claimKey" | "rollbackClaim.collectedAmount" | "rollbackClaim.currency" | "rollbackClaim.openingCollection" | "rollbackClaim.openingCollection.amountDue" | "rollbackClaim.openingCollection.collectedAmount" | "rollbackClaim.openingCollection.operationKey" | "rollbackClaim.openingCollection.revision" | "rollbackClaim.outstanding" | "rollbackClaim.reservedAmount" | "rollbackClaim.revision" | "rollbackClaim.scopeKey" | "rollbackClaim.sign" | "rollbackClaim.sourceChargeId" | "rollbackClaim.sourceGross" | "rollbackClaim.sourceProcessingFee">;
518
+ }, "required", "accountId" | "claimKey" | "currency" | "definitionVersion" | "expectedRevision" | "failure" | "failure.reason" | "failure.retryable" | "failure.status" | "importHook" | "maxAttempts" | "policy" | "policy.liability" | "policy.liability.disputeCosts" | "policy.liability.processingCosts" | "policy.rounding" | "policy.sellingFee" | "projection" | "provider" | "providerApiVersion" | "requestKey" | "result" | "result.claim" | "result.claim._creationTime" | "result.claim._id" | "result.claim.accountId" | "result.claim.amountDue" | "result.claim.claimKey" | "result.claim.collectedAmount" | "result.claim.currency" | "result.claim.openingCollection" | "result.claim.openingCollection.amountDue" | "result.claim.openingCollection.collectedAmount" | "result.claim.openingCollection.operationKey" | "result.claim.openingCollection.revision" | "result.claim.outstanding" | "result.claim.reservedAmount" | "result.claim.revision" | "result.claim.scopeKey" | "result.claim.sign" | "result.claim.sourceChargeId" | "result.claim.sourceGross" | "result.claim.sourceProcessingFee" | "result.deficit" | "result.deficit.amountDue" | "result.deficit.currency" | "result.deficit.disputeLiability" | "result.deficit.processingLiability" | "result.deficit.retainedFee" | "result.observation" | "result.observation.currency" | "result.observation.disputeFees" | "result.observation.gross" | "result.observation.originalProcessingFee" | "result.observation.paymentIntentId" | "result.observation.principalReturned" | "result.observation.processingFee" | "result.observation.provenance" | "result.observation.provenance.customerAccountId" | "result.observation.provenance.invoiceId" | "result.observation.provenance.invoicePaymentId" | "result.observation.provenance.recoveryInvoiceItemId" | "result.observation.provenance.stripePriceId" | "result.observation.provenance.stripeProductId" | "result.observation.provenance.subscriptionId" | "result.observation.sourceChargeId" | "result.rollbackClaim" | "result.rollbackClaim._creationTime" | "result.rollbackClaim._id" | "result.rollbackClaim.accountId" | "result.rollbackClaim.amountDue" | "result.rollbackClaim.claimKey" | "result.rollbackClaim.collectedAmount" | "result.rollbackClaim.currency" | "result.rollbackClaim.openingCollection" | "result.rollbackClaim.openingCollection.amountDue" | "result.rollbackClaim.openingCollection.collectedAmount" | "result.rollbackClaim.openingCollection.operationKey" | "result.rollbackClaim.openingCollection.revision" | "result.rollbackClaim.outstanding" | "result.rollbackClaim.reservedAmount" | "result.rollbackClaim.revision" | "result.rollbackClaim.scopeKey" | "result.rollbackClaim.sign" | "result.rollbackClaim.sourceChargeId" | "result.rollbackClaim.sourceGross" | "result.rollbackClaim.sourceProcessingFee" | "retryDelayMs" | "rollback" | "rollback.expectedRevision" | "rollback.groupKey" | "scopeKey" | "source" | "source.customerAccountId" | "source.gross" | "source.groupKey" | "source.invoiceId" | "source.kind" | "source.paymentIntentId" | "source.stripeAccountId" | "source.stripePriceId" | "source.stripeProductId" | "source.subscriptionId" | "status" | "version" | "workflowId">, {
519
+ by_claim_status: ["claimKey", "status", "_creationTime"];
520
+ by_payment_scope: ["accountId", "scopeKey", "currency", "source.paymentIntentId", "_creationTime"];
521
+ by_request: ["requestKey", "_creationTime"];
522
+ }, {}, {}>;
12
523
  recoveryWorkflowOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
13
524
  accountId: string;
14
525
  activePhase?: "execute" | "reconcile" | undefined;
@@ -281,6 +792,48 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
281
792
  accountId: string;
282
793
  cancelRequested: boolean;
283
794
  enabled: boolean;
795
+ execution?: {
796
+ apply?: {
797
+ receipt?: {
798
+ customerAccount: string;
799
+ enabled?: boolean | undefined;
800
+ paymentMethodId: string | null;
801
+ paymentMethodTypes?: string[] | null | undefined;
802
+ phase: "apply" | "attach" | "create";
803
+ providerApiVersion: string;
804
+ stripeSubscriptionId: string;
805
+ } | undefined;
806
+ state: "running" | "succeeded" | "unknown";
807
+ } | undefined;
808
+ attach?: {
809
+ receipt?: {
810
+ customerAccount: string;
811
+ enabled?: boolean | undefined;
812
+ paymentMethodId: string | null;
813
+ paymentMethodTypes?: string[] | null | undefined;
814
+ phase: "apply" | "attach" | "create";
815
+ providerApiVersion: string;
816
+ stripeSubscriptionId: string;
817
+ } | undefined;
818
+ state: "running" | "succeeded" | "unknown";
819
+ } | undefined;
820
+ create?: {
821
+ receipt?: {
822
+ customerAccount: string;
823
+ enabled?: boolean | undefined;
824
+ paymentMethodId: string | null;
825
+ paymentMethodTypes?: string[] | null | undefined;
826
+ phase: "apply" | "attach" | "create";
827
+ providerApiVersion: string;
828
+ stripeSubscriptionId: string;
829
+ } | undefined;
830
+ state: "running" | "succeeded" | "unknown";
831
+ } | undefined;
832
+ definitionVersion: string;
833
+ providerAction: string;
834
+ providerApiVersion: string;
835
+ workflowId?: string | undefined;
836
+ } | undefined;
284
837
  failureCode?: "invalid_scope" | "policy_invalid" | "unsupported_source" | undefined;
285
838
  kind: "apply" | "prepare";
286
839
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
@@ -336,7 +889,147 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
336
889
  paymentMethodTypes: import("convex/values").VUnion<string[] | null, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "required", never>;
337
890
  providerApiVersion: import("convex/values").VString<string, "required">;
338
891
  }, "optional", "customerAccount" | "paymentMethodId" | "paymentMethodTypes" | "providerApiVersion" | "stripeSubscriptionId">;
339
- }, "required", "accountId" | "cancelRequested" | "enabled" | "failureCode" | "kind" | "preparationId" | "providerKey" | "providerKeys" | "providerKeys.attach" | "providerKeys.create" | "providerKeys.disable" | "providerKeys.enable" | "receipt" | "receipt.customerAccount" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "scopeKey" | "state" | "version">, {
892
+ execution: import("convex/values").VObject<{
893
+ apply?: {
894
+ receipt?: {
895
+ customerAccount: string;
896
+ enabled?: boolean | undefined;
897
+ paymentMethodId: string | null;
898
+ paymentMethodTypes?: string[] | null | undefined;
899
+ phase: "apply" | "attach" | "create";
900
+ providerApiVersion: string;
901
+ stripeSubscriptionId: string;
902
+ } | undefined;
903
+ state: "running" | "succeeded" | "unknown";
904
+ } | undefined;
905
+ attach?: {
906
+ receipt?: {
907
+ customerAccount: string;
908
+ enabled?: boolean | undefined;
909
+ paymentMethodId: string | null;
910
+ paymentMethodTypes?: string[] | null | undefined;
911
+ phase: "apply" | "attach" | "create";
912
+ providerApiVersion: string;
913
+ stripeSubscriptionId: string;
914
+ } | undefined;
915
+ state: "running" | "succeeded" | "unknown";
916
+ } | undefined;
917
+ create?: {
918
+ receipt?: {
919
+ customerAccount: string;
920
+ enabled?: boolean | undefined;
921
+ paymentMethodId: string | null;
922
+ paymentMethodTypes?: string[] | null | undefined;
923
+ phase: "apply" | "attach" | "create";
924
+ providerApiVersion: string;
925
+ stripeSubscriptionId: string;
926
+ } | undefined;
927
+ state: "running" | "succeeded" | "unknown";
928
+ } | undefined;
929
+ definitionVersion: string;
930
+ providerAction: string;
931
+ providerApiVersion: string;
932
+ workflowId?: string | undefined;
933
+ } | undefined, {
934
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
935
+ definitionVersion: import("convex/values").VString<string, "required">;
936
+ providerApiVersion: import("convex/values").VString<string, "required">;
937
+ providerAction: import("convex/values").VString<string, "required">;
938
+ create: import("convex/values").VObject<{
939
+ receipt?: {
940
+ customerAccount: string;
941
+ enabled?: boolean | undefined;
942
+ paymentMethodId: string | null;
943
+ paymentMethodTypes?: string[] | null | undefined;
944
+ phase: "apply" | "attach" | "create";
945
+ providerApiVersion: string;
946
+ stripeSubscriptionId: string;
947
+ } | undefined;
948
+ state: "running" | "succeeded" | "unknown";
949
+ } | undefined, {
950
+ state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
951
+ receipt: import("convex/values").VObject<{
952
+ customerAccount: string;
953
+ enabled?: boolean | undefined;
954
+ paymentMethodId: string | null;
955
+ paymentMethodTypes?: string[] | null | undefined;
956
+ phase: "apply" | "attach" | "create";
957
+ providerApiVersion: string;
958
+ stripeSubscriptionId: string;
959
+ } | undefined, {
960
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
961
+ customerAccount: import("convex/values").VString<string, "required">;
962
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
963
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
964
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
965
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
966
+ providerApiVersion: import("convex/values").VString<string, "required">;
967
+ }, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
968
+ }, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
969
+ attach: import("convex/values").VObject<{
970
+ receipt?: {
971
+ customerAccount: string;
972
+ enabled?: boolean | undefined;
973
+ paymentMethodId: string | null;
974
+ paymentMethodTypes?: string[] | null | undefined;
975
+ phase: "apply" | "attach" | "create";
976
+ providerApiVersion: string;
977
+ stripeSubscriptionId: string;
978
+ } | undefined;
979
+ state: "running" | "succeeded" | "unknown";
980
+ } | undefined, {
981
+ state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
982
+ receipt: import("convex/values").VObject<{
983
+ customerAccount: string;
984
+ enabled?: boolean | undefined;
985
+ paymentMethodId: string | null;
986
+ paymentMethodTypes?: string[] | null | undefined;
987
+ phase: "apply" | "attach" | "create";
988
+ providerApiVersion: string;
989
+ stripeSubscriptionId: string;
990
+ } | undefined, {
991
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
992
+ customerAccount: import("convex/values").VString<string, "required">;
993
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
994
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
995
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
996
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
997
+ providerApiVersion: import("convex/values").VString<string, "required">;
998
+ }, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
999
+ }, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
1000
+ apply: import("convex/values").VObject<{
1001
+ receipt?: {
1002
+ customerAccount: string;
1003
+ enabled?: boolean | undefined;
1004
+ paymentMethodId: string | null;
1005
+ paymentMethodTypes?: string[] | null | undefined;
1006
+ phase: "apply" | "attach" | "create";
1007
+ providerApiVersion: string;
1008
+ stripeSubscriptionId: string;
1009
+ } | undefined;
1010
+ state: "running" | "succeeded" | "unknown";
1011
+ } | undefined, {
1012
+ state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
1013
+ receipt: import("convex/values").VObject<{
1014
+ customerAccount: string;
1015
+ enabled?: boolean | undefined;
1016
+ paymentMethodId: string | null;
1017
+ paymentMethodTypes?: string[] | null | undefined;
1018
+ phase: "apply" | "attach" | "create";
1019
+ providerApiVersion: string;
1020
+ stripeSubscriptionId: string;
1021
+ } | undefined, {
1022
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
1023
+ customerAccount: import("convex/values").VString<string, "required">;
1024
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
1025
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
1026
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
1027
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
1028
+ providerApiVersion: import("convex/values").VString<string, "required">;
1029
+ }, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
1030
+ }, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
1031
+ }, "optional", "apply" | "apply.receipt" | "apply.receipt.customerAccount" | "apply.receipt.enabled" | "apply.receipt.paymentMethodId" | "apply.receipt.paymentMethodTypes" | "apply.receipt.phase" | "apply.receipt.providerApiVersion" | "apply.receipt.stripeSubscriptionId" | "apply.state" | "attach" | "attach.receipt" | "attach.receipt.customerAccount" | "attach.receipt.enabled" | "attach.receipt.paymentMethodId" | "attach.receipt.paymentMethodTypes" | "attach.receipt.phase" | "attach.receipt.providerApiVersion" | "attach.receipt.stripeSubscriptionId" | "attach.state" | "create" | "create.receipt" | "create.receipt.customerAccount" | "create.receipt.enabled" | "create.receipt.paymentMethodId" | "create.receipt.paymentMethodTypes" | "create.receipt.phase" | "create.receipt.providerApiVersion" | "create.receipt.stripeSubscriptionId" | "create.state" | "definitionVersion" | "providerAction" | "providerApiVersion" | "workflowId">;
1032
+ }, "required", "accountId" | "cancelRequested" | "enabled" | "execution" | "execution.apply" | "execution.apply.receipt" | "execution.apply.receipt.customerAccount" | "execution.apply.receipt.enabled" | "execution.apply.receipt.paymentMethodId" | "execution.apply.receipt.paymentMethodTypes" | "execution.apply.receipt.phase" | "execution.apply.receipt.providerApiVersion" | "execution.apply.receipt.stripeSubscriptionId" | "execution.apply.state" | "execution.attach" | "execution.attach.receipt" | "execution.attach.receipt.customerAccount" | "execution.attach.receipt.enabled" | "execution.attach.receipt.paymentMethodId" | "execution.attach.receipt.paymentMethodTypes" | "execution.attach.receipt.phase" | "execution.attach.receipt.providerApiVersion" | "execution.attach.receipt.stripeSubscriptionId" | "execution.attach.state" | "execution.create" | "execution.create.receipt" | "execution.create.receipt.customerAccount" | "execution.create.receipt.enabled" | "execution.create.receipt.paymentMethodId" | "execution.create.receipt.paymentMethodTypes" | "execution.create.receipt.phase" | "execution.create.receipt.providerApiVersion" | "execution.create.receipt.stripeSubscriptionId" | "execution.create.state" | "execution.definitionVersion" | "execution.providerAction" | "execution.providerApiVersion" | "execution.workflowId" | "failureCode" | "kind" | "preparationId" | "providerKey" | "providerKeys" | "providerKeys.attach" | "providerKeys.create" | "providerKeys.disable" | "providerKeys.enable" | "receipt" | "receipt.customerAccount" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "scopeKey" | "state" | "version">, {
340
1033
  by_preparation_version: ["preparationId", "version", "_creationTime"];
341
1034
  }, {}, {}>;
342
1035
  balanceFundingRequests: import("convex/server").TableDefinition<import("convex/values").VObject<{
@@ -2695,6 +3388,517 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
2695
3388
  }>;
2696
3389
  export declare function historical(currency?: string): Promise<{
2697
3390
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
3391
+ processingCostReconciliationOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
3392
+ accountId: string;
3393
+ claimKey: string;
3394
+ currency: string;
3395
+ definitionVersion: number;
3396
+ expectedRevision: number;
3397
+ failure?: {
3398
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
3399
+ retryable: true;
3400
+ status: "not_ready";
3401
+ } | {
3402
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
3403
+ retryable: false;
3404
+ status: "conflict";
3405
+ } | {
3406
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
3407
+ retryable: false;
3408
+ status: "rejected";
3409
+ } | {
3410
+ reason: "history_incomplete" | "provider_outcome_unknown";
3411
+ retryable: false;
3412
+ status: "unknown";
3413
+ } | undefined;
3414
+ importHook?: string | undefined;
3415
+ maxAttempts: number;
3416
+ policy: {
3417
+ liability: {
3418
+ disputeCosts: "all" | "none";
3419
+ processingCosts: "all" | "none" | "uncovered";
3420
+ };
3421
+ rounding: "ceil" | "floor" | "nearest";
3422
+ sellingFee: number;
3423
+ };
3424
+ projection?: string | undefined;
3425
+ provider: string;
3426
+ providerApiVersion: string;
3427
+ requestKey: string;
3428
+ result?: {
3429
+ claim: {
3430
+ _creationTime: number;
3431
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3432
+ accountId: string;
3433
+ amountDue: number;
3434
+ claimKey: string;
3435
+ collectedAmount: number;
3436
+ currency: string;
3437
+ openingCollection?: {
3438
+ amountDue: number;
3439
+ collectedAmount: number;
3440
+ operationKey: string;
3441
+ revision: number;
3442
+ } | undefined;
3443
+ outstanding: number;
3444
+ reservedAmount: number;
3445
+ revision: number;
3446
+ scopeKey: string;
3447
+ sign: "negative" | "positive" | "zero";
3448
+ sourceChargeId: string;
3449
+ sourceGross: number;
3450
+ sourceProcessingFee: number;
3451
+ };
3452
+ deficit: {
3453
+ amountDue: number;
3454
+ currency: string;
3455
+ disputeLiability: number;
3456
+ processingLiability: number;
3457
+ retainedFee: number;
3458
+ };
3459
+ observation: {
3460
+ currency: string;
3461
+ disputeFees: number;
3462
+ gross: number;
3463
+ originalProcessingFee: number;
3464
+ paymentIntentId: string;
3465
+ principalReturned: number;
3466
+ processingFee: number;
3467
+ provenance: {
3468
+ customerAccountId: string;
3469
+ invoiceId: string;
3470
+ invoicePaymentId: string;
3471
+ recoveryInvoiceItemId?: string | undefined;
3472
+ stripePriceId?: string | undefined;
3473
+ stripeProductId?: string | undefined;
3474
+ subscriptionId?: string | undefined;
3475
+ };
3476
+ sourceChargeId: string;
3477
+ };
3478
+ rollbackClaim?: {
3479
+ _creationTime: number;
3480
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3481
+ accountId: string;
3482
+ amountDue: number;
3483
+ claimKey: string;
3484
+ collectedAmount: number;
3485
+ currency: string;
3486
+ openingCollection?: {
3487
+ amountDue: number;
3488
+ collectedAmount: number;
3489
+ operationKey: string;
3490
+ revision: number;
3491
+ } | undefined;
3492
+ outstanding: number;
3493
+ reservedAmount: number;
3494
+ revision: number;
3495
+ scopeKey: string;
3496
+ sign: "negative" | "positive" | "zero";
3497
+ sourceChargeId: string;
3498
+ sourceGross: number;
3499
+ sourceProcessingFee: number;
3500
+ } | undefined;
3501
+ } | undefined;
3502
+ retryDelayMs: number;
3503
+ rollback?: {
3504
+ expectedRevision: number;
3505
+ groupKey: string;
3506
+ } | undefined;
3507
+ scopeKey: string;
3508
+ source: {
3509
+ customerAccountId: string;
3510
+ gross: number;
3511
+ invoiceId?: string | undefined;
3512
+ kind: "sale";
3513
+ paymentIntentId: string;
3514
+ stripeAccountId?: string | undefined;
3515
+ stripePriceId?: string | undefined;
3516
+ stripeProductId?: string | undefined;
3517
+ subscriptionId?: string | undefined;
3518
+ } | {
3519
+ gross: number;
3520
+ groupKey: string;
3521
+ kind: "invoice_recovery";
3522
+ paymentIntentId: string;
3523
+ };
3524
+ status: "completed" | "conflict" | "queued" | "rejected" | "running" | "unknown" | "waiting";
3525
+ version: number;
3526
+ workflowId?: string | undefined;
3527
+ }, {
3528
+ accountId: import("convex/values").VString<string, "required">;
3529
+ scopeKey: import("convex/values").VString<string, "required">;
3530
+ currency: import("convex/values").VString<string, "required">;
3531
+ claimKey: import("convex/values").VString<string, "required">;
3532
+ source: import("convex/values").VUnion<{
3533
+ customerAccountId: string;
3534
+ gross: number;
3535
+ invoiceId?: string | undefined;
3536
+ kind: "sale";
3537
+ paymentIntentId: string;
3538
+ stripeAccountId?: string | undefined;
3539
+ stripePriceId?: string | undefined;
3540
+ stripeProductId?: string | undefined;
3541
+ subscriptionId?: string | undefined;
3542
+ } | {
3543
+ gross: number;
3544
+ groupKey: string;
3545
+ kind: "invoice_recovery";
3546
+ paymentIntentId: string;
3547
+ }, [import("convex/values").VObject<{
3548
+ customerAccountId: string;
3549
+ gross: number;
3550
+ invoiceId?: string | undefined;
3551
+ kind: "sale";
3552
+ paymentIntentId: string;
3553
+ stripeAccountId?: string | undefined;
3554
+ stripePriceId?: string | undefined;
3555
+ stripeProductId?: string | undefined;
3556
+ subscriptionId?: string | undefined;
3557
+ }, {
3558
+ kind: import("convex/values").VLiteral<"sale", "required">;
3559
+ paymentIntentId: import("convex/values").VString<string, "required">;
3560
+ gross: import("convex/values").VFloat64<number, "required">;
3561
+ customerAccountId: import("convex/values").VString<string, "required">;
3562
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
3563
+ subscriptionId: import("convex/values").VString<string | undefined, "optional">;
3564
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
3565
+ stripePriceId: import("convex/values").VString<string | undefined, "optional">;
3566
+ stripeProductId: import("convex/values").VString<string | undefined, "optional">;
3567
+ }, "required", "customerAccountId" | "gross" | "invoiceId" | "kind" | "paymentIntentId" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId">, import("convex/values").VObject<{
3568
+ gross: number;
3569
+ groupKey: string;
3570
+ kind: "invoice_recovery";
3571
+ paymentIntentId: string;
3572
+ }, {
3573
+ kind: import("convex/values").VLiteral<"invoice_recovery", "required">;
3574
+ paymentIntentId: import("convex/values").VString<string, "required">;
3575
+ gross: import("convex/values").VFloat64<number, "required">;
3576
+ groupKey: import("convex/values").VString<string, "required">;
3577
+ }, "required", "gross" | "groupKey" | "kind" | "paymentIntentId">], "required", "customerAccountId" | "gross" | "groupKey" | "invoiceId" | "kind" | "paymentIntentId" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId">;
3578
+ policy: import("convex/values").VObject<{
3579
+ liability: {
3580
+ disputeCosts: "all" | "none";
3581
+ processingCosts: "all" | "none" | "uncovered";
3582
+ };
3583
+ rounding: "ceil" | "floor" | "nearest";
3584
+ sellingFee: number;
3585
+ }, {
3586
+ sellingFee: import("convex/values").VFloat64<number, "required">;
3587
+ liability: import("convex/values").VObject<{
3588
+ disputeCosts: "all" | "none";
3589
+ processingCosts: "all" | "none" | "uncovered";
3590
+ }, {
3591
+ processingCosts: import("convex/values").VUnion<"all" | "none" | "uncovered", [import("convex/values").VLiteral<"uncovered", "required">, import("convex/values").VLiteral<"all", "required">, import("convex/values").VLiteral<"none", "required">], "required", never>;
3592
+ disputeCosts: import("convex/values").VUnion<"all" | "none", [import("convex/values").VLiteral<"all", "required">, import("convex/values").VLiteral<"none", "required">], "required", never>;
3593
+ }, "required", "disputeCosts" | "processingCosts">;
3594
+ rounding: import("convex/values").VUnion<"ceil" | "floor" | "nearest", [import("convex/values").VLiteral<"nearest", "required">, import("convex/values").VLiteral<"floor", "required">, import("convex/values").VLiteral<"ceil", "required">], "required", never>;
3595
+ }, "required", "liability" | "liability.disputeCosts" | "liability.processingCosts" | "rounding" | "sellingFee">;
3596
+ expectedRevision: import("convex/values").VFloat64<number, "required">;
3597
+ rollback: import("convex/values").VObject<{
3598
+ expectedRevision: number;
3599
+ groupKey: string;
3600
+ } | undefined, {
3601
+ groupKey: import("convex/values").VString<string, "required">;
3602
+ expectedRevision: import("convex/values").VFloat64<number, "required">;
3603
+ }, "optional", "expectedRevision" | "groupKey">;
3604
+ provider: import("convex/values").VString<string, "required">;
3605
+ projection: import("convex/values").VString<string | undefined, "optional">;
3606
+ importHook: import("convex/values").VString<string | undefined, "optional">;
3607
+ providerApiVersion: import("convex/values").VString<string, "required">;
3608
+ definitionVersion: import("convex/values").VFloat64<number, "required">;
3609
+ maxAttempts: import("convex/values").VFloat64<number, "required">;
3610
+ retryDelayMs: import("convex/values").VFloat64<number, "required">;
3611
+ requestKey: import("convex/values").VString<string, "required">;
3612
+ version: import("convex/values").VFloat64<number, "required">;
3613
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
3614
+ status: import("convex/values").VUnion<"completed" | "conflict" | "queued" | "rejected" | "running" | "unknown" | "waiting", [import("convex/values").VLiteral<"queued", "required">, import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"waiting", "required">, import("convex/values").VLiteral<"completed", "required">, import("convex/values").VLiteral<"conflict", "required">, import("convex/values").VLiteral<"rejected", "required">, import("convex/values").VLiteral<"unknown", "required">], "required", never>;
3615
+ failure: import("convex/values").VUnion<{
3616
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
3617
+ retryable: true;
3618
+ status: "not_ready";
3619
+ } | {
3620
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
3621
+ retryable: false;
3622
+ status: "conflict";
3623
+ } | {
3624
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
3625
+ retryable: false;
3626
+ status: "rejected";
3627
+ } | {
3628
+ reason: "history_incomplete" | "provider_outcome_unknown";
3629
+ retryable: false;
3630
+ status: "unknown";
3631
+ } | undefined, [import("convex/values").VObject<{
3632
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
3633
+ retryable: true;
3634
+ status: "not_ready";
3635
+ }, {
3636
+ status: import("convex/values").VLiteral<"not_ready", "required">;
3637
+ reason: import("convex/values").VUnion<"fee_pending" | "history_incomplete" | "provider_pending", [import("convex/values").VLiteral<"provider_pending", "required">, import("convex/values").VLiteral<"fee_pending", "required">, import("convex/values").VLiteral<"history_incomplete", "required">], "required", never>;
3638
+ retryable: import("convex/values").VLiteral<true, "required">;
3639
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
3640
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
3641
+ retryable: false;
3642
+ status: "conflict";
3643
+ }, {
3644
+ status: import("convex/values").VLiteral<"conflict", "required">;
3645
+ reason: import("convex/values").VUnion<"identity_changed" | "revision_changed" | "scope_busy", [import("convex/values").VLiteral<"scope_busy", "required">, import("convex/values").VLiteral<"revision_changed", "required">, import("convex/values").VLiteral<"identity_changed", "required">], "required", never>;
3646
+ retryable: import("convex/values").VLiteral<false, "required">;
3647
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
3648
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
3649
+ retryable: false;
3650
+ status: "rejected";
3651
+ }, {
3652
+ status: import("convex/values").VLiteral<"rejected", "required">;
3653
+ reason: import("convex/values").VUnion<"currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source", [import("convex/values").VLiteral<"invalid_scope", "required">, import("convex/values").VLiteral<"unsupported_source", "required">, import("convex/values").VLiteral<"policy_invalid", "required">, import("convex/values").VLiteral<"payment_not_payable", "required">, import("convex/values").VLiteral<"currency_mismatch", "required">], "required", never>;
3654
+ retryable: import("convex/values").VLiteral<false, "required">;
3655
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
3656
+ reason: "history_incomplete" | "provider_outcome_unknown";
3657
+ retryable: false;
3658
+ status: "unknown";
3659
+ }, {
3660
+ status: import("convex/values").VLiteral<"unknown", "required">;
3661
+ reason: import("convex/values").VUnion<"history_incomplete" | "provider_outcome_unknown", [import("convex/values").VLiteral<"provider_outcome_unknown", "required">, import("convex/values").VLiteral<"history_incomplete", "required">], "required", never>;
3662
+ retryable: import("convex/values").VLiteral<false, "required">;
3663
+ }, "required", "reason" | "retryable" | "status">], "optional", "reason" | "retryable" | "status">;
3664
+ result: import("convex/values").VObject<{
3665
+ claim: {
3666
+ _creationTime: number;
3667
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3668
+ accountId: string;
3669
+ amountDue: number;
3670
+ claimKey: string;
3671
+ collectedAmount: number;
3672
+ currency: string;
3673
+ openingCollection?: {
3674
+ amountDue: number;
3675
+ collectedAmount: number;
3676
+ operationKey: string;
3677
+ revision: number;
3678
+ } | undefined;
3679
+ outstanding: number;
3680
+ reservedAmount: number;
3681
+ revision: number;
3682
+ scopeKey: string;
3683
+ sign: "negative" | "positive" | "zero";
3684
+ sourceChargeId: string;
3685
+ sourceGross: number;
3686
+ sourceProcessingFee: number;
3687
+ };
3688
+ deficit: {
3689
+ amountDue: number;
3690
+ currency: string;
3691
+ disputeLiability: number;
3692
+ processingLiability: number;
3693
+ retainedFee: number;
3694
+ };
3695
+ observation: {
3696
+ currency: string;
3697
+ disputeFees: number;
3698
+ gross: number;
3699
+ originalProcessingFee: number;
3700
+ paymentIntentId: string;
3701
+ principalReturned: number;
3702
+ processingFee: number;
3703
+ provenance: {
3704
+ customerAccountId: string;
3705
+ invoiceId: string;
3706
+ invoicePaymentId: string;
3707
+ recoveryInvoiceItemId?: string | undefined;
3708
+ stripePriceId?: string | undefined;
3709
+ stripeProductId?: string | undefined;
3710
+ subscriptionId?: string | undefined;
3711
+ };
3712
+ sourceChargeId: string;
3713
+ };
3714
+ rollbackClaim?: {
3715
+ _creationTime: number;
3716
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3717
+ accountId: string;
3718
+ amountDue: number;
3719
+ claimKey: string;
3720
+ collectedAmount: number;
3721
+ currency: string;
3722
+ openingCollection?: {
3723
+ amountDue: number;
3724
+ collectedAmount: number;
3725
+ operationKey: string;
3726
+ revision: number;
3727
+ } | undefined;
3728
+ outstanding: number;
3729
+ reservedAmount: number;
3730
+ revision: number;
3731
+ scopeKey: string;
3732
+ sign: "negative" | "positive" | "zero";
3733
+ sourceChargeId: string;
3734
+ sourceGross: number;
3735
+ sourceProcessingFee: number;
3736
+ } | undefined;
3737
+ } | undefined, {
3738
+ claim: import("convex/values").VObject<{
3739
+ _creationTime: number;
3740
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3741
+ accountId: string;
3742
+ amountDue: number;
3743
+ claimKey: string;
3744
+ collectedAmount: number;
3745
+ currency: string;
3746
+ openingCollection?: {
3747
+ amountDue: number;
3748
+ collectedAmount: number;
3749
+ operationKey: string;
3750
+ revision: number;
3751
+ } | undefined;
3752
+ outstanding: number;
3753
+ reservedAmount: number;
3754
+ revision: number;
3755
+ scopeKey: string;
3756
+ sign: "negative" | "positive" | "zero";
3757
+ sourceChargeId: string;
3758
+ sourceGross: number;
3759
+ sourceProcessingFee: number;
3760
+ }, {
3761
+ accountId: import("convex/values").VString<string, "required">;
3762
+ scopeKey: import("convex/values").VString<string, "required">;
3763
+ currency: import("convex/values").VString<string, "required">;
3764
+ claimKey: import("convex/values").VString<string, "required">;
3765
+ sourceChargeId: import("convex/values").VString<string, "required">;
3766
+ sourceGross: import("convex/values").VFloat64<number, "required">;
3767
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
3768
+ amountDue: import("convex/values").VFloat64<number, "required">;
3769
+ revision: import("convex/values").VFloat64<number, "required">;
3770
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
3771
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
3772
+ outstanding: import("convex/values").VFloat64<number, "required">;
3773
+ sign: import("convex/values").VUnion<"negative" | "positive" | "zero", [import("convex/values").VLiteral<"positive", "required">, import("convex/values").VLiteral<"negative", "required">, import("convex/values").VLiteral<"zero", "required">], "required", never>;
3774
+ openingCollection: import("convex/values").VObject<{
3775
+ amountDue: number;
3776
+ collectedAmount: number;
3777
+ operationKey: string;
3778
+ revision: number;
3779
+ } | undefined, {
3780
+ operationKey: import("convex/values").VString<string, "required">;
3781
+ amountDue: import("convex/values").VFloat64<number, "required">;
3782
+ revision: import("convex/values").VFloat64<number, "required">;
3783
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
3784
+ }, "optional", "amountDue" | "collectedAmount" | "operationKey" | "revision">;
3785
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
3786
+ _creationTime: import("convex/values").VFloat64<number, "required">;
3787
+ }, "required", "_creationTime" | "_id" | "accountId" | "amountDue" | "claimKey" | "collectedAmount" | "currency" | "openingCollection" | "openingCollection.amountDue" | "openingCollection.collectedAmount" | "openingCollection.operationKey" | "openingCollection.revision" | "outstanding" | "reservedAmount" | "revision" | "scopeKey" | "sign" | "sourceChargeId" | "sourceGross" | "sourceProcessingFee">;
3788
+ rollbackClaim: import("convex/values").VObject<{
3789
+ _creationTime: number;
3790
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3791
+ accountId: string;
3792
+ amountDue: number;
3793
+ claimKey: string;
3794
+ collectedAmount: number;
3795
+ currency: string;
3796
+ openingCollection?: {
3797
+ amountDue: number;
3798
+ collectedAmount: number;
3799
+ operationKey: string;
3800
+ revision: number;
3801
+ } | undefined;
3802
+ outstanding: number;
3803
+ reservedAmount: number;
3804
+ revision: number;
3805
+ scopeKey: string;
3806
+ sign: "negative" | "positive" | "zero";
3807
+ sourceChargeId: string;
3808
+ sourceGross: number;
3809
+ sourceProcessingFee: number;
3810
+ } | undefined, {
3811
+ accountId: import("convex/values").VString<string, "required">;
3812
+ scopeKey: import("convex/values").VString<string, "required">;
3813
+ currency: import("convex/values").VString<string, "required">;
3814
+ claimKey: import("convex/values").VString<string, "required">;
3815
+ sourceChargeId: import("convex/values").VString<string, "required">;
3816
+ sourceGross: import("convex/values").VFloat64<number, "required">;
3817
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
3818
+ amountDue: import("convex/values").VFloat64<number, "required">;
3819
+ revision: import("convex/values").VFloat64<number, "required">;
3820
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
3821
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
3822
+ outstanding: import("convex/values").VFloat64<number, "required">;
3823
+ sign: import("convex/values").VUnion<"negative" | "positive" | "zero", [import("convex/values").VLiteral<"positive", "required">, import("convex/values").VLiteral<"negative", "required">, import("convex/values").VLiteral<"zero", "required">], "required", never>;
3824
+ openingCollection: import("convex/values").VObject<{
3825
+ amountDue: number;
3826
+ collectedAmount: number;
3827
+ operationKey: string;
3828
+ revision: number;
3829
+ } | undefined, {
3830
+ operationKey: import("convex/values").VString<string, "required">;
3831
+ amountDue: import("convex/values").VFloat64<number, "required">;
3832
+ revision: import("convex/values").VFloat64<number, "required">;
3833
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
3834
+ }, "optional", "amountDue" | "collectedAmount" | "operationKey" | "revision">;
3835
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
3836
+ _creationTime: import("convex/values").VFloat64<number, "required">;
3837
+ }, "optional", "_creationTime" | "_id" | "accountId" | "amountDue" | "claimKey" | "collectedAmount" | "currency" | "openingCollection" | "openingCollection.amountDue" | "openingCollection.collectedAmount" | "openingCollection.operationKey" | "openingCollection.revision" | "outstanding" | "reservedAmount" | "revision" | "scopeKey" | "sign" | "sourceChargeId" | "sourceGross" | "sourceProcessingFee">;
3838
+ deficit: import("convex/values").VObject<{
3839
+ amountDue: number;
3840
+ currency: string;
3841
+ disputeLiability: number;
3842
+ processingLiability: number;
3843
+ retainedFee: number;
3844
+ }, {
3845
+ currency: import("convex/values").VString<string, "required">;
3846
+ retainedFee: import("convex/values").VFloat64<number, "required">;
3847
+ processingLiability: import("convex/values").VFloat64<number, "required">;
3848
+ disputeLiability: import("convex/values").VFloat64<number, "required">;
3849
+ amountDue: import("convex/values").VFloat64<number, "required">;
3850
+ }, "required", "amountDue" | "currency" | "disputeLiability" | "processingLiability" | "retainedFee">;
3851
+ observation: import("convex/values").VObject<{
3852
+ currency: string;
3853
+ disputeFees: number;
3854
+ gross: number;
3855
+ originalProcessingFee: number;
3856
+ paymentIntentId: string;
3857
+ principalReturned: number;
3858
+ processingFee: number;
3859
+ provenance: {
3860
+ customerAccountId: string;
3861
+ invoiceId: string;
3862
+ invoicePaymentId: string;
3863
+ recoveryInvoiceItemId?: string | undefined;
3864
+ stripePriceId?: string | undefined;
3865
+ stripeProductId?: string | undefined;
3866
+ subscriptionId?: string | undefined;
3867
+ };
3868
+ sourceChargeId: string;
3869
+ }, {
3870
+ paymentIntentId: import("convex/values").VString<string, "required">;
3871
+ sourceChargeId: import("convex/values").VString<string, "required">;
3872
+ currency: import("convex/values").VString<string, "required">;
3873
+ gross: import("convex/values").VFloat64<number, "required">;
3874
+ originalProcessingFee: import("convex/values").VFloat64<number, "required">;
3875
+ processingFee: import("convex/values").VFloat64<number, "required">;
3876
+ disputeFees: import("convex/values").VFloat64<number, "required">;
3877
+ principalReturned: import("convex/values").VFloat64<number, "required">;
3878
+ provenance: import("convex/values").VObject<{
3879
+ customerAccountId: string;
3880
+ invoiceId: string;
3881
+ invoicePaymentId: string;
3882
+ recoveryInvoiceItemId?: string | undefined;
3883
+ stripePriceId?: string | undefined;
3884
+ stripeProductId?: string | undefined;
3885
+ subscriptionId?: string | undefined;
3886
+ }, {
3887
+ invoiceId: import("convex/values").VString<string, "required">;
3888
+ invoicePaymentId: import("convex/values").VString<string, "required">;
3889
+ recoveryInvoiceItemId: import("convex/values").VString<string | undefined, "optional">;
3890
+ customerAccountId: import("convex/values").VString<string, "required">;
3891
+ subscriptionId: import("convex/values").VString<string | undefined, "optional">;
3892
+ stripePriceId: import("convex/values").VString<string | undefined, "optional">;
3893
+ stripeProductId: import("convex/values").VString<string | undefined, "optional">;
3894
+ }, "required", "customerAccountId" | "invoiceId" | "invoicePaymentId" | "recoveryInvoiceItemId" | "stripePriceId" | "stripeProductId" | "subscriptionId">;
3895
+ }, "required", "currency" | "disputeFees" | "gross" | "originalProcessingFee" | "paymentIntentId" | "principalReturned" | "processingFee" | "provenance" | "provenance.customerAccountId" | "provenance.invoiceId" | "provenance.invoicePaymentId" | "provenance.recoveryInvoiceItemId" | "provenance.stripePriceId" | "provenance.stripeProductId" | "provenance.subscriptionId" | "sourceChargeId">;
3896
+ }, "optional", "claim" | "claim._creationTime" | "claim._id" | "claim.accountId" | "claim.amountDue" | "claim.claimKey" | "claim.collectedAmount" | "claim.currency" | "claim.openingCollection" | "claim.openingCollection.amountDue" | "claim.openingCollection.collectedAmount" | "claim.openingCollection.operationKey" | "claim.openingCollection.revision" | "claim.outstanding" | "claim.reservedAmount" | "claim.revision" | "claim.scopeKey" | "claim.sign" | "claim.sourceChargeId" | "claim.sourceGross" | "claim.sourceProcessingFee" | "deficit" | "deficit.amountDue" | "deficit.currency" | "deficit.disputeLiability" | "deficit.processingLiability" | "deficit.retainedFee" | "observation" | "observation.currency" | "observation.disputeFees" | "observation.gross" | "observation.originalProcessingFee" | "observation.paymentIntentId" | "observation.principalReturned" | "observation.processingFee" | "observation.provenance" | "observation.provenance.customerAccountId" | "observation.provenance.invoiceId" | "observation.provenance.invoicePaymentId" | "observation.provenance.recoveryInvoiceItemId" | "observation.provenance.stripePriceId" | "observation.provenance.stripeProductId" | "observation.provenance.subscriptionId" | "observation.sourceChargeId" | "rollbackClaim" | "rollbackClaim._creationTime" | "rollbackClaim._id" | "rollbackClaim.accountId" | "rollbackClaim.amountDue" | "rollbackClaim.claimKey" | "rollbackClaim.collectedAmount" | "rollbackClaim.currency" | "rollbackClaim.openingCollection" | "rollbackClaim.openingCollection.amountDue" | "rollbackClaim.openingCollection.collectedAmount" | "rollbackClaim.openingCollection.operationKey" | "rollbackClaim.openingCollection.revision" | "rollbackClaim.outstanding" | "rollbackClaim.reservedAmount" | "rollbackClaim.revision" | "rollbackClaim.scopeKey" | "rollbackClaim.sign" | "rollbackClaim.sourceChargeId" | "rollbackClaim.sourceGross" | "rollbackClaim.sourceProcessingFee">;
3897
+ }, "required", "accountId" | "claimKey" | "currency" | "definitionVersion" | "expectedRevision" | "failure" | "failure.reason" | "failure.retryable" | "failure.status" | "importHook" | "maxAttempts" | "policy" | "policy.liability" | "policy.liability.disputeCosts" | "policy.liability.processingCosts" | "policy.rounding" | "policy.sellingFee" | "projection" | "provider" | "providerApiVersion" | "requestKey" | "result" | "result.claim" | "result.claim._creationTime" | "result.claim._id" | "result.claim.accountId" | "result.claim.amountDue" | "result.claim.claimKey" | "result.claim.collectedAmount" | "result.claim.currency" | "result.claim.openingCollection" | "result.claim.openingCollection.amountDue" | "result.claim.openingCollection.collectedAmount" | "result.claim.openingCollection.operationKey" | "result.claim.openingCollection.revision" | "result.claim.outstanding" | "result.claim.reservedAmount" | "result.claim.revision" | "result.claim.scopeKey" | "result.claim.sign" | "result.claim.sourceChargeId" | "result.claim.sourceGross" | "result.claim.sourceProcessingFee" | "result.deficit" | "result.deficit.amountDue" | "result.deficit.currency" | "result.deficit.disputeLiability" | "result.deficit.processingLiability" | "result.deficit.retainedFee" | "result.observation" | "result.observation.currency" | "result.observation.disputeFees" | "result.observation.gross" | "result.observation.originalProcessingFee" | "result.observation.paymentIntentId" | "result.observation.principalReturned" | "result.observation.processingFee" | "result.observation.provenance" | "result.observation.provenance.customerAccountId" | "result.observation.provenance.invoiceId" | "result.observation.provenance.invoicePaymentId" | "result.observation.provenance.recoveryInvoiceItemId" | "result.observation.provenance.stripePriceId" | "result.observation.provenance.stripeProductId" | "result.observation.provenance.subscriptionId" | "result.observation.sourceChargeId" | "result.rollbackClaim" | "result.rollbackClaim._creationTime" | "result.rollbackClaim._id" | "result.rollbackClaim.accountId" | "result.rollbackClaim.amountDue" | "result.rollbackClaim.claimKey" | "result.rollbackClaim.collectedAmount" | "result.rollbackClaim.currency" | "result.rollbackClaim.openingCollection" | "result.rollbackClaim.openingCollection.amountDue" | "result.rollbackClaim.openingCollection.collectedAmount" | "result.rollbackClaim.openingCollection.operationKey" | "result.rollbackClaim.openingCollection.revision" | "result.rollbackClaim.outstanding" | "result.rollbackClaim.reservedAmount" | "result.rollbackClaim.revision" | "result.rollbackClaim.scopeKey" | "result.rollbackClaim.sign" | "result.rollbackClaim.sourceChargeId" | "result.rollbackClaim.sourceGross" | "result.rollbackClaim.sourceProcessingFee" | "retryDelayMs" | "rollback" | "rollback.expectedRevision" | "rollback.groupKey" | "scopeKey" | "source" | "source.customerAccountId" | "source.gross" | "source.groupKey" | "source.invoiceId" | "source.kind" | "source.paymentIntentId" | "source.stripeAccountId" | "source.stripePriceId" | "source.stripeProductId" | "source.subscriptionId" | "status" | "version" | "workflowId">, {
3898
+ by_claim_status: ["claimKey", "status", "_creationTime"];
3899
+ by_payment_scope: ["accountId", "scopeKey", "currency", "source.paymentIntentId", "_creationTime"];
3900
+ by_request: ["requestKey", "_creationTime"];
3901
+ }, {}, {}>;
2698
3902
  recoveryWorkflowOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
2699
3903
  accountId: string;
2700
3904
  activePhase?: "execute" | "reconcile" | undefined;
@@ -2967,6 +4171,48 @@ export declare function historical(currency?: string): Promise<{
2967
4171
  accountId: string;
2968
4172
  cancelRequested: boolean;
2969
4173
  enabled: boolean;
4174
+ execution?: {
4175
+ apply?: {
4176
+ receipt?: {
4177
+ customerAccount: string;
4178
+ enabled?: boolean | undefined;
4179
+ paymentMethodId: string | null;
4180
+ paymentMethodTypes?: string[] | null | undefined;
4181
+ phase: "apply" | "attach" | "create";
4182
+ providerApiVersion: string;
4183
+ stripeSubscriptionId: string;
4184
+ } | undefined;
4185
+ state: "running" | "succeeded" | "unknown";
4186
+ } | undefined;
4187
+ attach?: {
4188
+ receipt?: {
4189
+ customerAccount: string;
4190
+ enabled?: boolean | undefined;
4191
+ paymentMethodId: string | null;
4192
+ paymentMethodTypes?: string[] | null | undefined;
4193
+ phase: "apply" | "attach" | "create";
4194
+ providerApiVersion: string;
4195
+ stripeSubscriptionId: string;
4196
+ } | undefined;
4197
+ state: "running" | "succeeded" | "unknown";
4198
+ } | undefined;
4199
+ create?: {
4200
+ receipt?: {
4201
+ customerAccount: string;
4202
+ enabled?: boolean | undefined;
4203
+ paymentMethodId: string | null;
4204
+ paymentMethodTypes?: string[] | null | undefined;
4205
+ phase: "apply" | "attach" | "create";
4206
+ providerApiVersion: string;
4207
+ stripeSubscriptionId: string;
4208
+ } | undefined;
4209
+ state: "running" | "succeeded" | "unknown";
4210
+ } | undefined;
4211
+ definitionVersion: string;
4212
+ providerAction: string;
4213
+ providerApiVersion: string;
4214
+ workflowId?: string | undefined;
4215
+ } | undefined;
2970
4216
  failureCode?: "invalid_scope" | "policy_invalid" | "unsupported_source" | undefined;
2971
4217
  kind: "apply" | "prepare";
2972
4218
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
@@ -3022,7 +4268,147 @@ export declare function historical(currency?: string): Promise<{
3022
4268
  paymentMethodTypes: import("convex/values").VUnion<string[] | null, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "required", never>;
3023
4269
  providerApiVersion: import("convex/values").VString<string, "required">;
3024
4270
  }, "optional", "customerAccount" | "paymentMethodId" | "paymentMethodTypes" | "providerApiVersion" | "stripeSubscriptionId">;
3025
- }, "required", "accountId" | "cancelRequested" | "enabled" | "failureCode" | "kind" | "preparationId" | "providerKey" | "providerKeys" | "providerKeys.attach" | "providerKeys.create" | "providerKeys.disable" | "providerKeys.enable" | "receipt" | "receipt.customerAccount" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "scopeKey" | "state" | "version">, {
4271
+ execution: import("convex/values").VObject<{
4272
+ apply?: {
4273
+ receipt?: {
4274
+ customerAccount: string;
4275
+ enabled?: boolean | undefined;
4276
+ paymentMethodId: string | null;
4277
+ paymentMethodTypes?: string[] | null | undefined;
4278
+ phase: "apply" | "attach" | "create";
4279
+ providerApiVersion: string;
4280
+ stripeSubscriptionId: string;
4281
+ } | undefined;
4282
+ state: "running" | "succeeded" | "unknown";
4283
+ } | undefined;
4284
+ attach?: {
4285
+ receipt?: {
4286
+ customerAccount: string;
4287
+ enabled?: boolean | undefined;
4288
+ paymentMethodId: string | null;
4289
+ paymentMethodTypes?: string[] | null | undefined;
4290
+ phase: "apply" | "attach" | "create";
4291
+ providerApiVersion: string;
4292
+ stripeSubscriptionId: string;
4293
+ } | undefined;
4294
+ state: "running" | "succeeded" | "unknown";
4295
+ } | undefined;
4296
+ create?: {
4297
+ receipt?: {
4298
+ customerAccount: string;
4299
+ enabled?: boolean | undefined;
4300
+ paymentMethodId: string | null;
4301
+ paymentMethodTypes?: string[] | null | undefined;
4302
+ phase: "apply" | "attach" | "create";
4303
+ providerApiVersion: string;
4304
+ stripeSubscriptionId: string;
4305
+ } | undefined;
4306
+ state: "running" | "succeeded" | "unknown";
4307
+ } | undefined;
4308
+ definitionVersion: string;
4309
+ providerAction: string;
4310
+ providerApiVersion: string;
4311
+ workflowId?: string | undefined;
4312
+ } | undefined, {
4313
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
4314
+ definitionVersion: import("convex/values").VString<string, "required">;
4315
+ providerApiVersion: import("convex/values").VString<string, "required">;
4316
+ providerAction: import("convex/values").VString<string, "required">;
4317
+ create: import("convex/values").VObject<{
4318
+ receipt?: {
4319
+ customerAccount: string;
4320
+ enabled?: boolean | undefined;
4321
+ paymentMethodId: string | null;
4322
+ paymentMethodTypes?: string[] | null | undefined;
4323
+ phase: "apply" | "attach" | "create";
4324
+ providerApiVersion: string;
4325
+ stripeSubscriptionId: string;
4326
+ } | undefined;
4327
+ state: "running" | "succeeded" | "unknown";
4328
+ } | undefined, {
4329
+ state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
4330
+ receipt: import("convex/values").VObject<{
4331
+ customerAccount: string;
4332
+ enabled?: boolean | undefined;
4333
+ paymentMethodId: string | null;
4334
+ paymentMethodTypes?: string[] | null | undefined;
4335
+ phase: "apply" | "attach" | "create";
4336
+ providerApiVersion: string;
4337
+ stripeSubscriptionId: string;
4338
+ } | undefined, {
4339
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
4340
+ customerAccount: import("convex/values").VString<string, "required">;
4341
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
4342
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
4343
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
4344
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
4345
+ providerApiVersion: import("convex/values").VString<string, "required">;
4346
+ }, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
4347
+ }, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
4348
+ attach: import("convex/values").VObject<{
4349
+ receipt?: {
4350
+ customerAccount: string;
4351
+ enabled?: boolean | undefined;
4352
+ paymentMethodId: string | null;
4353
+ paymentMethodTypes?: string[] | null | undefined;
4354
+ phase: "apply" | "attach" | "create";
4355
+ providerApiVersion: string;
4356
+ stripeSubscriptionId: string;
4357
+ } | undefined;
4358
+ state: "running" | "succeeded" | "unknown";
4359
+ } | undefined, {
4360
+ state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
4361
+ receipt: import("convex/values").VObject<{
4362
+ customerAccount: string;
4363
+ enabled?: boolean | undefined;
4364
+ paymentMethodId: string | null;
4365
+ paymentMethodTypes?: string[] | null | undefined;
4366
+ phase: "apply" | "attach" | "create";
4367
+ providerApiVersion: string;
4368
+ stripeSubscriptionId: string;
4369
+ } | undefined, {
4370
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
4371
+ customerAccount: import("convex/values").VString<string, "required">;
4372
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
4373
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
4374
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
4375
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
4376
+ providerApiVersion: import("convex/values").VString<string, "required">;
4377
+ }, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
4378
+ }, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
4379
+ apply: import("convex/values").VObject<{
4380
+ receipt?: {
4381
+ customerAccount: string;
4382
+ enabled?: boolean | undefined;
4383
+ paymentMethodId: string | null;
4384
+ paymentMethodTypes?: string[] | null | undefined;
4385
+ phase: "apply" | "attach" | "create";
4386
+ providerApiVersion: string;
4387
+ stripeSubscriptionId: string;
4388
+ } | undefined;
4389
+ state: "running" | "succeeded" | "unknown";
4390
+ } | undefined, {
4391
+ state: import("convex/values").VUnion<"running" | "succeeded" | "unknown", [import("convex/values").VLiteral<"running", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"succeeded", "required">], "required", never>;
4392
+ receipt: import("convex/values").VObject<{
4393
+ customerAccount: string;
4394
+ enabled?: boolean | undefined;
4395
+ paymentMethodId: string | null;
4396
+ paymentMethodTypes?: string[] | null | undefined;
4397
+ phase: "apply" | "attach" | "create";
4398
+ providerApiVersion: string;
4399
+ stripeSubscriptionId: string;
4400
+ } | undefined, {
4401
+ phase: import("convex/values").VUnion<"apply" | "attach" | "create", [import("convex/values").VLiteral<"create", "required">, import("convex/values").VLiteral<"attach", "required">, import("convex/values").VLiteral<"apply", "required">], "required", never>;
4402
+ customerAccount: import("convex/values").VString<string, "required">;
4403
+ stripeSubscriptionId: import("convex/values").VString<string, "required">;
4404
+ paymentMethodId: import("convex/values").VUnion<string | null, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "required", never>;
4405
+ paymentMethodTypes: import("convex/values").VUnion<string[] | null | undefined, [import("convex/values").VArray<string[], import("convex/values").VString<string, "required">, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
4406
+ enabled: import("convex/values").VBoolean<boolean | undefined, "optional">;
4407
+ providerApiVersion: import("convex/values").VString<string, "required">;
4408
+ }, "optional", "customerAccount" | "enabled" | "paymentMethodId" | "paymentMethodTypes" | "phase" | "providerApiVersion" | "stripeSubscriptionId">;
4409
+ }, "optional", "receipt" | "receipt.customerAccount" | "receipt.enabled" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.phase" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "state">;
4410
+ }, "optional", "apply" | "apply.receipt" | "apply.receipt.customerAccount" | "apply.receipt.enabled" | "apply.receipt.paymentMethodId" | "apply.receipt.paymentMethodTypes" | "apply.receipt.phase" | "apply.receipt.providerApiVersion" | "apply.receipt.stripeSubscriptionId" | "apply.state" | "attach" | "attach.receipt" | "attach.receipt.customerAccount" | "attach.receipt.enabled" | "attach.receipt.paymentMethodId" | "attach.receipt.paymentMethodTypes" | "attach.receipt.phase" | "attach.receipt.providerApiVersion" | "attach.receipt.stripeSubscriptionId" | "attach.state" | "create" | "create.receipt" | "create.receipt.customerAccount" | "create.receipt.enabled" | "create.receipt.paymentMethodId" | "create.receipt.paymentMethodTypes" | "create.receipt.phase" | "create.receipt.providerApiVersion" | "create.receipt.stripeSubscriptionId" | "create.state" | "definitionVersion" | "providerAction" | "providerApiVersion" | "workflowId">;
4411
+ }, "required", "accountId" | "cancelRequested" | "enabled" | "execution" | "execution.apply" | "execution.apply.receipt" | "execution.apply.receipt.customerAccount" | "execution.apply.receipt.enabled" | "execution.apply.receipt.paymentMethodId" | "execution.apply.receipt.paymentMethodTypes" | "execution.apply.receipt.phase" | "execution.apply.receipt.providerApiVersion" | "execution.apply.receipt.stripeSubscriptionId" | "execution.apply.state" | "execution.attach" | "execution.attach.receipt" | "execution.attach.receipt.customerAccount" | "execution.attach.receipt.enabled" | "execution.attach.receipt.paymentMethodId" | "execution.attach.receipt.paymentMethodTypes" | "execution.attach.receipt.phase" | "execution.attach.receipt.providerApiVersion" | "execution.attach.receipt.stripeSubscriptionId" | "execution.attach.state" | "execution.create" | "execution.create.receipt" | "execution.create.receipt.customerAccount" | "execution.create.receipt.enabled" | "execution.create.receipt.paymentMethodId" | "execution.create.receipt.paymentMethodTypes" | "execution.create.receipt.phase" | "execution.create.receipt.providerApiVersion" | "execution.create.receipt.stripeSubscriptionId" | "execution.create.state" | "execution.definitionVersion" | "execution.providerAction" | "execution.providerApiVersion" | "execution.workflowId" | "failureCode" | "kind" | "preparationId" | "providerKey" | "providerKeys" | "providerKeys.attach" | "providerKeys.create" | "providerKeys.disable" | "providerKeys.enable" | "receipt" | "receipt.customerAccount" | "receipt.paymentMethodId" | "receipt.paymentMethodTypes" | "receipt.providerApiVersion" | "receipt.stripeSubscriptionId" | "scopeKey" | "state" | "version">, {
3026
4412
  by_preparation_version: ["preparationId", "version", "_creationTime"];
3027
4413
  }, {}, {}>;
3028
4414
  balanceFundingRequests: import("convex/server").TableDefinition<import("convex/values").VObject<{