@fantastic.dev/better-stripe 0.42.0 → 0.44.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 (127) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +11 -4
  3. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +1022 -0
  4. package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
  5. package/dist/client/connect/payoutExecutionTestHelpers.d.ts +511 -0
  6. package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
  7. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +1054 -32
  8. package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
  9. package/dist/client/connect/payoutSyncTestHelpers.d.ts +527 -16
  10. package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
  11. package/dist/client/costRecovery-invoices.d.ts +3 -2
  12. package/dist/client/costRecovery-invoices.d.ts.map +1 -1
  13. package/dist/client/costRecovery-invoices.js +10 -5
  14. package/dist/client/costRecovery-invoices.js.map +1 -1
  15. package/dist/client/costRecovery.d.ts +4 -2
  16. package/dist/client/costRecovery.d.ts.map +1 -1
  17. package/dist/client/costRecovery.js +2 -2
  18. package/dist/client/costRecovery.js.map +1 -1
  19. package/dist/client/processingCostReconciliation/client.d.ts +14 -0
  20. package/dist/client/processingCostReconciliation/client.d.ts.map +1 -0
  21. package/dist/client/processingCostReconciliation/client.js +35 -0
  22. package/dist/client/processingCostReconciliation/client.js.map +1 -0
  23. package/dist/client/processingCostReconciliation/contracts.d.ts +172 -0
  24. package/dist/client/processingCostReconciliation/contracts.d.ts.map +1 -0
  25. package/dist/client/processingCostReconciliation/contracts.js +55 -0
  26. package/dist/client/processingCostReconciliation/contracts.js.map +1 -0
  27. package/dist/client/processingCostReconciliation/invoiceFunding.d.ts +15 -0
  28. package/dist/client/processingCostReconciliation/invoiceFunding.d.ts.map +1 -0
  29. package/dist/client/processingCostReconciliation/invoiceFunding.js +195 -0
  30. package/dist/client/processingCostReconciliation/invoiceFunding.js.map +1 -0
  31. package/dist/client/processingCostReconciliation/provider.d.ts +9 -0
  32. package/dist/client/processingCostReconciliation/provider.d.ts.map +1 -0
  33. package/dist/client/processingCostReconciliation/provider.js +148 -0
  34. package/dist/client/processingCostReconciliation/provider.js.map +1 -0
  35. package/dist/client/settlement/processingCostHistory.d.ts +12 -0
  36. package/dist/client/settlement/processingCostHistory.d.ts.map +1 -0
  37. package/dist/client/settlement/processingCostHistory.js +20 -0
  38. package/dist/client/settlement/processingCostHistory.js.map +1 -0
  39. package/dist/client/settlement/processingCosts.d.ts +3 -0
  40. package/dist/client/settlement/processingCosts.d.ts.map +1 -1
  41. package/dist/client/settlement/processingCosts.js +27 -7
  42. package/dist/client/settlement/processingCosts.js.map +1 -1
  43. package/dist/component/_generated/api.d.ts +18 -0
  44. package/dist/component/_generated/api.d.ts.map +1 -1
  45. package/dist/component/_generated/api.js.map +1 -1
  46. package/dist/component/_generated/component.d.ts +515 -0
  47. package/dist/component/_generated/component.d.ts.map +1 -1
  48. package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
  49. package/dist/component/balanceFunding/mutations.d.ts +16 -16
  50. package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
  51. package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
  52. package/dist/component/earnings/triggers.d.ts +318 -16
  53. package/dist/component/earnings/triggers.d.ts.map +1 -1
  54. package/dist/component/payoutRelease/queries.d.ts +2 -2
  55. package/dist/component/payoutRelease/queries.d.ts.map +1 -1
  56. package/dist/component/processingCostReconciliation/adoption.d.ts +29 -0
  57. package/dist/component/processingCostReconciliation/adoption.d.ts.map +1 -0
  58. package/dist/component/processingCostReconciliation/adoption.js +58 -0
  59. package/dist/component/processingCostReconciliation/adoption.js.map +1 -0
  60. package/dist/component/processingCostReconciliation/bridge.d.ts +45 -0
  61. package/dist/component/processingCostReconciliation/bridge.d.ts.map +1 -0
  62. package/dist/component/processingCostReconciliation/bridge.js +41 -0
  63. package/dist/component/processingCostReconciliation/bridge.js.map +1 -0
  64. package/dist/component/processingCostReconciliation/helpers.d.ts +327 -0
  65. package/dist/component/processingCostReconciliation/helpers.d.ts.map +1 -0
  66. package/dist/component/processingCostReconciliation/helpers.js +39 -0
  67. package/dist/component/processingCostReconciliation/helpers.js.map +1 -0
  68. package/dist/component/processingCostReconciliation/mutations.d.ts +303 -0
  69. package/dist/component/processingCostReconciliation/mutations.d.ts.map +1 -0
  70. package/dist/component/processingCostReconciliation/mutations.js +121 -0
  71. package/dist/component/processingCostReconciliation/mutations.js.map +1 -0
  72. package/dist/component/processingCostReconciliation/queries.d.ts +422 -0
  73. package/dist/component/processingCostReconciliation/queries.d.ts.map +1 -0
  74. package/dist/component/processingCostReconciliation/queries.js +19 -0
  75. package/dist/component/processingCostReconciliation/queries.js.map +1 -0
  76. package/dist/component/processingCostReconciliation/rollback.d.ts +21 -0
  77. package/dist/component/processingCostReconciliation/rollback.d.ts.map +1 -0
  78. package/dist/component/processingCostReconciliation/rollback.js +54 -0
  79. package/dist/component/processingCostReconciliation/rollback.js.map +1 -0
  80. package/dist/component/processingCostReconciliation/schema.d.ts +2460 -0
  81. package/dist/component/processingCostReconciliation/schema.d.ts.map +1 -0
  82. package/dist/component/processingCostReconciliation/schema.js +137 -0
  83. package/dist/component/processingCostReconciliation/schema.js.map +1 -0
  84. package/dist/component/processingCostReconciliation/steps.d.ts +306 -0
  85. package/dist/component/processingCostReconciliation/steps.d.ts.map +1 -0
  86. package/dist/component/processingCostReconciliation/steps.js +149 -0
  87. package/dist/component/processingCostReconciliation/steps.js.map +1 -0
  88. package/dist/component/processingCostReconciliation/validation.d.ts +13 -0
  89. package/dist/component/processingCostReconciliation/validation.d.ts.map +1 -0
  90. package/dist/component/processingCostReconciliation/validation.js +61 -0
  91. package/dist/component/processingCostReconciliation/validation.js.map +1 -0
  92. package/dist/component/processingCostReconciliation/workflow.d.ts +105 -0
  93. package/dist/component/processingCostReconciliation/workflow.d.ts.map +1 -0
  94. package/dist/component/processingCostReconciliation/workflow.js +33 -0
  95. package/dist/component/processingCostReconciliation/workflow.js.map +1 -0
  96. package/dist/component/schema.d.ts +511 -0
  97. package/dist/component/schema.js +2 -0
  98. package/dist/component/schema.js.map +1 -1
  99. package/docs/react-workflows.md +16 -8
  100. package/package.json +1 -1
  101. package/src/client/costRecovery-invoices.ts +19 -4
  102. package/src/client/costRecovery.ts +4 -2
  103. package/src/client/processingCostReconciliation/client.ts +75 -0
  104. package/src/client/processingCostReconciliation/contracts.ts +176 -0
  105. package/src/client/processingCostReconciliation/invoiceFunding.ts +270 -0
  106. package/src/client/processingCostReconciliation/invoiceProvider.test.ts +353 -0
  107. package/src/client/processingCostReconciliation/provider.test.ts +324 -0
  108. package/src/client/processingCostReconciliation/provider.ts +178 -0
  109. package/src/client/settlement/processingCostHistory.ts +31 -0
  110. package/src/client/settlement/processingCosts.ts +50 -15
  111. package/src/component/_generated/api.ts +18 -0
  112. package/src/component/_generated/component.ts +570 -0
  113. package/src/component/processingCostReconciliation/adoption.test.ts +206 -0
  114. package/src/component/processingCostReconciliation/adoption.ts +77 -0
  115. package/src/component/processingCostReconciliation/bridge.ts +50 -0
  116. package/src/component/processingCostReconciliation/helpers.ts +55 -0
  117. package/src/component/processingCostReconciliation/invoice.test.ts +152 -0
  118. package/src/component/processingCostReconciliation/mutations.ts +148 -0
  119. package/src/component/processingCostReconciliation/queries.ts +18 -0
  120. package/src/component/processingCostReconciliation/rollback.ts +72 -0
  121. package/src/component/processingCostReconciliation/schema.ts +191 -0
  122. package/src/component/processingCostReconciliation/state.test.ts +407 -0
  123. package/src/component/processingCostReconciliation/steps.ts +168 -0
  124. package/src/component/processingCostReconciliation/validation.ts +79 -0
  125. package/src/component/processingCostReconciliation/workflow.test.ts +329 -0
  126. package/src/component/processingCostReconciliation/workflow.ts +50 -0
  127. package/src/component/schema.ts +2 -0
