@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
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
2
|
+
accountId: string;
|
|
3
|
+
currency: string;
|
|
4
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
5
|
+
scopeKey: string;
|
|
6
|
+
version: number;
|
|
7
|
+
}, Promise<{
|
|
8
|
+
status: "completed";
|
|
9
|
+
result: {
|
|
10
|
+
claim: {
|
|
11
|
+
_creationTime: number;
|
|
12
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
13
|
+
accountId: string;
|
|
14
|
+
amountDue: number;
|
|
15
|
+
claimKey: string;
|
|
16
|
+
collectedAmount: number;
|
|
17
|
+
currency: string;
|
|
18
|
+
openingCollection?: {
|
|
19
|
+
amountDue: number;
|
|
20
|
+
collectedAmount: number;
|
|
21
|
+
operationKey: string;
|
|
22
|
+
revision: number;
|
|
23
|
+
} | undefined;
|
|
24
|
+
outstanding: number;
|
|
25
|
+
reservedAmount: number;
|
|
26
|
+
revision: number;
|
|
27
|
+
scopeKey: string;
|
|
28
|
+
sign: "negative" | "positive" | "zero";
|
|
29
|
+
sourceChargeId: string;
|
|
30
|
+
sourceGross: number;
|
|
31
|
+
sourceProcessingFee: number;
|
|
32
|
+
};
|
|
33
|
+
deficit: {
|
|
34
|
+
amountDue: number;
|
|
35
|
+
currency: string;
|
|
36
|
+
disputeLiability: number;
|
|
37
|
+
processingLiability: number;
|
|
38
|
+
retainedFee: number;
|
|
39
|
+
};
|
|
40
|
+
observation: {
|
|
41
|
+
currency: string;
|
|
42
|
+
disputeFees: number;
|
|
43
|
+
gross: number;
|
|
44
|
+
originalProcessingFee: number;
|
|
45
|
+
paymentIntentId: string;
|
|
46
|
+
principalReturned: number;
|
|
47
|
+
processingFee: number;
|
|
48
|
+
provenance: {
|
|
49
|
+
customerAccountId: string;
|
|
50
|
+
invoiceId: string;
|
|
51
|
+
invoicePaymentId: string;
|
|
52
|
+
recoveryInvoiceItemId?: string | undefined;
|
|
53
|
+
stripePriceId?: string | undefined;
|
|
54
|
+
stripeProductId?: string | undefined;
|
|
55
|
+
subscriptionId?: string | undefined;
|
|
56
|
+
};
|
|
57
|
+
sourceChargeId: string;
|
|
58
|
+
};
|
|
59
|
+
rollbackClaim?: {
|
|
60
|
+
_creationTime: number;
|
|
61
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
62
|
+
accountId: string;
|
|
63
|
+
amountDue: number;
|
|
64
|
+
claimKey: string;
|
|
65
|
+
collectedAmount: number;
|
|
66
|
+
currency: string;
|
|
67
|
+
openingCollection?: {
|
|
68
|
+
amountDue: number;
|
|
69
|
+
collectedAmount: number;
|
|
70
|
+
operationKey: string;
|
|
71
|
+
revision: number;
|
|
72
|
+
} | undefined;
|
|
73
|
+
outstanding: number;
|
|
74
|
+
reservedAmount: number;
|
|
75
|
+
revision: number;
|
|
76
|
+
scopeKey: string;
|
|
77
|
+
sign: "negative" | "positive" | "zero";
|
|
78
|
+
sourceChargeId: string;
|
|
79
|
+
sourceGross: number;
|
|
80
|
+
sourceProcessingFee: number;
|
|
81
|
+
} | undefined;
|
|
82
|
+
};
|
|
83
|
+
accountId: string;
|
|
84
|
+
currency: string;
|
|
85
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
86
|
+
scopeKey: string;
|
|
87
|
+
version: number;
|
|
88
|
+
} | {
|
|
89
|
+
accountId: string;
|
|
90
|
+
currency: string;
|
|
91
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
92
|
+
reason: "fee_pending" | "history_incomplete" | "provider_pending";
|
|
93
|
+
retryable: true;
|
|
94
|
+
scopeKey: string;
|
|
95
|
+
status: "not_ready";
|
|
96
|
+
version: number;
|
|
97
|
+
} | {
|
|
98
|
+
accountId: string;
|
|
99
|
+
currency: string;
|
|
100
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
101
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
102
|
+
retryable: false;
|
|
103
|
+
scopeKey: string;
|
|
104
|
+
status: "conflict";
|
|
105
|
+
version: number;
|
|
106
|
+
} | {
|
|
107
|
+
accountId: string;
|
|
108
|
+
currency: string;
|
|
109
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
110
|
+
reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
|
|
111
|
+
retryable: false;
|
|
112
|
+
scopeKey: string;
|
|
113
|
+
status: "rejected";
|
|
114
|
+
version: number;
|
|
115
|
+
} | {
|
|
116
|
+
accountId: string;
|
|
117
|
+
currency: string;
|
|
118
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
119
|
+
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
120
|
+
retryable: false;
|
|
121
|
+
scopeKey: string;
|
|
122
|
+
status: "unknown";
|
|
123
|
+
version: number;
|
|
124
|
+
} | {
|
|
125
|
+
status: "queued" | "running";
|
|
126
|
+
accountId: string;
|
|
127
|
+
currency: string;
|
|
128
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
129
|
+
scopeKey: string;
|
|
130
|
+
version: number;
|
|
131
|
+
}>>;
|
|
132
|
+
export declare const snapshot: import("convex/server").RegisteredQuery<"public", {
|
|
133
|
+
accountId: string;
|
|
134
|
+
currency: string;
|
|
135
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
136
|
+
scopeKey: string;
|
|
137
|
+
version: number;
|
|
138
|
+
}, Promise<{
|
|
139
|
+
_creationTime: number;
|
|
140
|
+
_id: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
141
|
+
accountId: string;
|
|
142
|
+
claimKey: string;
|
|
143
|
+
currency: string;
|
|
144
|
+
definitionVersion: number;
|
|
145
|
+
expectedRevision: number;
|
|
146
|
+
failure?: {
|
|
147
|
+
reason: "fee_pending" | "history_incomplete" | "provider_pending";
|
|
148
|
+
retryable: true;
|
|
149
|
+
status: "not_ready";
|
|
150
|
+
} | {
|
|
151
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
152
|
+
retryable: false;
|
|
153
|
+
status: "conflict";
|
|
154
|
+
} | {
|
|
155
|
+
reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
|
|
156
|
+
retryable: false;
|
|
157
|
+
status: "rejected";
|
|
158
|
+
} | {
|
|
159
|
+
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
160
|
+
retryable: false;
|
|
161
|
+
status: "unknown";
|
|
162
|
+
} | undefined;
|
|
163
|
+
importHook?: string | undefined;
|
|
164
|
+
maxAttempts: number;
|
|
165
|
+
policy: {
|
|
166
|
+
liability: {
|
|
167
|
+
disputeCosts: "all" | "none";
|
|
168
|
+
processingCosts: "all" | "none" | "uncovered";
|
|
169
|
+
};
|
|
170
|
+
rounding: "ceil" | "floor" | "nearest";
|
|
171
|
+
sellingFee: number;
|
|
172
|
+
};
|
|
173
|
+
projection?: string | undefined;
|
|
174
|
+
provider: string;
|
|
175
|
+
providerApiVersion: string;
|
|
176
|
+
requestKey: string;
|
|
177
|
+
result?: {
|
|
178
|
+
claim: {
|
|
179
|
+
_creationTime: number;
|
|
180
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
181
|
+
accountId: string;
|
|
182
|
+
amountDue: number;
|
|
183
|
+
claimKey: string;
|
|
184
|
+
collectedAmount: number;
|
|
185
|
+
currency: string;
|
|
186
|
+
openingCollection?: {
|
|
187
|
+
amountDue: number;
|
|
188
|
+
collectedAmount: number;
|
|
189
|
+
operationKey: string;
|
|
190
|
+
revision: number;
|
|
191
|
+
} | undefined;
|
|
192
|
+
outstanding: number;
|
|
193
|
+
reservedAmount: number;
|
|
194
|
+
revision: number;
|
|
195
|
+
scopeKey: string;
|
|
196
|
+
sign: "negative" | "positive" | "zero";
|
|
197
|
+
sourceChargeId: string;
|
|
198
|
+
sourceGross: number;
|
|
199
|
+
sourceProcessingFee: number;
|
|
200
|
+
};
|
|
201
|
+
deficit: {
|
|
202
|
+
amountDue: number;
|
|
203
|
+
currency: string;
|
|
204
|
+
disputeLiability: number;
|
|
205
|
+
processingLiability: number;
|
|
206
|
+
retainedFee: number;
|
|
207
|
+
};
|
|
208
|
+
observation: {
|
|
209
|
+
currency: string;
|
|
210
|
+
disputeFees: number;
|
|
211
|
+
gross: number;
|
|
212
|
+
originalProcessingFee: number;
|
|
213
|
+
paymentIntentId: string;
|
|
214
|
+
principalReturned: number;
|
|
215
|
+
processingFee: number;
|
|
216
|
+
provenance: {
|
|
217
|
+
customerAccountId: string;
|
|
218
|
+
invoiceId: string;
|
|
219
|
+
invoicePaymentId: string;
|
|
220
|
+
recoveryInvoiceItemId?: string | undefined;
|
|
221
|
+
stripePriceId?: string | undefined;
|
|
222
|
+
stripeProductId?: string | undefined;
|
|
223
|
+
subscriptionId?: string | undefined;
|
|
224
|
+
};
|
|
225
|
+
sourceChargeId: string;
|
|
226
|
+
};
|
|
227
|
+
rollbackClaim?: {
|
|
228
|
+
_creationTime: number;
|
|
229
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
230
|
+
accountId: string;
|
|
231
|
+
amountDue: number;
|
|
232
|
+
claimKey: string;
|
|
233
|
+
collectedAmount: number;
|
|
234
|
+
currency: string;
|
|
235
|
+
openingCollection?: {
|
|
236
|
+
amountDue: number;
|
|
237
|
+
collectedAmount: number;
|
|
238
|
+
operationKey: string;
|
|
239
|
+
revision: number;
|
|
240
|
+
} | undefined;
|
|
241
|
+
outstanding: number;
|
|
242
|
+
reservedAmount: number;
|
|
243
|
+
revision: number;
|
|
244
|
+
scopeKey: string;
|
|
245
|
+
sign: "negative" | "positive" | "zero";
|
|
246
|
+
sourceChargeId: string;
|
|
247
|
+
sourceGross: number;
|
|
248
|
+
sourceProcessingFee: number;
|
|
249
|
+
} | undefined;
|
|
250
|
+
} | undefined;
|
|
251
|
+
retryDelayMs: number;
|
|
252
|
+
rollback?: {
|
|
253
|
+
expectedRevision: number;
|
|
254
|
+
groupKey: string;
|
|
255
|
+
} | undefined;
|
|
256
|
+
scopeKey: string;
|
|
257
|
+
source: {
|
|
258
|
+
customerAccountId: string;
|
|
259
|
+
gross: number;
|
|
260
|
+
invoiceId?: string | undefined;
|
|
261
|
+
kind: "sale";
|
|
262
|
+
paymentIntentId: string;
|
|
263
|
+
stripeAccountId?: string | undefined;
|
|
264
|
+
stripePriceId?: string | undefined;
|
|
265
|
+
stripeProductId?: string | undefined;
|
|
266
|
+
subscriptionId?: string | undefined;
|
|
267
|
+
} | {
|
|
268
|
+
gross: number;
|
|
269
|
+
groupKey: string;
|
|
270
|
+
kind: "invoice_recovery";
|
|
271
|
+
paymentIntentId: string;
|
|
272
|
+
};
|
|
273
|
+
status: "completed" | "conflict" | "queued" | "rejected" | "running" | "unknown" | "waiting";
|
|
274
|
+
version: number;
|
|
275
|
+
workflowId?: string | undefined;
|
|
276
|
+
}>>;
|
|
277
|
+
export declare const saved: import("convex/server").RegisteredQuery<"internal", {
|
|
278
|
+
accountId: string;
|
|
279
|
+
currency: string;
|
|
280
|
+
operationId: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
281
|
+
scopeKey: string;
|
|
282
|
+
version: number;
|
|
283
|
+
}, Promise<{
|
|
284
|
+
_creationTime: number;
|
|
285
|
+
_id: import("convex/values").GenericId<"processingCostReconciliationOperations">;
|
|
286
|
+
accountId: string;
|
|
287
|
+
claimKey: string;
|
|
288
|
+
currency: string;
|
|
289
|
+
definitionVersion: number;
|
|
290
|
+
expectedRevision: number;
|
|
291
|
+
failure?: {
|
|
292
|
+
reason: "fee_pending" | "history_incomplete" | "provider_pending";
|
|
293
|
+
retryable: true;
|
|
294
|
+
status: "not_ready";
|
|
295
|
+
} | {
|
|
296
|
+
reason: "identity_changed" | "revision_changed" | "scope_busy";
|
|
297
|
+
retryable: false;
|
|
298
|
+
status: "conflict";
|
|
299
|
+
} | {
|
|
300
|
+
reason: "currency_mismatch" | "invalid_scope" | "payment_not_payable" | "policy_invalid" | "unsupported_source";
|
|
301
|
+
retryable: false;
|
|
302
|
+
status: "rejected";
|
|
303
|
+
} | {
|
|
304
|
+
reason: "history_incomplete" | "provider_outcome_unknown";
|
|
305
|
+
retryable: false;
|
|
306
|
+
status: "unknown";
|
|
307
|
+
} | undefined;
|
|
308
|
+
importHook?: string | undefined;
|
|
309
|
+
maxAttempts: number;
|
|
310
|
+
policy: {
|
|
311
|
+
liability: {
|
|
312
|
+
disputeCosts: "all" | "none";
|
|
313
|
+
processingCosts: "all" | "none" | "uncovered";
|
|
314
|
+
};
|
|
315
|
+
rounding: "ceil" | "floor" | "nearest";
|
|
316
|
+
sellingFee: number;
|
|
317
|
+
};
|
|
318
|
+
projection?: string | undefined;
|
|
319
|
+
provider: string;
|
|
320
|
+
providerApiVersion: string;
|
|
321
|
+
requestKey: string;
|
|
322
|
+
result?: {
|
|
323
|
+
claim: {
|
|
324
|
+
_creationTime: number;
|
|
325
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
326
|
+
accountId: string;
|
|
327
|
+
amountDue: number;
|
|
328
|
+
claimKey: string;
|
|
329
|
+
collectedAmount: number;
|
|
330
|
+
currency: string;
|
|
331
|
+
openingCollection?: {
|
|
332
|
+
amountDue: number;
|
|
333
|
+
collectedAmount: number;
|
|
334
|
+
operationKey: string;
|
|
335
|
+
revision: number;
|
|
336
|
+
} | undefined;
|
|
337
|
+
outstanding: number;
|
|
338
|
+
reservedAmount: number;
|
|
339
|
+
revision: number;
|
|
340
|
+
scopeKey: string;
|
|
341
|
+
sign: "negative" | "positive" | "zero";
|
|
342
|
+
sourceChargeId: string;
|
|
343
|
+
sourceGross: number;
|
|
344
|
+
sourceProcessingFee: number;
|
|
345
|
+
};
|
|
346
|
+
deficit: {
|
|
347
|
+
amountDue: number;
|
|
348
|
+
currency: string;
|
|
349
|
+
disputeLiability: number;
|
|
350
|
+
processingLiability: number;
|
|
351
|
+
retainedFee: number;
|
|
352
|
+
};
|
|
353
|
+
observation: {
|
|
354
|
+
currency: string;
|
|
355
|
+
disputeFees: number;
|
|
356
|
+
gross: number;
|
|
357
|
+
originalProcessingFee: number;
|
|
358
|
+
paymentIntentId: string;
|
|
359
|
+
principalReturned: number;
|
|
360
|
+
processingFee: number;
|
|
361
|
+
provenance: {
|
|
362
|
+
customerAccountId: string;
|
|
363
|
+
invoiceId: string;
|
|
364
|
+
invoicePaymentId: string;
|
|
365
|
+
recoveryInvoiceItemId?: string | undefined;
|
|
366
|
+
stripePriceId?: string | undefined;
|
|
367
|
+
stripeProductId?: string | undefined;
|
|
368
|
+
subscriptionId?: string | undefined;
|
|
369
|
+
};
|
|
370
|
+
sourceChargeId: string;
|
|
371
|
+
};
|
|
372
|
+
rollbackClaim?: {
|
|
373
|
+
_creationTime: number;
|
|
374
|
+
_id: import("convex/values").GenericId<"recoveryClaims">;
|
|
375
|
+
accountId: string;
|
|
376
|
+
amountDue: number;
|
|
377
|
+
claimKey: string;
|
|
378
|
+
collectedAmount: number;
|
|
379
|
+
currency: string;
|
|
380
|
+
openingCollection?: {
|
|
381
|
+
amountDue: number;
|
|
382
|
+
collectedAmount: number;
|
|
383
|
+
operationKey: string;
|
|
384
|
+
revision: number;
|
|
385
|
+
} | undefined;
|
|
386
|
+
outstanding: number;
|
|
387
|
+
reservedAmount: number;
|
|
388
|
+
revision: number;
|
|
389
|
+
scopeKey: string;
|
|
390
|
+
sign: "negative" | "positive" | "zero";
|
|
391
|
+
sourceChargeId: string;
|
|
392
|
+
sourceGross: number;
|
|
393
|
+
sourceProcessingFee: number;
|
|
394
|
+
} | undefined;
|
|
395
|
+
} | undefined;
|
|
396
|
+
retryDelayMs: number;
|
|
397
|
+
rollback?: {
|
|
398
|
+
expectedRevision: number;
|
|
399
|
+
groupKey: string;
|
|
400
|
+
} | undefined;
|
|
401
|
+
scopeKey: string;
|
|
402
|
+
source: {
|
|
403
|
+
customerAccountId: string;
|
|
404
|
+
gross: number;
|
|
405
|
+
invoiceId?: string | undefined;
|
|
406
|
+
kind: "sale";
|
|
407
|
+
paymentIntentId: string;
|
|
408
|
+
stripeAccountId?: string | undefined;
|
|
409
|
+
stripePriceId?: string | undefined;
|
|
410
|
+
stripeProductId?: string | undefined;
|
|
411
|
+
subscriptionId?: string | undefined;
|
|
412
|
+
} | {
|
|
413
|
+
gross: number;
|
|
414
|
+
groupKey: string;
|
|
415
|
+
kind: "invoice_recovery";
|
|
416
|
+
paymentIntentId: string;
|
|
417
|
+
};
|
|
418
|
+
status: "completed" | "conflict" | "queued" | "rejected" | "running" | "unknown" | "waiting";
|
|
419
|
+
version: number;
|
|
420
|
+
workflowId?: string | undefined;
|
|
421
|
+
}>>;
|
|
422
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/processingCostReconciliation/queries.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAId,CAAC;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAInB,CAAC;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAIhB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { query, internalQuery } from "../_generated/server.js";
|
|
2
|
+
import { refFields, safeStatus, operationDoc } from "./schema.js";
|
|
3
|
+
import { read, status } from "./helpers.js";
|
|
4
|
+
export const get = query({
|
|
5
|
+
args: refFields,
|
|
6
|
+
returns: safeStatus,
|
|
7
|
+
handler: async (ctx, args) => status(await read(ctx, args)),
|
|
8
|
+
});
|
|
9
|
+
export const snapshot = query({
|
|
10
|
+
args: refFields,
|
|
11
|
+
returns: operationDoc,
|
|
12
|
+
handler: read,
|
|
13
|
+
});
|
|
14
|
+
export const saved = internalQuery({
|
|
15
|
+
args: refFields,
|
|
16
|
+
returns: operationDoc,
|
|
17
|
+
handler: read,
|
|
18
|
+
});
|
|
19
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/component/processingCostReconciliation/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC5C,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC;IACvB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;CAC5D,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,KAAK,CAAC;IAC5B,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,IAAI;CACd,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC;IACjC,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,YAAY;IACrB,OAAO,EAAE,IAAI;CACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Infer } from "convex/values";
|
|
2
|
+
import type { Doc } from "../_generated/dataModel.js";
|
|
3
|
+
import type { MutationCtx } from "../_generated/server.js";
|
|
4
|
+
import { observation } from "./schema.js";
|
|
5
|
+
/** All checks precede every import/claim/rollback write in the parent transaction. */
|
|
6
|
+
export declare function checkRollback(ctx: MutationCtx, op: Doc<"processingCostReconciliationOperations">, o: Infer<typeof observation>): Promise<{
|
|
7
|
+
readonly status: "conflict";
|
|
8
|
+
readonly reason: "identity_changed" | "revision_changed";
|
|
9
|
+
readonly retryable: false;
|
|
10
|
+
} | {
|
|
11
|
+
readonly status: "not_ready";
|
|
12
|
+
readonly reason: "provider_pending";
|
|
13
|
+
readonly retryable: true;
|
|
14
|
+
readonly bindFunding?: undefined;
|
|
15
|
+
} | {
|
|
16
|
+
reason?: undefined;
|
|
17
|
+
retryable?: undefined;
|
|
18
|
+
readonly status: "ready";
|
|
19
|
+
readonly bindFunding: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
//# sourceMappingURL=rollback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollback.d.ts","sourceRoot":"","sources":["../../../src/component/processingCostReconciliation/rollback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,sFAAsF;AACtF,wBAAsB,aAAa,CACjC,GAAG,EAAE,WAAW,EAChB,EAAE,EAAE,GAAG,CAAC,wCAAwC,CAAC,EACjD,CAAC,EAAE,KAAK,CAAC,OAAO,WAAW,CAAC;;;;;qBAmBhB,WAAW;qBACX,kBAAkB;;;;;;qBAyCb,OAAO;;GACzB"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { conflict } from "./helpers.js";
|
|
2
|
+
/** All checks precede every import/claim/rollback write in the parent transaction. */
|
|
3
|
+
export async function checkRollback(ctx, op, o) {
|
|
4
|
+
if (!op.rollback)
|
|
5
|
+
return op.source.kind === "invoice_recovery"
|
|
6
|
+
? conflict("identity_changed")
|
|
7
|
+
: { status: "ready", bindFunding: false };
|
|
8
|
+
const group = await ctx.db
|
|
9
|
+
.query("recoveryGroups")
|
|
10
|
+
.withIndex("by_key", (q) => q.eq("groupKey", op.rollback.groupKey))
|
|
11
|
+
.unique();
|
|
12
|
+
if (!group ||
|
|
13
|
+
group.accountId !== op.accountId ||
|
|
14
|
+
group.scopeKey !== op.scopeKey ||
|
|
15
|
+
group.currency !== op.currency)
|
|
16
|
+
return conflict("identity_changed");
|
|
17
|
+
if (group.status !== "collected")
|
|
18
|
+
return {
|
|
19
|
+
status: "not_ready",
|
|
20
|
+
reason: "provider_pending",
|
|
21
|
+
retryable: true,
|
|
22
|
+
};
|
|
23
|
+
if (op.source.kind === "invoice_recovery" &&
|
|
24
|
+
(op.source.groupKey !== group.groupKey || group.sourceKind !== "invoice"))
|
|
25
|
+
return conflict("identity_changed");
|
|
26
|
+
if (group.sourceKind === "invoice" &&
|
|
27
|
+
(!group.invoiceItemId ||
|
|
28
|
+
o.provenance.invoiceId !== group.sourceId ||
|
|
29
|
+
o.provenance.customerAccountId !== group.accountId ||
|
|
30
|
+
o.provenance.recoveryInvoiceItemId !== group.invoiceItemId))
|
|
31
|
+
return conflict("identity_changed");
|
|
32
|
+
const funding = group.sourceKind === "settlement"
|
|
33
|
+
? {
|
|
34
|
+
sourceChargeId: group.sourceId,
|
|
35
|
+
sourceGross: group.sourceGross,
|
|
36
|
+
sourceProcessingFee: group.sourceProcessingFee,
|
|
37
|
+
}
|
|
38
|
+
: group.invoiceFunding;
|
|
39
|
+
if (funding &&
|
|
40
|
+
(funding.sourceChargeId !== o.sourceChargeId ||
|
|
41
|
+
funding.sourceGross !== o.gross ||
|
|
42
|
+
funding.sourceProcessingFee !== o.originalProcessingFee))
|
|
43
|
+
return conflict("identity_changed");
|
|
44
|
+
if (!funding && group.sourceKind !== "invoice")
|
|
45
|
+
return conflict("identity_changed");
|
|
46
|
+
const previous = await ctx.db
|
|
47
|
+
.query("recoveryClaims")
|
|
48
|
+
.withIndex("by_key", (q) => q.eq("claimKey", `rollback:${op.rollback.groupKey}`))
|
|
49
|
+
.unique();
|
|
50
|
+
if ((previous?.revision ?? -1) !== op.rollback.expectedRevision)
|
|
51
|
+
return conflict("revision_changed");
|
|
52
|
+
return { status: "ready", bindFunding: !funding };
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=rollback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollback.js","sourceRoot":"","sources":["../../../src/component/processingCostReconciliation/rollback.ts"],"names":[],"mappings":"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"}
|