@fantastic.dev/better-stripe 0.42.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.
- package/CHANGELOG.md +15 -0
- package/README.md +1 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +1022 -0
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +511 -0
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts +1054 -32
- package/dist/client/connect/payoutLargeAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +527 -16
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/costRecovery-invoices.d.ts +3 -2
- package/dist/client/costRecovery-invoices.d.ts.map +1 -1
- package/dist/client/costRecovery-invoices.js +10 -5
- package/dist/client/costRecovery-invoices.js.map +1 -1
- package/dist/client/costRecovery.d.ts +4 -2
- package/dist/client/costRecovery.d.ts.map +1 -1
- package/dist/client/costRecovery.js +2 -2
- package/dist/client/costRecovery.js.map +1 -1
- package/dist/client/processingCostReconciliation/client.d.ts +14 -0
- package/dist/client/processingCostReconciliation/client.d.ts.map +1 -0
- package/dist/client/processingCostReconciliation/client.js +35 -0
- package/dist/client/processingCostReconciliation/client.js.map +1 -0
- package/dist/client/processingCostReconciliation/contracts.d.ts +172 -0
- package/dist/client/processingCostReconciliation/contracts.d.ts.map +1 -0
- package/dist/client/processingCostReconciliation/contracts.js +55 -0
- package/dist/client/processingCostReconciliation/contracts.js.map +1 -0
- package/dist/client/processingCostReconciliation/invoiceFunding.d.ts +15 -0
- package/dist/client/processingCostReconciliation/invoiceFunding.d.ts.map +1 -0
- package/dist/client/processingCostReconciliation/invoiceFunding.js +195 -0
- package/dist/client/processingCostReconciliation/invoiceFunding.js.map +1 -0
- package/dist/client/processingCostReconciliation/provider.d.ts +9 -0
- package/dist/client/processingCostReconciliation/provider.d.ts.map +1 -0
- package/dist/client/processingCostReconciliation/provider.js +148 -0
- package/dist/client/processingCostReconciliation/provider.js.map +1 -0
- package/dist/client/settlement/processingCostHistory.d.ts +12 -0
- package/dist/client/settlement/processingCostHistory.d.ts.map +1 -0
- package/dist/client/settlement/processingCostHistory.js +20 -0
- package/dist/client/settlement/processingCostHistory.js.map +1 -0
- package/dist/client/settlement/processingCosts.d.ts +3 -0
- package/dist/client/settlement/processingCosts.d.ts.map +1 -1
- package/dist/client/settlement/processingCosts.js +27 -7
- package/dist/client/settlement/processingCosts.js.map +1 -1
- package/dist/component/_generated/api.d.ts +18 -0
- package/dist/component/_generated/api.d.ts.map +1 -1
- package/dist/component/_generated/api.js.map +1 -1
- package/dist/component/_generated/component.d.ts +515 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/balanceFunding/internal/actions.d.ts +11 -11
- package/dist/component/balanceFunding/mutations.d.ts +16 -16
- package/dist/component/balanceFunding/stateHandlers.d.ts +8 -8
- package/dist/component/balanceFunding/workflowValidators.d.ts +16 -16
- package/dist/component/earnings/triggers.d.ts +318 -16
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/payoutRelease/queries.d.ts +2 -2
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/processingCostReconciliation/adoption.d.ts +29 -0
- package/dist/component/processingCostReconciliation/adoption.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/adoption.js +58 -0
- package/dist/component/processingCostReconciliation/adoption.js.map +1 -0
- package/dist/component/processingCostReconciliation/bridge.d.ts +45 -0
- package/dist/component/processingCostReconciliation/bridge.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/bridge.js +41 -0
- package/dist/component/processingCostReconciliation/bridge.js.map +1 -0
- package/dist/component/processingCostReconciliation/helpers.d.ts +327 -0
- package/dist/component/processingCostReconciliation/helpers.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/helpers.js +39 -0
- package/dist/component/processingCostReconciliation/helpers.js.map +1 -0
- package/dist/component/processingCostReconciliation/mutations.d.ts +303 -0
- package/dist/component/processingCostReconciliation/mutations.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/mutations.js +121 -0
- package/dist/component/processingCostReconciliation/mutations.js.map +1 -0
- package/dist/component/processingCostReconciliation/queries.d.ts +422 -0
- package/dist/component/processingCostReconciliation/queries.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/queries.js +19 -0
- package/dist/component/processingCostReconciliation/queries.js.map +1 -0
- package/dist/component/processingCostReconciliation/rollback.d.ts +21 -0
- package/dist/component/processingCostReconciliation/rollback.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/rollback.js +54 -0
- package/dist/component/processingCostReconciliation/rollback.js.map +1 -0
- package/dist/component/processingCostReconciliation/schema.d.ts +2460 -0
- package/dist/component/processingCostReconciliation/schema.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/schema.js +137 -0
- package/dist/component/processingCostReconciliation/schema.js.map +1 -0
- package/dist/component/processingCostReconciliation/steps.d.ts +306 -0
- package/dist/component/processingCostReconciliation/steps.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/steps.js +149 -0
- package/dist/component/processingCostReconciliation/steps.js.map +1 -0
- package/dist/component/processingCostReconciliation/validation.d.ts +13 -0
- package/dist/component/processingCostReconciliation/validation.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/validation.js +61 -0
- package/dist/component/processingCostReconciliation/validation.js.map +1 -0
- package/dist/component/processingCostReconciliation/workflow.d.ts +105 -0
- package/dist/component/processingCostReconciliation/workflow.d.ts.map +1 -0
- package/dist/component/processingCostReconciliation/workflow.js +33 -0
- package/dist/component/processingCostReconciliation/workflow.js.map +1 -0
- package/dist/component/schema.d.ts +511 -0
- package/dist/component/schema.js +2 -0
- package/dist/component/schema.js.map +1 -1
- package/package.json +1 -1
- package/src/client/costRecovery-invoices.ts +19 -4
- package/src/client/costRecovery.ts +4 -2
- package/src/client/processingCostReconciliation/client.ts +75 -0
- package/src/client/processingCostReconciliation/contracts.ts +176 -0
- package/src/client/processingCostReconciliation/invoiceFunding.ts +270 -0
- package/src/client/processingCostReconciliation/invoiceProvider.test.ts +353 -0
- package/src/client/processingCostReconciliation/provider.test.ts +324 -0
- package/src/client/processingCostReconciliation/provider.ts +178 -0
- package/src/client/settlement/processingCostHistory.ts +31 -0
- package/src/client/settlement/processingCosts.ts +50 -15
- package/src/component/_generated/api.ts +18 -0
- package/src/component/_generated/component.ts +570 -0
- package/src/component/processingCostReconciliation/adoption.test.ts +206 -0
- package/src/component/processingCostReconciliation/adoption.ts +77 -0
- package/src/component/processingCostReconciliation/bridge.ts +50 -0
- package/src/component/processingCostReconciliation/helpers.ts +55 -0
- package/src/component/processingCostReconciliation/invoice.test.ts +152 -0
- package/src/component/processingCostReconciliation/mutations.ts +148 -0
- package/src/component/processingCostReconciliation/queries.ts +18 -0
- package/src/component/processingCostReconciliation/rollback.ts +72 -0
- package/src/component/processingCostReconciliation/schema.ts +191 -0
- package/src/component/processingCostReconciliation/state.test.ts +407 -0
- package/src/component/processingCostReconciliation/steps.ts +168 -0
- package/src/component/processingCostReconciliation/validation.ts +79 -0
- package/src/component/processingCostReconciliation/workflow.test.ts +329 -0
- package/src/component/processingCostReconciliation/workflow.ts +50 -0
- package/src/component/schema.ts +2 -0
|
@@ -1,4 +1,515 @@
|
|
|
1
1
|
declare const _default: import("convex/server").SchemaDefinition<{
|
|
2
|
+
processingCostReconciliationOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
3
|
+
accountId: string;
|
|
4
|
+
claimKey: string;
|
|
5
|
+
currency: string;
|
|
6
|
+
definitionVersion: number;
|
|
7
|
+
expectedRevision: number;
|
|
8
|
+
failure?: {
|
|
9
|
+
reason: "fee_pending" | "history_incomplete" | "provider_pending";
|
|
10
|
+
retryable: true;
|
|
11
|
+
status: "not_ready";
|
|
12
|
+
} | {
|
|
13
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
14
|
+
retryable: false;
|
|
15
|
+
status: "conflict";
|
|
16
|
+
} | {
|
|
17
|
+
reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
|
|
18
|
+
retryable: false;
|
|
19
|
+
status: "rejected";
|
|
20
|
+
} | {
|
|
21
|
+
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
22
|
+
retryable: false;
|
|
23
|
+
status: "unknown";
|
|
24
|
+
} | undefined;
|
|
25
|
+
importHook?: string | undefined;
|
|
26
|
+
maxAttempts: number;
|
|
27
|
+
policy: {
|
|
28
|
+
liability: {
|
|
29
|
+
disputeCosts: "all" | "none";
|
|
30
|
+
processingCosts: "all" | "none" | "uncovered";
|
|
31
|
+
};
|
|
32
|
+
rounding: "ceil" | "floor" | "nearest";
|
|
33
|
+
sellingFee: number;
|
|
34
|
+
};
|
|
35
|
+
projection?: string | undefined;
|
|
36
|
+
provider: string;
|
|
37
|
+
providerApiVersion: string;
|
|
38
|
+
requestKey: string;
|
|
39
|
+
result?: {
|
|
40
|
+
claim: {
|
|
41
|
+
_creationTime: number;
|
|
42
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
43
|
+
accountId: string;
|
|
44
|
+
amountDue: number;
|
|
45
|
+
claimKey: string;
|
|
46
|
+
collectedAmount: number;
|
|
47
|
+
currency: string;
|
|
48
|
+
openingCollection?: {
|
|
49
|
+
amountDue: number;
|
|
50
|
+
collectedAmount: number;
|
|
51
|
+
operationKey: string;
|
|
52
|
+
revision: number;
|
|
53
|
+
} | undefined;
|
|
54
|
+
outstanding: number;
|
|
55
|
+
reservedAmount: number;
|
|
56
|
+
revision: number;
|
|
57
|
+
scopeKey: string;
|
|
58
|
+
sign: "negative" | "positive" | "zero";
|
|
59
|
+
sourceChargeId: string;
|
|
60
|
+
sourceGross: number;
|
|
61
|
+
sourceProcessingFee: number;
|
|
62
|
+
};
|
|
63
|
+
deficit: {
|
|
64
|
+
amountDue: number;
|
|
65
|
+
currency: string;
|
|
66
|
+
disputeLiability: number;
|
|
67
|
+
processingLiability: number;
|
|
68
|
+
retainedFee: number;
|
|
69
|
+
};
|
|
70
|
+
observation: {
|
|
71
|
+
currency: string;
|
|
72
|
+
disputeFees: number;
|
|
73
|
+
gross: number;
|
|
74
|
+
originalProcessingFee: number;
|
|
75
|
+
paymentIntentId: string;
|
|
76
|
+
principalReturned: number;
|
|
77
|
+
processingFee: number;
|
|
78
|
+
provenance: {
|
|
79
|
+
customerAccountId: string;
|
|
80
|
+
invoiceId: string;
|
|
81
|
+
invoicePaymentId: string;
|
|
82
|
+
recoveryInvoiceItemId?: string | undefined;
|
|
83
|
+
stripePriceId?: string | undefined;
|
|
84
|
+
stripeProductId?: string | undefined;
|
|
85
|
+
subscriptionId?: string | undefined;
|
|
86
|
+
};
|
|
87
|
+
sourceChargeId: string;
|
|
88
|
+
};
|
|
89
|
+
rollbackClaim?: {
|
|
90
|
+
_creationTime: number;
|
|
91
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
92
|
+
accountId: string;
|
|
93
|
+
amountDue: number;
|
|
94
|
+
claimKey: string;
|
|
95
|
+
collectedAmount: number;
|
|
96
|
+
currency: string;
|
|
97
|
+
openingCollection?: {
|
|
98
|
+
amountDue: number;
|
|
99
|
+
collectedAmount: number;
|
|
100
|
+
operationKey: string;
|
|
101
|
+
revision: number;
|
|
102
|
+
} | undefined;
|
|
103
|
+
outstanding: number;
|
|
104
|
+
reservedAmount: number;
|
|
105
|
+
revision: number;
|
|
106
|
+
scopeKey: string;
|
|
107
|
+
sign: "negative" | "positive" | "zero";
|
|
108
|
+
sourceChargeId: string;
|
|
109
|
+
sourceGross: number;
|
|
110
|
+
sourceProcessingFee: number;
|
|
111
|
+
} | undefined;
|
|
112
|
+
} | undefined;
|
|
113
|
+
retryDelayMs: number;
|
|
114
|
+
rollback?: {
|
|
115
|
+
expectedRevision: number;
|
|
116
|
+
groupKey: string;
|
|
117
|
+
} | undefined;
|
|
118
|
+
scopeKey: string;
|
|
119
|
+
source: {
|
|
120
|
+
customerAccountId: string;
|
|
121
|
+
gross: number;
|
|
122
|
+
invoiceId?: string | undefined;
|
|
123
|
+
kind: "sale";
|
|
124
|
+
paymentIntentId: string;
|
|
125
|
+
stripeAccountId?: string | undefined;
|
|
126
|
+
stripePriceId?: string | undefined;
|
|
127
|
+
stripeProductId?: string | undefined;
|
|
128
|
+
subscriptionId?: string | undefined;
|
|
129
|
+
} | {
|
|
130
|
+
gross: number;
|
|
131
|
+
groupKey: string;
|
|
132
|
+
kind: "invoice_recovery";
|
|
133
|
+
paymentIntentId: string;
|
|
134
|
+
};
|
|
135
|
+
status: "completed" | "conflict" | "queued" | "rejected" | "running" | "unknown" | "waiting";
|
|
136
|
+
version: number;
|
|
137
|
+
workflowId?: string | undefined;
|
|
138
|
+
}, {
|
|
139
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
140
|
+
scopeKey: import("convex/values").VString<string, "required">;
|
|
141
|
+
currency: import("convex/values").VString<string, "required">;
|
|
142
|
+
claimKey: import("convex/values").VString<string, "required">;
|
|
143
|
+
source: import("convex/values").VUnion<{
|
|
144
|
+
customerAccountId: string;
|
|
145
|
+
gross: number;
|
|
146
|
+
invoiceId?: string | undefined;
|
|
147
|
+
kind: "sale";
|
|
148
|
+
paymentIntentId: string;
|
|
149
|
+
stripeAccountId?: string | undefined;
|
|
150
|
+
stripePriceId?: string | undefined;
|
|
151
|
+
stripeProductId?: string | undefined;
|
|
152
|
+
subscriptionId?: string | undefined;
|
|
153
|
+
} | {
|
|
154
|
+
gross: number;
|
|
155
|
+
groupKey: string;
|
|
156
|
+
kind: "invoice_recovery";
|
|
157
|
+
paymentIntentId: string;
|
|
158
|
+
}, [import("convex/values").VObject<{
|
|
159
|
+
customerAccountId: string;
|
|
160
|
+
gross: number;
|
|
161
|
+
invoiceId?: string | undefined;
|
|
162
|
+
kind: "sale";
|
|
163
|
+
paymentIntentId: string;
|
|
164
|
+
stripeAccountId?: string | undefined;
|
|
165
|
+
stripePriceId?: string | undefined;
|
|
166
|
+
stripeProductId?: string | undefined;
|
|
167
|
+
subscriptionId?: string | undefined;
|
|
168
|
+
}, {
|
|
169
|
+
kind: import("convex/values").VLiteral<"sale", "required">;
|
|
170
|
+
paymentIntentId: import("convex/values").VString<string, "required">;
|
|
171
|
+
gross: import("convex/values").VFloat64<number, "required">;
|
|
172
|
+
customerAccountId: import("convex/values").VString<string, "required">;
|
|
173
|
+
invoiceId: import("convex/values").VString<string | undefined, "optional">;
|
|
174
|
+
subscriptionId: import("convex/values").VString<string | undefined, "optional">;
|
|
175
|
+
stripeAccountId: import("convex/values").VString<string | undefined, "optional">;
|
|
176
|
+
stripePriceId: import("convex/values").VString<string | undefined, "optional">;
|
|
177
|
+
stripeProductId: import("convex/values").VString<string | undefined, "optional">;
|
|
178
|
+
}, "required", "customerAccountId" | "gross" | "invoiceId" | "kind" | "paymentIntentId" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId">, import("convex/values").VObject<{
|
|
179
|
+
gross: number;
|
|
180
|
+
groupKey: string;
|
|
181
|
+
kind: "invoice_recovery";
|
|
182
|
+
paymentIntentId: string;
|
|
183
|
+
}, {
|
|
184
|
+
kind: import("convex/values").VLiteral<"invoice_recovery", "required">;
|
|
185
|
+
paymentIntentId: import("convex/values").VString<string, "required">;
|
|
186
|
+
gross: import("convex/values").VFloat64<number, "required">;
|
|
187
|
+
groupKey: import("convex/values").VString<string, "required">;
|
|
188
|
+
}, "required", "gross" | "groupKey" | "kind" | "paymentIntentId">], "required", "customerAccountId" | "gross" | "groupKey" | "invoiceId" | "kind" | "paymentIntentId" | "stripeAccountId" | "stripePriceId" | "stripeProductId" | "subscriptionId">;
|
|
189
|
+
policy: import("convex/values").VObject<{
|
|
190
|
+
liability: {
|
|
191
|
+
disputeCosts: "all" | "none";
|
|
192
|
+
processingCosts: "all" | "none" | "uncovered";
|
|
193
|
+
};
|
|
194
|
+
rounding: "ceil" | "floor" | "nearest";
|
|
195
|
+
sellingFee: number;
|
|
196
|
+
}, {
|
|
197
|
+
sellingFee: import("convex/values").VFloat64<number, "required">;
|
|
198
|
+
liability: import("convex/values").VObject<{
|
|
199
|
+
disputeCosts: "all" | "none";
|
|
200
|
+
processingCosts: "all" | "none" | "uncovered";
|
|
201
|
+
}, {
|
|
202
|
+
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>;
|
|
203
|
+
disputeCosts: import("convex/values").VUnion<"all" | "none", [import("convex/values").VLiteral<"all", "required">, import("convex/values").VLiteral<"none", "required">], "required", never>;
|
|
204
|
+
}, "required", "disputeCosts" | "processingCosts">;
|
|
205
|
+
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>;
|
|
206
|
+
}, "required", "liability" | "liability.disputeCosts" | "liability.processingCosts" | "rounding" | "sellingFee">;
|
|
207
|
+
expectedRevision: import("convex/values").VFloat64<number, "required">;
|
|
208
|
+
rollback: import("convex/values").VObject<{
|
|
209
|
+
expectedRevision: number;
|
|
210
|
+
groupKey: string;
|
|
211
|
+
} | undefined, {
|
|
212
|
+
groupKey: import("convex/values").VString<string, "required">;
|
|
213
|
+
expectedRevision: import("convex/values").VFloat64<number, "required">;
|
|
214
|
+
}, "optional", "expectedRevision" | "groupKey">;
|
|
215
|
+
provider: import("convex/values").VString<string, "required">;
|
|
216
|
+
projection: import("convex/values").VString<string | undefined, "optional">;
|
|
217
|
+
importHook: import("convex/values").VString<string | undefined, "optional">;
|
|
218
|
+
providerApiVersion: import("convex/values").VString<string, "required">;
|
|
219
|
+
definitionVersion: import("convex/values").VFloat64<number, "required">;
|
|
220
|
+
maxAttempts: import("convex/values").VFloat64<number, "required">;
|
|
221
|
+
retryDelayMs: import("convex/values").VFloat64<number, "required">;
|
|
222
|
+
requestKey: import("convex/values").VString<string, "required">;
|
|
223
|
+
version: import("convex/values").VFloat64<number, "required">;
|
|
224
|
+
workflowId: import("convex/values").VString<string | undefined, "optional">;
|
|
225
|
+
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>;
|
|
226
|
+
failure: import("convex/values").VUnion<{
|
|
227
|
+
reason: "fee_pending" | "history_incomplete" | "provider_pending";
|
|
228
|
+
retryable: true;
|
|
229
|
+
status: "not_ready";
|
|
230
|
+
} | {
|
|
231
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
232
|
+
retryable: false;
|
|
233
|
+
status: "conflict";
|
|
234
|
+
} | {
|
|
235
|
+
reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
|
|
236
|
+
retryable: false;
|
|
237
|
+
status: "rejected";
|
|
238
|
+
} | {
|
|
239
|
+
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
240
|
+
retryable: false;
|
|
241
|
+
status: "unknown";
|
|
242
|
+
} | undefined, [import("convex/values").VObject<{
|
|
243
|
+
reason: "fee_pending" | "history_incomplete" | "provider_pending";
|
|
244
|
+
retryable: true;
|
|
245
|
+
status: "not_ready";
|
|
246
|
+
}, {
|
|
247
|
+
status: import("convex/values").VLiteral<"not_ready", "required">;
|
|
248
|
+
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>;
|
|
249
|
+
retryable: import("convex/values").VLiteral<true, "required">;
|
|
250
|
+
}, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
|
|
251
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
252
|
+
retryable: false;
|
|
253
|
+
status: "conflict";
|
|
254
|
+
}, {
|
|
255
|
+
status: import("convex/values").VLiteral<"conflict", "required">;
|
|
256
|
+
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>;
|
|
257
|
+
retryable: import("convex/values").VLiteral<false, "required">;
|
|
258
|
+
}, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
|
|
259
|
+
reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
|
|
260
|
+
retryable: false;
|
|
261
|
+
status: "rejected";
|
|
262
|
+
}, {
|
|
263
|
+
status: import("convex/values").VLiteral<"rejected", "required">;
|
|
264
|
+
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>;
|
|
265
|
+
retryable: import("convex/values").VLiteral<false, "required">;
|
|
266
|
+
}, "required", "reason" | "retryable" | "status">, import("convex/values").VObject<{
|
|
267
|
+
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
268
|
+
retryable: false;
|
|
269
|
+
status: "unknown";
|
|
270
|
+
}, {
|
|
271
|
+
status: import("convex/values").VLiteral<"unknown", "required">;
|
|
272
|
+
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>;
|
|
273
|
+
retryable: import("convex/values").VLiteral<false, "required">;
|
|
274
|
+
}, "required", "reason" | "retryable" | "status">], "optional", "reason" | "retryable" | "status">;
|
|
275
|
+
result: import("convex/values").VObject<{
|
|
276
|
+
claim: {
|
|
277
|
+
_creationTime: number;
|
|
278
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
279
|
+
accountId: string;
|
|
280
|
+
amountDue: number;
|
|
281
|
+
claimKey: string;
|
|
282
|
+
collectedAmount: number;
|
|
283
|
+
currency: string;
|
|
284
|
+
openingCollection?: {
|
|
285
|
+
amountDue: number;
|
|
286
|
+
collectedAmount: number;
|
|
287
|
+
operationKey: string;
|
|
288
|
+
revision: number;
|
|
289
|
+
} | undefined;
|
|
290
|
+
outstanding: number;
|
|
291
|
+
reservedAmount: number;
|
|
292
|
+
revision: number;
|
|
293
|
+
scopeKey: string;
|
|
294
|
+
sign: "negative" | "positive" | "zero";
|
|
295
|
+
sourceChargeId: string;
|
|
296
|
+
sourceGross: number;
|
|
297
|
+
sourceProcessingFee: number;
|
|
298
|
+
};
|
|
299
|
+
deficit: {
|
|
300
|
+
amountDue: number;
|
|
301
|
+
currency: string;
|
|
302
|
+
disputeLiability: number;
|
|
303
|
+
processingLiability: number;
|
|
304
|
+
retainedFee: number;
|
|
305
|
+
};
|
|
306
|
+
observation: {
|
|
307
|
+
currency: string;
|
|
308
|
+
disputeFees: number;
|
|
309
|
+
gross: number;
|
|
310
|
+
originalProcessingFee: number;
|
|
311
|
+
paymentIntentId: string;
|
|
312
|
+
principalReturned: number;
|
|
313
|
+
processingFee: number;
|
|
314
|
+
provenance: {
|
|
315
|
+
customerAccountId: string;
|
|
316
|
+
invoiceId: string;
|
|
317
|
+
invoicePaymentId: string;
|
|
318
|
+
recoveryInvoiceItemId?: string | undefined;
|
|
319
|
+
stripePriceId?: string | undefined;
|
|
320
|
+
stripeProductId?: string | undefined;
|
|
321
|
+
subscriptionId?: string | undefined;
|
|
322
|
+
};
|
|
323
|
+
sourceChargeId: string;
|
|
324
|
+
};
|
|
325
|
+
rollbackClaim?: {
|
|
326
|
+
_creationTime: number;
|
|
327
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
328
|
+
accountId: string;
|
|
329
|
+
amountDue: number;
|
|
330
|
+
claimKey: string;
|
|
331
|
+
collectedAmount: number;
|
|
332
|
+
currency: string;
|
|
333
|
+
openingCollection?: {
|
|
334
|
+
amountDue: number;
|
|
335
|
+
collectedAmount: number;
|
|
336
|
+
operationKey: string;
|
|
337
|
+
revision: number;
|
|
338
|
+
} | undefined;
|
|
339
|
+
outstanding: number;
|
|
340
|
+
reservedAmount: number;
|
|
341
|
+
revision: number;
|
|
342
|
+
scopeKey: string;
|
|
343
|
+
sign: "negative" | "positive" | "zero";
|
|
344
|
+
sourceChargeId: string;
|
|
345
|
+
sourceGross: number;
|
|
346
|
+
sourceProcessingFee: number;
|
|
347
|
+
} | undefined;
|
|
348
|
+
} | undefined, {
|
|
349
|
+
claim: import("convex/values").VObject<{
|
|
350
|
+
_creationTime: number;
|
|
351
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
352
|
+
accountId: string;
|
|
353
|
+
amountDue: number;
|
|
354
|
+
claimKey: string;
|
|
355
|
+
collectedAmount: number;
|
|
356
|
+
currency: string;
|
|
357
|
+
openingCollection?: {
|
|
358
|
+
amountDue: number;
|
|
359
|
+
collectedAmount: number;
|
|
360
|
+
operationKey: string;
|
|
361
|
+
revision: number;
|
|
362
|
+
} | undefined;
|
|
363
|
+
outstanding: number;
|
|
364
|
+
reservedAmount: number;
|
|
365
|
+
revision: number;
|
|
366
|
+
scopeKey: string;
|
|
367
|
+
sign: "negative" | "positive" | "zero";
|
|
368
|
+
sourceChargeId: string;
|
|
369
|
+
sourceGross: number;
|
|
370
|
+
sourceProcessingFee: number;
|
|
371
|
+
}, {
|
|
372
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
373
|
+
scopeKey: import("convex/values").VString<string, "required">;
|
|
374
|
+
currency: import("convex/values").VString<string, "required">;
|
|
375
|
+
claimKey: import("convex/values").VString<string, "required">;
|
|
376
|
+
sourceChargeId: import("convex/values").VString<string, "required">;
|
|
377
|
+
sourceGross: import("convex/values").VFloat64<number, "required">;
|
|
378
|
+
sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
|
|
379
|
+
amountDue: import("convex/values").VFloat64<number, "required">;
|
|
380
|
+
revision: import("convex/values").VFloat64<number, "required">;
|
|
381
|
+
collectedAmount: import("convex/values").VFloat64<number, "required">;
|
|
382
|
+
reservedAmount: import("convex/values").VFloat64<number, "required">;
|
|
383
|
+
outstanding: import("convex/values").VFloat64<number, "required">;
|
|
384
|
+
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>;
|
|
385
|
+
openingCollection: import("convex/values").VObject<{
|
|
386
|
+
amountDue: number;
|
|
387
|
+
collectedAmount: number;
|
|
388
|
+
operationKey: string;
|
|
389
|
+
revision: number;
|
|
390
|
+
} | undefined, {
|
|
391
|
+
operationKey: import("convex/values").VString<string, "required">;
|
|
392
|
+
amountDue: import("convex/values").VFloat64<number, "required">;
|
|
393
|
+
revision: import("convex/values").VFloat64<number, "required">;
|
|
394
|
+
collectedAmount: import("convex/values").VFloat64<number, "required">;
|
|
395
|
+
}, "optional", "amountDue" | "collectedAmount" | "operationKey" | "revision">;
|
|
396
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
|
|
397
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
398
|
+
}, "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">;
|
|
399
|
+
rollbackClaim: import("convex/values").VObject<{
|
|
400
|
+
_creationTime: number;
|
|
401
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
402
|
+
accountId: string;
|
|
403
|
+
amountDue: number;
|
|
404
|
+
claimKey: string;
|
|
405
|
+
collectedAmount: number;
|
|
406
|
+
currency: string;
|
|
407
|
+
openingCollection?: {
|
|
408
|
+
amountDue: number;
|
|
409
|
+
collectedAmount: number;
|
|
410
|
+
operationKey: string;
|
|
411
|
+
revision: number;
|
|
412
|
+
} | undefined;
|
|
413
|
+
outstanding: number;
|
|
414
|
+
reservedAmount: number;
|
|
415
|
+
revision: number;
|
|
416
|
+
scopeKey: string;
|
|
417
|
+
sign: "negative" | "positive" | "zero";
|
|
418
|
+
sourceChargeId: string;
|
|
419
|
+
sourceGross: number;
|
|
420
|
+
sourceProcessingFee: number;
|
|
421
|
+
} | undefined, {
|
|
422
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
423
|
+
scopeKey: import("convex/values").VString<string, "required">;
|
|
424
|
+
currency: import("convex/values").VString<string, "required">;
|
|
425
|
+
claimKey: import("convex/values").VString<string, "required">;
|
|
426
|
+
sourceChargeId: import("convex/values").VString<string, "required">;
|
|
427
|
+
sourceGross: import("convex/values").VFloat64<number, "required">;
|
|
428
|
+
sourceProcessingFee: import("convex/values").VFloat64<number, "required">;
|
|
429
|
+
amountDue: import("convex/values").VFloat64<number, "required">;
|
|
430
|
+
revision: import("convex/values").VFloat64<number, "required">;
|
|
431
|
+
collectedAmount: import("convex/values").VFloat64<number, "required">;
|
|
432
|
+
reservedAmount: import("convex/values").VFloat64<number, "required">;
|
|
433
|
+
outstanding: import("convex/values").VFloat64<number, "required">;
|
|
434
|
+
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>;
|
|
435
|
+
openingCollection: import("convex/values").VObject<{
|
|
436
|
+
amountDue: number;
|
|
437
|
+
collectedAmount: number;
|
|
438
|
+
operationKey: string;
|
|
439
|
+
revision: number;
|
|
440
|
+
} | undefined, {
|
|
441
|
+
operationKey: import("convex/values").VString<string, "required">;
|
|
442
|
+
amountDue: import("convex/values").VFloat64<number, "required">;
|
|
443
|
+
revision: import("convex/values").VFloat64<number, "required">;
|
|
444
|
+
collectedAmount: import("convex/values").VFloat64<number, "required">;
|
|
445
|
+
}, "optional", "amountDue" | "collectedAmount" | "operationKey" | "revision">;
|
|
446
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"recoveryClaims">, "required">;
|
|
447
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
448
|
+
}, "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">;
|
|
449
|
+
deficit: import("convex/values").VObject<{
|
|
450
|
+
amountDue: number;
|
|
451
|
+
currency: string;
|
|
452
|
+
disputeLiability: number;
|
|
453
|
+
processingLiability: number;
|
|
454
|
+
retainedFee: number;
|
|
455
|
+
}, {
|
|
456
|
+
currency: import("convex/values").VString<string, "required">;
|
|
457
|
+
retainedFee: import("convex/values").VFloat64<number, "required">;
|
|
458
|
+
processingLiability: import("convex/values").VFloat64<number, "required">;
|
|
459
|
+
disputeLiability: import("convex/values").VFloat64<number, "required">;
|
|
460
|
+
amountDue: import("convex/values").VFloat64<number, "required">;
|
|
461
|
+
}, "required", "amountDue" | "currency" | "disputeLiability" | "processingLiability" | "retainedFee">;
|
|
462
|
+
observation: import("convex/values").VObject<{
|
|
463
|
+
currency: string;
|
|
464
|
+
disputeFees: number;
|
|
465
|
+
gross: number;
|
|
466
|
+
originalProcessingFee: number;
|
|
467
|
+
paymentIntentId: string;
|
|
468
|
+
principalReturned: number;
|
|
469
|
+
processingFee: number;
|
|
470
|
+
provenance: {
|
|
471
|
+
customerAccountId: string;
|
|
472
|
+
invoiceId: string;
|
|
473
|
+
invoicePaymentId: string;
|
|
474
|
+
recoveryInvoiceItemId?: string | undefined;
|
|
475
|
+
stripePriceId?: string | undefined;
|
|
476
|
+
stripeProductId?: string | undefined;
|
|
477
|
+
subscriptionId?: string | undefined;
|
|
478
|
+
};
|
|
479
|
+
sourceChargeId: string;
|
|
480
|
+
}, {
|
|
481
|
+
paymentIntentId: import("convex/values").VString<string, "required">;
|
|
482
|
+
sourceChargeId: import("convex/values").VString<string, "required">;
|
|
483
|
+
currency: import("convex/values").VString<string, "required">;
|
|
484
|
+
gross: import("convex/values").VFloat64<number, "required">;
|
|
485
|
+
originalProcessingFee: import("convex/values").VFloat64<number, "required">;
|
|
486
|
+
processingFee: import("convex/values").VFloat64<number, "required">;
|
|
487
|
+
disputeFees: import("convex/values").VFloat64<number, "required">;
|
|
488
|
+
principalReturned: import("convex/values").VFloat64<number, "required">;
|
|
489
|
+
provenance: import("convex/values").VObject<{
|
|
490
|
+
customerAccountId: string;
|
|
491
|
+
invoiceId: string;
|
|
492
|
+
invoicePaymentId: string;
|
|
493
|
+
recoveryInvoiceItemId?: string | undefined;
|
|
494
|
+
stripePriceId?: string | undefined;
|
|
495
|
+
stripeProductId?: string | undefined;
|
|
496
|
+
subscriptionId?: string | undefined;
|
|
497
|
+
}, {
|
|
498
|
+
invoiceId: import("convex/values").VString<string, "required">;
|
|
499
|
+
invoicePaymentId: import("convex/values").VString<string, "required">;
|
|
500
|
+
recoveryInvoiceItemId: import("convex/values").VString<string | undefined, "optional">;
|
|
501
|
+
customerAccountId: import("convex/values").VString<string, "required">;
|
|
502
|
+
subscriptionId: import("convex/values").VString<string | undefined, "optional">;
|
|
503
|
+
stripePriceId: import("convex/values").VString<string | undefined, "optional">;
|
|
504
|
+
stripeProductId: import("convex/values").VString<string | undefined, "optional">;
|
|
505
|
+
}, "required", "customerAccountId" | "invoiceId" | "invoicePaymentId" | "recoveryInvoiceItemId" | "stripePriceId" | "stripeProductId" | "subscriptionId">;
|
|
506
|
+
}, "required", "currency" | "disputeFees" | "gross" | "originalProcessingFee" | "paymentIntentId" | "principalReturned" | "processingFee" | "provenance" | "provenance.customerAccountId" | "provenance.invoiceId" | "provenance.invoicePaymentId" | "provenance.recoveryInvoiceItemId" | "provenance.stripePriceId" | "provenance.stripeProductId" | "provenance.subscriptionId" | "sourceChargeId">;
|
|
507
|
+
}, "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">;
|
|
508
|
+
}, "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">, {
|
|
509
|
+
by_claim_status: ["claimKey", "status", "_creationTime"];
|
|
510
|
+
by_payment_scope: ["accountId", "scopeKey", "currency", "source.paymentIntentId", "_creationTime"];
|
|
511
|
+
by_request: ["requestKey", "_creationTime"];
|
|
512
|
+
}, {}, {}>;
|
|
2
513
|
recoveryWorkflowOperations: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
3
514
|
accountId: string;
|
|
4
515
|
activePhase?: "execute" | "reconcile" | undefined;
|
package/dist/component/schema.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { operationsTable as processingCostReconciliationOperations } from "./processingCostReconciliation/schema.js";
|
|
1
2
|
import { operationsTable as recoveryWorkflowOperations, requestsTable as recoveryWorkflowRequests, } from "./recoveryWorkflow/schema.js";
|
|
2
3
|
import { preparationsTable as balanceFundingPreparations, operationsTable as balanceFundingOperations, requestsTable as balanceFundingRequests, } from "./balanceFunding/schema.js";
|
|
3
4
|
import { payloadsTable as operationEvidencePayloads, headersTable as operationEvidenceHeaders, } from "./operationEvidence/schema.js";
|
|
@@ -23,6 +24,7 @@ import { accountsTable } from "./core/schema";
|
|
|
23
24
|
import { pricesTable, productsTable } from "./products/schema";
|
|
24
25
|
import { webhookEventsTable } from "./webhooks/schema";
|
|
25
26
|
export default defineSchema({
|
|
27
|
+
processingCostReconciliationOperations,
|
|
26
28
|
recoveryWorkflowOperations,
|
|
27
29
|
recoveryWorkflowRequests,
|
|
28
30
|
balanceFundingPreparations,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/component/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,IAAI,0BAA0B,EAC7C,aAAa,IAAI,wBAAwB,GAC1C,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,iBAAiB,IAAI,0BAA0B,EAC/C,eAAe,IAAI,wBAAwB,EAC3C,aAAa,IAAI,sBAAsB,GACxC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,aAAa,IAAI,yBAAyB,EAC1C,YAAY,IAAI,wBAAwB,GACzC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,oDAAoD,CAAC;AAClG,OAAO,EACL,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,2CAA2C,CAAC;AACnD,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,2BAA2B,GAC5B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,gBAAgB,GACjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,SAAS,IAAI,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC9E,OAAO,EACL,uBAAuB,EACvB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,IAAI,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC9E,O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O,EAAE,YAAY;IACrB,iBAAiB,EAAE,sBAAsB;IACzC,OAAO,EAAE,YAAY;IACrB,QAAQ,EAAE,aAAa;IACvB,SAAS,EAAE,cAAc;IACzB,mBAAmB,EAAE,wBAAwB;IAE7C,WAAW;IACX,aAAa,EAAE,kBAAkB;CAClC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
boundedCostHistory,
|
|
3
|
+
type ProcessingCostHistoryBounds,
|
|
4
|
+
} from "./settlement/processingCostHistory.js";
|
|
1
5
|
import { singleInvoiceFunding } from "./paymentSource/funding.js";
|
|
2
6
|
import { getProcessingCostContext } from "./settlement/processingCosts.js";
|
|
3
7
|
import type Stripe from "stripe";
|
|
@@ -22,6 +26,7 @@ export function attachRecoveryInvoice(
|
|
|
22
26
|
bind: BindInvoiceItem,
|
|
23
27
|
create?: true,
|
|
24
28
|
maxItems?: number,
|
|
29
|
+
historyBounds?: ProcessingCostHistoryBounds,
|
|
25
30
|
): Promise<InvoiceReceipt>;
|
|
26
31
|
export function attachRecoveryInvoice(
|
|
27
32
|
stripe: Stripe,
|
|
@@ -30,6 +35,7 @@ export function attachRecoveryInvoice(
|
|
|
30
35
|
bind: BindInvoiceItem,
|
|
31
36
|
create: false,
|
|
32
37
|
maxItems?: number,
|
|
38
|
+
historyBounds?: ProcessingCostHistoryBounds,
|
|
33
39
|
): Promise<
|
|
34
40
|
| InvoiceReceipt
|
|
35
41
|
| (Omit<InvoiceReceipt, "invoiceItemId"> & { invoiceItemId: null })
|
|
@@ -43,6 +49,7 @@ export async function attachRecoveryInvoice(
|
|
|
43
49
|
bind: (invoiceItemId: string) => Promise<RecoveryGroup>,
|
|
44
50
|
create = true,
|
|
45
51
|
maxItems = Number.POSITIVE_INFINITY,
|
|
52
|
+
historyBounds?: ProcessingCostHistoryBounds,
|
|
46
53
|
) {
|
|
47
54
|
if (
|
|
48
55
|
!group ||
|
|
@@ -70,10 +77,18 @@ export async function attachRecoveryInvoice(
|
|
|
70
77
|
throw new Error("Recovery invoice currency does not match.");
|
|
71
78
|
let found: Stripe.InvoiceItem | undefined;
|
|
72
79
|
let inspected = 0;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
80
|
+
const itemRows = historyBounds
|
|
81
|
+
? await boundedCostHistory(
|
|
82
|
+
(cursor, limit) =>
|
|
83
|
+
stripe.invoiceItems.list({
|
|
84
|
+
invoice: invoice.id,
|
|
85
|
+
limit,
|
|
86
|
+
...(cursor ? { starting_after: cursor } : {}),
|
|
87
|
+
}),
|
|
88
|
+
historyBounds,
|
|
89
|
+
)
|
|
90
|
+
: stripe.invoiceItems.list({ invoice: invoice.id, limit: 100 });
|
|
91
|
+
for await (const item of itemRows) {
|
|
77
92
|
if (++inspected > maxItems)
|
|
78
93
|
throw new Error("Recovery invoice history exceeded its item bound.");
|
|
79
94
|
if (item.metadata?.[marker] !== group._id) continue;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
export type { ProcessingCostProviderOptions } from "./processingCostReconciliation/provider.js";
|
|
2
|
+
import { ProcessingCostReconciliationClient } from "./processingCostReconciliation/client.js";
|
|
3
|
+
export type * from "./processingCostReconciliation/contracts.js";
|
|
2
4
|
export type * from "./recoveryWorkflow/contracts.js";
|
|
3
5
|
export type { RecoveryProviderOptions } from "./recoveryWorkflow/provider.js";
|
|
4
6
|
import type Stripe from "stripe";
|
|
@@ -99,7 +101,7 @@ export type RecoveryPreparationResult =
|
|
|
99
101
|
retryable: false;
|
|
100
102
|
};
|
|
101
103
|
/** Host authorizes policy and scope. Provider methods verify invoice outcomes. */
|
|
102
|
-
export class CostRecoveryClient extends
|
|
104
|
+
export class CostRecoveryClient extends ProcessingCostReconciliationClient {
|
|
103
105
|
constructor(
|
|
104
106
|
protected readonly component: Component,
|
|
105
107
|
private readonly provider?: () => Stripe,
|