@@ -1,5 +1,516 @@
1
1
  export declare function large(count?: number, amount?: number): Promise<{
2
2
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
3
+ processingCostReconciliationOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
4
+ accountId: string;
5
+ claimKey: string;
6
+ currency: string;
7
+ definitionVersion: number;
8
+ expectedRevision: number;
9
+ failure?: {
10
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
11
+ retryable: true;
12
+ status: "not_ready";
13
+ } | {
14
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
15
+ retryable: false;
16
+ status: "conflict";
17
+ } | {
18
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
19
+ retryable: false;
20
+ status: "rejected";
21
+ } | {
22
+ reason: "history_incomplete" | "provider_outcome_unknown";
23
+ retryable: false;
24
+ status: "unknown";
25
+ } | undefined;
26
+ importHook?: string | undefined;
27
+ maxAttempts: number;
28
+ policy: {
29
+ liability: {
30
+ disputeCosts: "all" | "none";
31
+ processingCosts: "all" | "none" | "uncovered";
32
+ };
33
+ rounding: "ceil" | "floor" | "nearest";
34
+ sellingFee: number;
35
+ };
36
+ projection?: string | undefined;
37
+ provider: string;
38
+ providerApiVersion: string;
39
+ requestKey: string;
40
+ result?: {
41
+ claim: {
42
+ _creationTime: number;
43
+ _id: import("convex/values").GenericId<"recoveryClaims">;
44
+ accountId: string;
45
+ amountDue: number;
46
+ claimKey: string;
47
+ collectedAmount: number;
48
+ currency: string;
49
+ openingCollection?: {
50
+ amountDue: number;
51
+ collectedAmount: number;
52
+ operationKey: string;
53
+ revision: number;
54
+ } | undefined;
55
+ outstanding: number;
56
+ reservedAmount: number;
57
+ revision: number;
58
+ scopeKey: string;
59
+ sign: "negative" | "positive" | "zero";
60
+ sourceChargeId: string;
61
+ sourceGross: number;
62
+ sourceProcessingFee: number;
63
+ };
64
+ deficit: {
65
+ amountDue: number;
66
+ currency: string;
67
+ disputeLiability: number;
68
+ processingLiability: number;
69
+ retainedFee: number;
70
+ };
71
+ observation: {
72
+ currency: string;
73
+ disputeFees: number;
74
+ gross: number;
75
+ originalProcessingFee: number;
76
+ paymentIntentId: string;
77
+ principalReturned: number;
78
+ processingFee: number;
79
+ provenance: {
80
+ customerAccountId: string;
81
+ invoiceId: string;
82
+ invoicePaymentId: string;
83
+ recoveryInvoiceItemId?: string | undefined;
84
+ stripePriceId?: string | undefined;
85
+ stripeProductId?: string | undefined;
86
+ subscriptionId?: string | undefined;
87
+ };
88
+ sourceChargeId: string;
89
+ };
90
+ rollbackClaim?: {
91
+ _creationTime: number;
92
+ _id: import("convex/values").GenericId<"recoveryClaims">;
93
+ accountId: string;
94
+ amountDue: number;
95
+ claimKey: string;
96
+ collectedAmount: number;
97
+ currency: string;
98
+ openingCollection?: {
99
+ amountDue: number;
100
+ collectedAmount: number;
101
+ operationKey: string;
102
+ revision: number;
103
+ } | undefined;
104
+ outstanding: number;
105
+ reservedAmount: number;
106
+ revision: number;
107
+ scopeKey: string;
108
+ sign: "negative" | "positive" | "zero";
109
+ sourceChargeId: string;
110
+ sourceGross: number;
111
+ sourceProcessingFee: number;
112
+ } | undefined;
113
+ } | undefined;
114
+ retryDelayMs: number;
115
+ rollback?: {
116
+ expectedRevision: number;
117
+ groupKey: string;
118
+ } | undefined;
119
+ scopeKey: string;
120
+ source: {
121
+ customerAccountId: string;
122
+ gross: number;
123
+ invoiceId?: string | undefined;
124
+ kind: "sale";
125
+ paymentIntentId: string;
126
+ stripeAccountId?: string | undefined;
127
+ stripePriceId?: string | undefined;
128
+ stripeProductId?: string | undefined;
129
+ subscriptionId?: string | undefined;
130
+ } | {
131
+ gross: number;
132
+ groupKey: string;
133
+ kind: "invoice_recovery";
134
+ paymentIntentId: string;
135
+ };
136
+ status: "completed" | "conflict" | "queued" | "rejected" | "running" | "unknown" | "waiting";
137
+ version: number;
138
+ workflowId?: string | undefined;
139
+ }, {
140
+ accountId: import("convex/values").VString<string, "required">;
141
+ scopeKey: import("convex/values").VString<string, "required">;
142
+ currency: import("convex/values").VString<string, "required">;
143
+ claimKey: import("convex/values").VString<string, "required">;
144
+ source: import("convex/values").VUnion<{
145
+ customerAccountId: string;
146
+ gross: number;
147
+ invoiceId?: string | undefined;
148
+ kind: "sale";
149
+ paymentIntentId: string;
150
+ stripeAccountId?: string | undefined;
151
+ stripePriceId?: string | undefined;
152
+ stripeProductId?: string | undefined;
153
+ subscriptionId?: string | undefined;
154
+ } | {
155
+ gross: number;
156
+ groupKey: string;
157
+ kind: "invoice_recovery";
158
+ paymentIntentId: string;
159
+ }, [import("convex/values").VObject<{
160
+ customerAccountId: string;
161
+ gross: number;
162
+ invoiceId?: string | undefined;
163
+ kind: "sale";
164
+ paymentIntentId: string;
165
+ stripeAccountId?: string | undefined;
166
+ stripePriceId?: string | undefined;
167
+ stripeProductId?: string | undefined;
168
+ subscriptionId?: string | undefined;
169
+ }, {
170
+ kind: import("convex/values").VLiteral<"sale", "required">;
171
+ paymentIntentId: import("convex/values").VString<string, "required">;
172
+ gross: import("convex/values").VFloat64<number, "required">;
173
+ customerAccountId: import("convex/values").VString<string, "required">;
174
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
175
+ subscriptionId: import("convex/values").VString<string | undefined, "optional">;
176
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
177
+ stripePriceId: import("convex/values").VString<string | undefined, "optional">;
178
+ stripeProductId: import("convex/values").VString<string | undefined, "optional">;
179
+ }, "required", "customerAccountId" | "gross" | "invoiceId" | "kind" | "paymentIntentId" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId">, import("convex/values").VObject<{
180
+ gross: number;
181
+ groupKey: string;
182
+ kind: "invoice_recovery";
183
+ paymentIntentId: string;
184
+ }, {
185
+ kind: import("convex/values").VLiteral<"invoice_recovery", "required">;
186
+ paymentIntentId: import("convex/values").VString<string, "required">;
187
+ gross: import("convex/values").VFloat64<number, "required">;
188
+ groupKey: import("convex/values").VString<string, "required">;
189
+ }, "required", "gross" | "groupKey" | "kind" | "paymentIntentId">], "required", "customerAccountId" | "gross" | "groupKey" | "invoiceId" | "kind" | "paymentIntentId" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId">;
190
+ policy: import("convex/values").VObject<{
191
+ liability: {
192
+ disputeCosts: "all" | "none";
193
+ processingCosts: "all" | "none" | "uncovered";
194
+ };
195
+ rounding: "ceil" | "floor" | "nearest";
196
+ sellingFee: number;
197
+ }, {
198
+ sellingFee: import("convex/values").VFloat64<number, "required">;
199
+ liability: import("convex/values").VObject<{
200
+ disputeCosts: "all" | "none";
201
+ processingCosts: "all" | "none" | "uncovered";
202
+ }, {
203
+ 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>;
204
+ disputeCosts: import("convex/values").VUnion<"all" | "none", [import("convex/values").VLiteral<"all", "required">, import("convex/values").VLiteral<"none", "required">], "required", never>;
205
+ }, "required", "disputeCosts" | "processingCosts">;
206
+ 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>;
207
+ }, "required", "liability" | "liability.disputeCosts" | "liability.processingCosts" | "rounding" | "sellingFee">;
208
+ expectedRevision: import("convex/values").VFloat64<number, "required">;
209
+ rollback: import("convex/values").VObject<{
210
+ expectedRevision: number;
211
+ groupKey: string;
212
+ } | undefined, {
213
+ groupKey: import("convex/values").VString<string, "required">;
214
+ expectedRevision: import("convex/values").VFloat64<number, "required">;
215
+ }, "optional", "expectedRevision" | "groupKey">;
216
+ provider: import("convex/values").VString<string, "required">;
217
+ projection: import("convex/values").VString<string | undefined, "optional">;
218
+ importHook: import("convex/values").VString<string | undefined, "optional">;
219
+ providerApiVersion: import("convex/values").VString<string, "required">;
220
+ definitionVersion: import("convex/values").VFloat64<number, "required">;
221
+ maxAttempts: import("convex/values").VFloat64<number, "required">;
222
+ retryDelayMs: import("convex/values").VFloat64<number, "required">;
223
+ requestKey: import("convex/values").VString<string, "required">;
224
+ version: import("convex/values").VFloat64<number, "required">;
225
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
226
+ 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>;
227
+ failure: import("convex/values").VUnion<{
228
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
229
+ retryable: true;
230
+ status: "not_ready";
231
+ } | {
232
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
233
+ retryable: false;
234
+ status: "conflict";
235
+ } | {
236
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
237
+ retryable: false;
238
+ status: "rejected";
239
+ } | {
240
+ reason: "history_incomplete" | "provider_outcome_unknown";
241
+ retryable: false;
242
+ status: "unknown";
243
+ } | undefined, [import("convex/values").VObject<{
244
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
245
+ retryable: true;
246
+ status: "not_ready";
247
+ }, {
248
+ status: import("convex/values").VLiteral<"not_ready", "required">;
249
+ 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>;
250
+ retryable: import("convex/values").VLiteral<true, "required">;
251
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
252
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
253
+ retryable: false;
254
+ status: "conflict";
255
+ }, {
256
+ status: import("convex/values").VLiteral<"conflict", "required">;
257
+ 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>;
258
+ retryable: import("convex/values").VLiteral<false, "required">;
259
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
260
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
261
+ retryable: false;
262
+ status: "rejected";
263
+ }, {
264
+ status: import("convex/values").VLiteral<"rejected", "required">;
265
+ 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>;
266
+ retryable: import("convex/values").VLiteral<false, "required">;
267
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
268
+ reason: "history_incomplete" | "provider_outcome_unknown";
269
+ retryable: false;
270
+ status: "unknown";
271
+ }, {
272
+ status: import("convex/values").VLiteral<"unknown", "required">;
273
+ 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>;
274
+ retryable: import("convex/values").VLiteral<false, "required">;
275
+ }, "required", "reason" | "retryable" | "status">], "optional", "reason" | "retryable" | "status">;
276
+ result: import("convex/values").VObject<{
277
+ claim: {
278
+ _creationTime: number;
279
+ _id: import("convex/values").GenericId<"recoveryClaims">;
280
+ accountId: string;
281
+ amountDue: number;
282
+ claimKey: string;
283
+ collectedAmount: number;
284
+ currency: string;
285
+ openingCollection?: {
286
+ amountDue: number;
287
+ collectedAmount: number;
288
+ operationKey: string;
289
+ revision: number;
290
+ } | undefined;
291
+ outstanding: number;
292
+ reservedAmount: number;
293
+ revision: number;
294
+ scopeKey: string;
295
+ sign: "negative" | "positive" | "zero";
296
+ sourceChargeId: string;
297
+ sourceGross: number;
298
+ sourceProcessingFee: number;
299
+ };
300
+ deficit: {
301
+ amountDue: number;
302
+ currency: string;
303
+ disputeLiability: number;
304
+ processingLiability: number;
305
+ retainedFee: number;
306
+ };
307
+ observation: {
308
+ currency: string;
309
+ disputeFees: number;
310
+ gross: number;
311
+ originalProcessingFee: number;
312
+ paymentIntentId: string;
313
+ principalReturned: number;
314
+ processingFee: number;
315
+ provenance: {
316
+ customerAccountId: string;
317
+ invoiceId: string;
318
+ invoicePaymentId: string;
319
+ recoveryInvoiceItemId?: string | undefined;
320
+ stripePriceId?: string | undefined;
321
+ stripeProductId?: string | undefined;
322
+ subscriptionId?: string | undefined;
323
+ };
324
+ sourceChargeId: string;
325
+ };
326
+ rollbackClaim?: {
327
+ _creationTime: number;
328
+ _id: import("convex/values").GenericId<"recoveryClaims">;
329
+ accountId: string;
330
+ amountDue: number;
331
+ claimKey: string;
332
+ collectedAmount: number;
333
+ currency: string;
334
+ openingCollection?: {
335
+ amountDue: number;
336
+ collectedAmount: number;
337
+ operationKey: string;
338
+ revision: number;
339
+ } | undefined;
340
+ outstanding: number;
341
+ reservedAmount: number;
342
+ revision: number;
343
+ scopeKey: string;
344
+ sign: "negative" | "positive" | "zero";
345
+ sourceChargeId: string;
346
+ sourceGross: number;
347
+ sourceProcessingFee: number;
348
+ } | undefined;
349
+ } | undefined, {
350
+ claim: import("convex/values").VObject<{
351
+ _creationTime: number;
352
+ _id: import("convex/values").GenericId<"recoveryClaims">;
353
+ accountId: string;
354
+ amountDue: number;
355
+ claimKey: string;
356
+ collectedAmount: number;
357
+ currency: string;
358
+ openingCollection?: {
359
+ amountDue: number;
360
+ collectedAmount: number;
361
+ operationKey: string;
362
+ revision: number;
363
+ } | undefined;
364
+ outstanding: number;
365
+ reservedAmount: number;
366
+ revision: number;
367
+ scopeKey: string;
368
+ sign: "negative" | "positive" | "zero";
369
+ sourceChargeId: string;
370
+ sourceGross: number;
371
+ sourceProcessingFee: number;
372
+ }, {
373
+ accountId: import("convex/values").VString<string, "required">;
374
+ scopeKey: import("convex/values").VString<string, "required">;
375
+ currency: import("convex/values").VString<string, "required">;
376
+ claimKey: import("convex/values").VString<string, "required">;
377
+ sourceChargeId: import("convex/values").VString<string, "required">;
378
+ sourceGross: import("convex/values").VFloat64<number, "required">;
379
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
380
+ amountDue: import("convex/values").VFloat64<number, "required">;
381
+ revision: import("convex/values").VFloat64<number, "required">;
382
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
383
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
384
+ outstanding: import("convex/values").VFloat64<number, "required">;
385
+ 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>;
386
+ openingCollection: import("convex/values").VObject<{
387
+ amountDue: number;
388
+ collectedAmount: number;
389
+ operationKey: string;
390
+ revision: number;
391
+ } | undefined, {
392
+ operationKey: import("convex/values").VString<string, "required">;
393
+ amountDue: import("convex/values").VFloat64<number, "required">;
394
+ revision: import("convex/values").VFloat64<number, "required">;
395
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
396
+ }, "optional", "amountDue" | "collectedAmount" | "operationKey" | "revision">;
397
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
398
+ _creationTime: import("convex/values").VFloat64<number, "required">;
399
+ }, "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">;
400
+ rollbackClaim: import("convex/values").VObject<{
401
+ _creationTime: number;
402
+ _id: import("convex/values").GenericId<"recoveryClaims">;
403
+ accountId: string;
404
+ amountDue: number;
405
+ claimKey: string;
406
+ collectedAmount: number;
407
+ currency: string;
408
+ openingCollection?: {
409
+ amountDue: number;
410
+ collectedAmount: number;
411
+ operationKey: string;
412
+ revision: number;
413
+ } | undefined;
414
+ outstanding: number;
415
+ reservedAmount: number;
416
+ revision: number;
417
+ scopeKey: string;
418
+ sign: "negative" | "positive" | "zero";
419
+ sourceChargeId: string;
420
+ sourceGross: number;
421
+ sourceProcessingFee: number;
422
+ } | undefined, {
423
+ accountId: import("convex/values").VString<string, "required">;
424
+ scopeKey: import("convex/values").VString<string, "required">;
425
+ currency: import("convex/values").VString<string, "required">;
426
+ claimKey: import("convex/values").VString<string, "required">;
427
+ sourceChargeId: import("convex/values").VString<string, "required">;
428
+ sourceGross: import("convex/values").VFloat64<number, "required">;
429
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
430
+ amountDue: import("convex/values").VFloat64<number, "required">;
431
+ revision: import("convex/values").VFloat64<number, "required">;
432
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
433
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
434
+ outstanding: import("convex/values").VFloat64<number, "required">;
435
+ 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>;
436
+ openingCollection: import("convex/values").VObject<{
437
+ amountDue: number;
438
+ collectedAmount: number;
439
+ operationKey: string;
440
+ revision: number;
441
+ } | undefined, {
442
+ operationKey: import("convex/values").VString<string, "required">;
443
+ amountDue: import("convex/values").VFloat64<number, "required">;
444
+ revision: import("convex/values").VFloat64<number, "required">;
445
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
446
+ }, "optional", "amountDue" | "collectedAmount" | "operationKey" | "revision">;
447
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
448
+ _creationTime: import("convex/values").VFloat64<number, "required">;
449
+ }, "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">;
450
+ deficit: import("convex/values").VObject<{
451
+ amountDue: number;
452
+ currency: string;
453
+ disputeLiability: number;
454
+ processingLiability: number;
455
+ retainedFee: number;
456
+ }, {
457
+ currency: import("convex/values").VString<string, "required">;
458
+ retainedFee: import("convex/values").VFloat64<number, "required">;
459
+ processingLiability: import("convex/values").VFloat64<number, "required">;
460
+ disputeLiability: import("convex/values").VFloat64<number, "required">;
461
+ amountDue: import("convex/values").VFloat64<number, "required">;
462
+ }, "required", "amountDue" | "currency" | "disputeLiability" | "processingLiability" | "retainedFee">;
463
+ observation: import("convex/values").VObject<{
464
+ currency: string;
465
+ disputeFees: number;
466
+ gross: number;
467
+ originalProcessingFee: number;
468
+ paymentIntentId: string;
469
+ principalReturned: number;
470
+ processingFee: number;
471
+ provenance: {
472
+ customerAccountId: string;
473
+ invoiceId: string;
474
+ invoicePaymentId: string;
475
+ recoveryInvoiceItemId?: string | undefined;
476
+ stripePriceId?: string | undefined;
477
+ stripeProductId?: string | undefined;
478
+ subscriptionId?: string | undefined;
479
+ };
480
+ sourceChargeId: string;
481
+ }, {
482
+ paymentIntentId: import("convex/values").VString<string, "required">;
483
+ sourceChargeId: import("convex/values").VString<string, "required">;
484
+ currency: import("convex/values").VString<string, "required">;
485
+ gross: import("convex/values").VFloat64<number, "required">;
486
+ originalProcessingFee: import("convex/values").VFloat64<number, "required">;
487
+ processingFee: import("convex/values").VFloat64<number, "required">;
488
+ disputeFees: import("convex/values").VFloat64<number, "required">;
489
+ principalReturned: import("convex/values").VFloat64<number, "required">;
490
+ provenance: import("convex/values").VObject<{
491
+ customerAccountId: string;
492
+ invoiceId: string;
493
+ invoicePaymentId: string;
494
+ recoveryInvoiceItemId?: string | undefined;
495
+ stripePriceId?: string | undefined;
496
+ stripeProductId?: string | undefined;
497
+ subscriptionId?: string | undefined;
498
+ }, {
499
+ invoiceId: import("convex/values").VString<string, "required">;
500
+ invoicePaymentId: import("convex/values").VString<string, "required">;
501
+ recoveryInvoiceItemId: import("convex/values").VString<string | undefined, "optional">;
502
+ customerAccountId: import("convex/values").VString<string, "required">;
503
+ subscriptionId: import("convex/values").VString<string | undefined, "optional">;
504
+ stripePriceId: import("convex/values").VString<string | undefined, "optional">;
505
+ stripeProductId: import("convex/values").VString<string | undefined, "optional">;
506
+ }, "required", "customerAccountId" | "invoiceId" | "invoicePaymentId" | "recoveryInvoiceItemId" | "stripePriceId" | "stripeProductId" | "subscriptionId">;
507
+ }, "required", "currency" | "disputeFees" | "gross" | "originalProcessingFee" | "paymentIntentId" | "principalReturned" | "processingFee" | "provenance" | "provenance.customerAccountId" | "provenance.invoiceId" | "provenance.invoicePaymentId" | "provenance.recoveryInvoiceItemId" | "provenance.stripePriceId" | "provenance.stripeProductId" | "provenance.subscriptionId" | "sourceChargeId">;
508
+ }, "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">;
509
+ }, "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">, {
510
+ by_claim_status: ["claimKey", "status", "_creationTime"];
511
+ by_payment_scope: ["accountId", "scopeKey", "currency", "source.paymentIntentId", "_creationTime"];
512
+ by_request: ["requestKey", "_creationTime"];
513
+ }, {}, {}>;
3
514
  recoveryWorkflowOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
4
515
  accountId: string;
5
516
  activePhase?: "execute" | "reconcile" | undefined;
@@ -526,6 +1037,14 @@ export declare function large(count?: number, amount?: number): Promise<{
526
1037
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
527
1038
  requestKey: string;
528
1039
  result?: {
1040
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
1041
+ retryable: false;
1042
+ status: "conflict";
1043
+ } | {
1044
+ reason: "policy_invalid";
1045
+ retryable: false;
1046
+ status: "rejected";
1047
+ } | {
529
1048
  operation: {
530
1049
  accountId: string;
531
1050
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -536,14 +1055,6 @@ export declare function large(count?: number, amount?: number): Promise<{
536
1055
  } | {
537
1056
  enabled: boolean;
538
1057
  status: "unchanged";
539
- } | {
540
- reason: "identity_changed" | "revision_changed" | "scope_busy";
541
- retryable: false;
542
- status: "conflict";
543
- } | {
544
- reason: "policy_invalid";
545
- retryable: false;
546
- status: "rejected";
547
1058
  } | {
548
1059
  reason: "provider_pending";
549
1060
  retryable: true;
@@ -554,6 +1065,14 @@ export declare function large(count?: number, amount?: number): Promise<{
554
1065
  payload: import("convex/values").VString<string, "required">;
555
1066
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
556
1067
  result: import("convex/values").VUnion<{
1068
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
1069
+ retryable: false;
1070
+ status: "conflict";
1071
+ } | {
1072
+ reason: "policy_invalid";
1073
+ retryable: false;
1074
+ status: "rejected";
1075
+ } | {
557
1076
  operation: {
558
1077
  accountId: string;
559
1078
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -564,14 +1083,6 @@ export declare function large(count?: number, amount?: number): Promise<{
564
1083
  } | {
565
1084
  enabled: boolean;
566
1085
  status: "unchanged";
567
- } | {
568
- reason: "identity_changed" | "revision_changed" | "scope_busy";
569
- retryable: false;
570
- status: "conflict";
571
- } | {
572
- reason: "policy_invalid";
573
- retryable: false;
574
- status: "rejected";
575
1086
  } | {
576
1087
  reason: "provider_pending";
577
1088
  retryable: true;
@@ -2869,6 +3380,517 @@ export declare function large(count?: number, amount?: number): Promise<{
2869
3380
  export declare function withHistory(count?: number, amount?: number): Promise<{
2870
3381
  s: {
2871
3382
  t: import("convex-test").TestConvex<import("convex/server").SchemaDefinition<{
3383
+ processingCostReconciliationOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
3384
+ accountId: string;
3385
+ claimKey: string;
3386
+ currency: string;
3387
+ definitionVersion: number;
3388
+ expectedRevision: number;
3389
+ failure?: {
3390
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
3391
+ retryable: true;
3392
+ status: "not_ready";
3393
+ } | {
3394
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
3395
+ retryable: false;
3396
+ status: "conflict";
3397
+ } | {
3398
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
3399
+ retryable: false;
3400
+ status: "rejected";
3401
+ } | {
3402
+ reason: "history_incomplete" | "provider_outcome_unknown";
3403
+ retryable: false;
3404
+ status: "unknown";
3405
+ } | undefined;
3406
+ importHook?: string | undefined;
3407
+ maxAttempts: number;
3408
+ policy: {
3409
+ liability: {
3410
+ disputeCosts: "all" | "none";
3411
+ processingCosts: "all" | "none" | "uncovered";
3412
+ };
3413
+ rounding: "ceil" | "floor" | "nearest";
3414
+ sellingFee: number;
3415
+ };
3416
+ projection?: string | undefined;
3417
+ provider: string;
3418
+ providerApiVersion: string;
3419
+ requestKey: string;
3420
+ result?: {
3421
+ claim: {
3422
+ _creationTime: number;
3423
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3424
+ accountId: string;
3425
+ amountDue: number;
3426
+ claimKey: string;
3427
+ collectedAmount: number;
3428
+ currency: string;
3429
+ openingCollection?: {
3430
+ amountDue: number;
3431
+ collectedAmount: number;
3432
+ operationKey: string;
3433
+ revision: number;
3434
+ } | undefined;
3435
+ outstanding: number;
3436
+ reservedAmount: number;
3437
+ revision: number;
3438
+ scopeKey: string;
3439
+ sign: "negative" | "positive" | "zero";
3440
+ sourceChargeId: string;
3441
+ sourceGross: number;
3442
+ sourceProcessingFee: number;
3443
+ };
3444
+ deficit: {
3445
+ amountDue: number;
3446
+ currency: string;
3447
+ disputeLiability: number;
3448
+ processingLiability: number;
3449
+ retainedFee: number;
3450
+ };
3451
+ observation: {
3452
+ currency: string;
3453
+ disputeFees: number;
3454
+ gross: number;
3455
+ originalProcessingFee: number;
3456
+ paymentIntentId: string;
3457
+ principalReturned: number;
3458
+ processingFee: number;
3459
+ provenance: {
3460
+ customerAccountId: string;
3461
+ invoiceId: string;
3462
+ invoicePaymentId: string;
3463
+ recoveryInvoiceItemId?: string | undefined;
3464
+ stripePriceId?: string | undefined;
3465
+ stripeProductId?: string | undefined;
3466
+ subscriptionId?: string | undefined;
3467
+ };
3468
+ sourceChargeId: string;
3469
+ };
3470
+ rollbackClaim?: {
3471
+ _creationTime: number;
3472
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3473
+ accountId: string;
3474
+ amountDue: number;
3475
+ claimKey: string;
3476
+ collectedAmount: number;
3477
+ currency: string;
3478
+ openingCollection?: {
3479
+ amountDue: number;
3480
+ collectedAmount: number;
3481
+ operationKey: string;
3482
+ revision: number;
3483
+ } | undefined;
3484
+ outstanding: number;
3485
+ reservedAmount: number;
3486
+ revision: number;
3487
+ scopeKey: string;
3488
+ sign: "negative" | "positive" | "zero";
3489
+ sourceChargeId: string;
3490
+ sourceGross: number;
3491
+ sourceProcessingFee: number;
3492
+ } | undefined;
3493
+ } | undefined;
3494
+ retryDelayMs: number;
3495
+ rollback?: {
3496
+ expectedRevision: number;
3497
+ groupKey: string;
3498
+ } | undefined;
3499
+ scopeKey: string;
3500
+ source: {
3501
+ customerAccountId: string;
3502
+ gross: number;
3503
+ invoiceId?: string | undefined;
3504
+ kind: "sale";
3505
+ paymentIntentId: string;
3506
+ stripeAccountId?: string | undefined;
3507
+ stripePriceId?: string | undefined;
3508
+ stripeProductId?: string | undefined;
3509
+ subscriptionId?: string | undefined;
3510
+ } | {
3511
+ gross: number;
3512
+ groupKey: string;
3513
+ kind: "invoice_recovery";
3514
+ paymentIntentId: string;
3515
+ };
3516
+ status: "completed" | "conflict" | "queued" | "rejected" | "running" | "unknown" | "waiting";
3517
+ version: number;
3518
+ workflowId?: string | undefined;
3519
+ }, {
3520
+ accountId: import("convex/values").VString<string, "required">;
3521
+ scopeKey: import("convex/values").VString<string, "required">;
3522
+ currency: import("convex/values").VString<string, "required">;
3523
+ claimKey: import("convex/values").VString<string, "required">;
3524
+ source: import("convex/values").VUnion<{
3525
+ customerAccountId: string;
3526
+ gross: number;
3527
+ invoiceId?: string | undefined;
3528
+ kind: "sale";
3529
+ paymentIntentId: string;
3530
+ stripeAccountId?: string | undefined;
3531
+ stripePriceId?: string | undefined;
3532
+ stripeProductId?: string | undefined;
3533
+ subscriptionId?: string | undefined;
3534
+ } | {
3535
+ gross: number;
3536
+ groupKey: string;
3537
+ kind: "invoice_recovery";
3538
+ paymentIntentId: string;
3539
+ }, [import("convex/values").VObject<{
3540
+ customerAccountId: string;
3541
+ gross: number;
3542
+ invoiceId?: string | undefined;
3543
+ kind: "sale";
3544
+ paymentIntentId: string;
3545
+ stripeAccountId?: string | undefined;
3546
+ stripePriceId?: string | undefined;
3547
+ stripeProductId?: string | undefined;
3548
+ subscriptionId?: string | undefined;
3549
+ }, {
3550
+ kind: import("convex/values").VLiteral<"sale", "required">;
3551
+ paymentIntentId: import("convex/values").VString<string, "required">;
3552
+ gross: import("convex/values").VFloat64<number, "required">;
3553
+ customerAccountId: import("convex/values").VString<string, "required">;
3554
+ invoiceId: import("convex/values").VString<string | undefined, "optional">;
3555
+ subscriptionId: import("convex/values").VString<string | undefined, "optional">;
3556
+ stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
3557
+ stripePriceId: import("convex/values").VString<string | undefined, "optional">;
3558
+ stripeProductId: import("convex/values").VString<string | undefined, "optional">;
3559
+ }, "required", "customerAccountId" | "gross" | "invoiceId" | "kind" | "paymentIntentId" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId">, import("convex/values").VObject<{
3560
+ gross: number;
3561
+ groupKey: string;
3562
+ kind: "invoice_recovery";
3563
+ paymentIntentId: string;
3564
+ }, {
3565
+ kind: import("convex/values").VLiteral<"invoice_recovery", "required">;
3566
+ paymentIntentId: import("convex/values").VString<string, "required">;
3567
+ gross: import("convex/values").VFloat64<number, "required">;
3568
+ groupKey: import("convex/values").VString<string, "required">;
3569
+ }, "required", "gross" | "groupKey" | "kind" | "paymentIntentId">], "required", "customerAccountId" | "gross" | "groupKey" | "invoiceId" | "kind" | "paymentIntentId" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId">;
3570
+ policy: import("convex/values").VObject<{
3571
+ liability: {
3572
+ disputeCosts: "all" | "none";
3573
+ processingCosts: "all" | "none" | "uncovered";
3574
+ };
3575
+ rounding: "ceil" | "floor" | "nearest";
3576
+ sellingFee: number;
3577
+ }, {
3578
+ sellingFee: import("convex/values").VFloat64<number, "required">;
3579
+ liability: import("convex/values").VObject<{
3580
+ disputeCosts: "all" | "none";
3581
+ processingCosts: "all" | "none" | "uncovered";
3582
+ }, {
3583
+ 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>;
3584
+ disputeCosts: import("convex/values").VUnion<"all" | "none", [import("convex/values").VLiteral<"all", "required">, import("convex/values").VLiteral<"none", "required">], "required", never>;
3585
+ }, "required", "disputeCosts" | "processingCosts">;
3586
+ 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>;
3587
+ }, "required", "liability" | "liability.disputeCosts" | "liability.processingCosts" | "rounding" | "sellingFee">;
3588
+ expectedRevision: import("convex/values").VFloat64<number, "required">;
3589
+ rollback: import("convex/values").VObject<{
3590
+ expectedRevision: number;
3591
+ groupKey: string;
3592
+ } | undefined, {
3593
+ groupKey: import("convex/values").VString<string, "required">;
3594
+ expectedRevision: import("convex/values").VFloat64<number, "required">;
3595
+ }, "optional", "expectedRevision" | "groupKey">;
3596
+ provider: import("convex/values").VString<string, "required">;
3597
+ projection: import("convex/values").VString<string | undefined, "optional">;
3598
+ importHook: import("convex/values").VString<string | undefined, "optional">;
3599
+ providerApiVersion: import("convex/values").VString<string, "required">;
3600
+ definitionVersion: import("convex/values").VFloat64<number, "required">;
3601
+ maxAttempts: import("convex/values").VFloat64<number, "required">;
3602
+ retryDelayMs: import("convex/values").VFloat64<number, "required">;
3603
+ requestKey: import("convex/values").VString<string, "required">;
3604
+ version: import("convex/values").VFloat64<number, "required">;
3605
+ workflowId: import("convex/values").VString<string | undefined, "optional">;
3606
+ 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>;
3607
+ failure: import("convex/values").VUnion<{
3608
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
3609
+ retryable: true;
3610
+ status: "not_ready";
3611
+ } | {
3612
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
3613
+ retryable: false;
3614
+ status: "conflict";
3615
+ } | {
3616
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
3617
+ retryable: false;
3618
+ status: "rejected";
3619
+ } | {
3620
+ reason: "history_incomplete" | "provider_outcome_unknown";
3621
+ retryable: false;
3622
+ status: "unknown";
3623
+ } | undefined, [import("convex/values").VObject<{
3624
+ reason: "fee_pending" | "history_incomplete" | "provider_pending";
3625
+ retryable: true;
3626
+ status: "not_ready";
3627
+ }, {
3628
+ status: import("convex/values").VLiteral<"not_ready", "required">;
3629
+ 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>;
3630
+ retryable: import("convex/values").VLiteral<true, "required">;
3631
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
3632
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
3633
+ retryable: false;
3634
+ status: "conflict";
3635
+ }, {
3636
+ status: import("convex/values").VLiteral<"conflict", "required">;
3637
+ 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>;
3638
+ retryable: import("convex/values").VLiteral<false, "required">;
3639
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
3640
+ reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
3641
+ retryable: false;
3642
+ status: "rejected";
3643
+ }, {
3644
+ status: import("convex/values").VLiteral<"rejected", "required">;
3645
+ 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>;
3646
+ retryable: import("convex/values").VLiteral<false, "required">;
3647
+ }, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
3648
+ reason: "history_incomplete" | "provider_outcome_unknown";
3649
+ retryable: false;
3650
+ status: "unknown";
3651
+ }, {
3652
+ status: import("convex/values").VLiteral<"unknown", "required">;
3653
+ 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>;
3654
+ retryable: import("convex/values").VLiteral<false, "required">;
3655
+ }, "required", "reason" | "retryable" | "status">], "optional", "reason" | "retryable" | "status">;
3656
+ result: import("convex/values").VObject<{
3657
+ claim: {
3658
+ _creationTime: number;
3659
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3660
+ accountId: string;
3661
+ amountDue: number;
3662
+ claimKey: string;
3663
+ collectedAmount: number;
3664
+ currency: string;
3665
+ openingCollection?: {
3666
+ amountDue: number;
3667
+ collectedAmount: number;
3668
+ operationKey: string;
3669
+ revision: number;
3670
+ } | undefined;
3671
+ outstanding: number;
3672
+ reservedAmount: number;
3673
+ revision: number;
3674
+ scopeKey: string;
3675
+ sign: "negative" | "positive" | "zero";
3676
+ sourceChargeId: string;
3677
+ sourceGross: number;
3678
+ sourceProcessingFee: number;
3679
+ };
3680
+ deficit: {
3681
+ amountDue: number;
3682
+ currency: string;
3683
+ disputeLiability: number;
3684
+ processingLiability: number;
3685
+ retainedFee: number;
3686
+ };
3687
+ observation: {
3688
+ currency: string;
3689
+ disputeFees: number;
3690
+ gross: number;
3691
+ originalProcessingFee: number;
3692
+ paymentIntentId: string;
3693
+ principalReturned: number;
3694
+ processingFee: number;
3695
+ provenance: {
3696
+ customerAccountId: string;
3697
+ invoiceId: string;
3698
+ invoicePaymentId: string;
3699
+ recoveryInvoiceItemId?: string | undefined;
3700
+ stripePriceId?: string | undefined;
3701
+ stripeProductId?: string | undefined;
3702
+ subscriptionId?: string | undefined;
3703
+ };
3704
+ sourceChargeId: string;
3705
+ };
3706
+ rollbackClaim?: {
3707
+ _creationTime: number;
3708
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3709
+ accountId: string;
3710
+ amountDue: number;
3711
+ claimKey: string;
3712
+ collectedAmount: number;
3713
+ currency: string;
3714
+ openingCollection?: {
3715
+ amountDue: number;
3716
+ collectedAmount: number;
3717
+ operationKey: string;
3718
+ revision: number;
3719
+ } | undefined;
3720
+ outstanding: number;
3721
+ reservedAmount: number;
3722
+ revision: number;
3723
+ scopeKey: string;
3724
+ sign: "negative" | "positive" | "zero";
3725
+ sourceChargeId: string;
3726
+ sourceGross: number;
3727
+ sourceProcessingFee: number;
3728
+ } | undefined;
3729
+ } | undefined, {
3730
+ claim: import("convex/values").VObject<{
3731
+ _creationTime: number;
3732
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3733
+ accountId: string;
3734
+ amountDue: number;
3735
+ claimKey: string;
3736
+ collectedAmount: number;
3737
+ currency: string;
3738
+ openingCollection?: {
3739
+ amountDue: number;
3740
+ collectedAmount: number;
3741
+ operationKey: string;
3742
+ revision: number;
3743
+ } | undefined;
3744
+ outstanding: number;
3745
+ reservedAmount: number;
3746
+ revision: number;
3747
+ scopeKey: string;
3748
+ sign: "negative" | "positive" | "zero";
3749
+ sourceChargeId: string;
3750
+ sourceGross: number;
3751
+ sourceProcessingFee: number;
3752
+ }, {
3753
+ accountId: import("convex/values").VString<string, "required">;
3754
+ scopeKey: import("convex/values").VString<string, "required">;
3755
+ currency: import("convex/values").VString<string, "required">;
3756
+ claimKey: import("convex/values").VString<string, "required">;
3757
+ sourceChargeId: import("convex/values").VString<string, "required">;
3758
+ sourceGross: import("convex/values").VFloat64<number, "required">;
3759
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
3760
+ amountDue: import("convex/values").VFloat64<number, "required">;
3761
+ revision: import("convex/values").VFloat64<number, "required">;
3762
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
3763
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
3764
+ outstanding: import("convex/values").VFloat64<number, "required">;
3765
+ 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>;
3766
+ openingCollection: import("convex/values").VObject<{
3767
+ amountDue: number;
3768
+ collectedAmount: number;
3769
+ operationKey: string;
3770
+ revision: number;
3771
+ } | undefined, {
3772
+ operationKey: import("convex/values").VString<string, "required">;
3773
+ amountDue: import("convex/values").VFloat64<number, "required">;
3774
+ revision: import("convex/values").VFloat64<number, "required">;
3775
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
3776
+ }, "optional", "amountDue" | "collectedAmount" | "operationKey" | "revision">;
3777
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
3778
+ _creationTime: import("convex/values").VFloat64<number, "required">;
3779
+ }, "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">;
3780
+ rollbackClaim: import("convex/values").VObject<{
3781
+ _creationTime: number;
3782
+ _id: import("convex/values").GenericId<"recoveryClaims">;
3783
+ accountId: string;
3784
+ amountDue: number;
3785
+ claimKey: string;
3786
+ collectedAmount: number;
3787
+ currency: string;
3788
+ openingCollection?: {
3789
+ amountDue: number;
3790
+ collectedAmount: number;
3791
+ operationKey: string;
3792
+ revision: number;
3793
+ } | undefined;
3794
+ outstanding: number;
3795
+ reservedAmount: number;
3796
+ revision: number;
3797
+ scopeKey: string;
3798
+ sign: "negative" | "positive" | "zero";
3799
+ sourceChargeId: string;
3800
+ sourceGross: number;
3801
+ sourceProcessingFee: number;
3802
+ } | undefined, {
3803
+ accountId: import("convex/values").VString<string, "required">;
3804
+ scopeKey: import("convex/values").VString<string, "required">;
3805
+ currency: import("convex/values").VString<string, "required">;
3806
+ claimKey: import("convex/values").VString<string, "required">;
3807
+ sourceChargeId: import("convex/values").VString<string, "required">;
3808
+ sourceGross: import("convex/values").VFloat64<number, "required">;
3809
+ sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
3810
+ amountDue: import("convex/values").VFloat64<number, "required">;
3811
+ revision: import("convex/values").VFloat64<number, "required">;
3812
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
3813
+ reservedAmount: import("convex/values").VFloat64<number, "required">;
3814
+ outstanding: import("convex/values").VFloat64<number, "required">;
3815
+ 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>;
3816
+ openingCollection: import("convex/values").VObject<{
3817
+ amountDue: number;
3818
+ collectedAmount: number;
3819
+ operationKey: string;
3820
+ revision: number;
3821
+ } | undefined, {
3822
+ operationKey: import("convex/values").VString<string, "required">;
3823
+ amountDue: import("convex/values").VFloat64<number, "required">;
3824
+ revision: import("convex/values").VFloat64<number, "required">;
3825
+ collectedAmount: import("convex/values").VFloat64<number, "required">;
3826
+ }, "optional", "amountDue" | "collectedAmount" | "operationKey" | "revision">;
3827
+ _id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
3828
+ _creationTime: import("convex/values").VFloat64<number, "required">;
3829
+ }, "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">;
3830
+ deficit: import("convex/values").VObject<{
3831
+ amountDue: number;
3832
+ currency: string;
3833
+ disputeLiability: number;
3834
+ processingLiability: number;
3835
+ retainedFee: number;
3836
+ }, {
3837
+ currency: import("convex/values").VString<string, "required">;
3838
+ retainedFee: import("convex/values").VFloat64<number, "required">;
3839
+ processingLiability: import("convex/values").VFloat64<number, "required">;
3840
+ disputeLiability: import("convex/values").VFloat64<number, "required">;
3841
+ amountDue: import("convex/values").VFloat64<number, "required">;
3842
+ }, "required", "amountDue" | "currency" | "disputeLiability" | "processingLiability" | "retainedFee">;
3843
+ observation: import("convex/values").VObject<{
3844
+ currency: string;
3845
+ disputeFees: number;
3846
+ gross: number;
3847
+ originalProcessingFee: number;
3848
+ paymentIntentId: string;
3849
+ principalReturned: number;
3850
+ processingFee: number;
3851
+ provenance: {
3852
+ customerAccountId: string;
3853
+ invoiceId: string;
3854
+ invoicePaymentId: string;
3855
+ recoveryInvoiceItemId?: string | undefined;
3856
+ stripePriceId?: string | undefined;
3857
+ stripeProductId?: string | undefined;
3858
+ subscriptionId?: string | undefined;
3859
+ };
3860
+ sourceChargeId: string;
3861
+ }, {
3862
+ paymentIntentId: import("convex/values").VString<string, "required">;
3863
+ sourceChargeId: import("convex/values").VString<string, "required">;
3864
+ currency: import("convex/values").VString<string, "required">;
3865
+ gross: import("convex/values").VFloat64<number, "required">;
3866
+ originalProcessingFee: import("convex/values").VFloat64<number, "required">;
3867
+ processingFee: import("convex/values").VFloat64<number, "required">;
3868
+ disputeFees: import("convex/values").VFloat64<number, "required">;
3869
+ principalReturned: import("convex/values").VFloat64<number, "required">;
3870
+ provenance: import("convex/values").VObject<{
3871
+ customerAccountId: string;
3872
+ invoiceId: string;
3873
+ invoicePaymentId: string;
3874
+ recoveryInvoiceItemId?: string | undefined;
3875
+ stripePriceId?: string | undefined;
3876
+ stripeProductId?: string | undefined;
3877
+ subscriptionId?: string | undefined;
3878
+ }, {
3879
+ invoiceId: import("convex/values").VString<string, "required">;
3880
+ invoicePaymentId: import("convex/values").VString<string, "required">;
3881
+ recoveryInvoiceItemId: import("convex/values").VString<string | undefined, "optional">;
3882
+ customerAccountId: import("convex/values").VString<string, "required">;
3883
+ subscriptionId: import("convex/values").VString<string | undefined, "optional">;
3884
+ stripePriceId: import("convex/values").VString<string | undefined, "optional">;
3885
+ stripeProductId: import("convex/values").VString<string | undefined, "optional">;
3886
+ }, "required", "customerAccountId" | "invoiceId" | "invoicePaymentId" | "recoveryInvoiceItemId" | "stripePriceId" | "stripeProductId" | "subscriptionId">;
3887
+ }, "required", "currency" | "disputeFees" | "gross" | "originalProcessingFee" | "paymentIntentId" | "principalReturned" | "processingFee" | "provenance" | "provenance.customerAccountId" | "provenance.invoiceId" | "provenance.invoicePaymentId" | "provenance.recoveryInvoiceItemId" | "provenance.stripePriceId" | "provenance.stripeProductId" | "provenance.subscriptionId" | "sourceChargeId">;
3888
+ }, "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">;
3889
+ }, "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">, {
3890
+ by_claim_status: ["claimKey", "status", "_creationTime"];
3891
+ by_payment_scope: ["accountId", "scopeKey", "currency", "source.paymentIntentId", "_creationTime"];
3892
+ by_request: ["requestKey", "_creationTime"];
3893
+ }, {}, {}>;
2872
3894
  recoveryWorkflowOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
2873
3895
  accountId: string;
2874
3896
  activePhase?: "execute" | "reconcile" | undefined;
@@ -3395,6 +4417,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
3395
4417
  preparationId: import("convex/values").GenericId<"balanceFundingPreparations">;
3396
4418
  requestKey: string;
3397
4419
  result?: {
4420
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
4421
+ retryable: false;
4422
+ status: "conflict";
4423
+ } | {
4424
+ reason: "policy_invalid";
4425
+ retryable: false;
4426
+ status: "rejected";
4427
+ } | {
3398
4428
  operation: {
3399
4429
  accountId: string;
3400
4430
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -3405,14 +4435,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
3405
4435
  } | {
3406
4436
  enabled: boolean;
3407
4437
  status: "unchanged";
3408
- } | {
3409
- reason: "identity_changed" | "revision_changed" | "scope_busy";
3410
- retryable: false;
3411
- status: "conflict";
3412
- } | {
3413
- reason: "policy_invalid";
3414
- retryable: false;
3415
- status: "rejected";
3416
4438
  } | {
3417
4439
  reason: "provider_pending";
3418
4440
  retryable: true;
@@ -3423,6 +4445,14 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
3423
4445
  payload: import("convex/values").VString<string, "required">;
3424
4446
  preparationId: import("convex/values").VId<import("convex/values").GenericId<"balanceFundingPreparations">, "required">;
3425
4447
  result: import("convex/values").VUnion<{
4448
+ reason: "identity_changed" | "revision_changed" | "scope_busy";
4449
+ retryable: false;
4450
+ status: "conflict";
4451
+ } | {
4452
+ reason: "policy_invalid";
4453
+ retryable: false;
4454
+ status: "rejected";
4455
+ } | {
3426
4456
  operation: {
3427
4457
  accountId: string;
3428
4458
  operationId: import("convex/values").GenericId<"balanceFundingOperations">;
@@ -3433,14 +4463,6 @@ export declare function withHistory(count?: number, amount?: number): Promise<{
3433
4463
  } | {
3434
4464
  enabled: boolean;
3435
4465
  status: "unchanged";
3436
- } | {
3437
- reason: "identity_changed" | "revision_changed" | "scope_busy";
3438
- retryable: false;
3439
- status: "conflict";
3440
- } | {
3441
- reason: "policy_invalid";
3442
- retryable: false;
3443
- status: "rejected";
3444
4466
  } | {
3445
4467
  reason: "provider_pending";
3446
4468
  retryable: true;