@fantastic.dev/better-stripe 0.23.1 → 0.24.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 +26 -2
- package/README.md +40 -5
- package/dist/client/affiliateRecovery/disputes.d.ts +18 -0
- package/dist/client/affiliateRecovery/disputes.d.ts.map +1 -0
- package/dist/client/affiliateRecovery/disputes.js +33 -0
- package/dist/client/affiliateRecovery/disputes.js.map +1 -0
- package/dist/client/affiliateRecovery/engine.d.ts +29 -0
- package/dist/client/affiliateRecovery/engine.d.ts.map +1 -0
- package/dist/client/affiliateRecovery/engine.js +116 -0
- package/dist/client/affiliateRecovery/engine.js.map +1 -0
- package/dist/client/affiliateRecovery/payoutGate.d.ts +24 -0
- package/dist/client/affiliateRecovery/payoutGate.d.ts.map +1 -0
- package/dist/client/affiliateRecovery/payoutGate.js +30 -0
- package/dist/client/affiliateRecovery/payoutGate.js.map +1 -0
- package/dist/client/affiliateRecovery/provider.d.ts +14 -0
- package/dist/client/affiliateRecovery/provider.d.ts.map +1 -0
- package/dist/client/affiliateRecovery/provider.js +96 -0
- package/dist/client/affiliateRecovery/provider.js.map +1 -0
- package/dist/client/affiliateRecovery/review.d.ts +28 -0
- package/dist/client/affiliateRecovery/review.d.ts.map +1 -0
- package/dist/client/affiliateRecovery/review.js +86 -0
- package/dist/client/affiliateRecovery/review.js.map +1 -0
- package/dist/client/affiliateRecovery/validators.d.ts +402 -0
- package/dist/client/affiliateRecovery/validators.d.ts.map +1 -0
- package/dist/client/affiliateRecovery/validators.js +27 -0
- package/dist/client/affiliateRecovery/validators.js.map +1 -0
- package/dist/client/affiliateRecovery.d.ts +131 -0
- package/dist/client/affiliateRecovery.d.ts.map +1 -0
- package/dist/client/affiliateRecovery.js +69 -0
- package/dist/client/affiliateRecovery.js.map +1 -0
- package/dist/client/connect/commissionReceipts.d.ts +4 -0
- package/dist/client/connect/commissionReceipts.d.ts.map +1 -0
- package/dist/client/connect/commissionReceipts.js +17 -0
- package/dist/client/connect/commissionReceipts.js.map +1 -0
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +536 -2
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutSync.d.ts +32 -0
- package/dist/client/connect/payoutSync.d.ts.map +1 -0
- package/dist/client/connect/payoutSync.js +48 -0
- package/dist/client/connect/payoutSync.js.map +1 -0
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +1509 -0
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -0
- package/dist/client/connect/payoutSyncTestHelpers.js +62 -0
- package/dist/client/connect/payoutSyncTestHelpers.js.map +1 -0
- package/dist/client/connect/payoutSyncValidation.d.ts +16 -0
- package/dist/client/connect/payoutSyncValidation.d.ts.map +1 -0
- package/dist/client/connect/payoutSyncValidation.js +54 -0
- package/dist/client/connect/payoutSyncValidation.js.map +1 -0
- package/dist/client/connect/payouts.d.ts +3 -1
- package/dist/client/connect/payouts.d.ts.map +1 -1
- package/dist/client/connect/payouts.js +45 -12
- package/dist/client/connect/payouts.js.map +1 -1
- package/dist/client/connect/refundPrincipal.d.ts +4 -0
- package/dist/client/connect/refundPrincipal.d.ts.map +1 -0
- package/dist/client/connect/refundPrincipal.js +21 -0
- package/dist/client/connect/refundPrincipal.js.map +1 -0
- package/dist/client/connect/reversalExecution.d.ts +47 -0
- package/dist/client/connect/reversalExecution.d.ts.map +1 -0
- package/dist/client/connect/reversalExecution.js +84 -0
- package/dist/client/connect/reversalExecution.js.map +1 -0
- package/dist/client/connect/transfers.d.ts +8 -4
- package/dist/client/connect/transfers.d.ts.map +1 -1
- package/dist/client/connect/transfers.js +52 -57
- package/dist/client/connect/transfers.js.map +1 -1
- package/dist/client/index.d.ts +29 -9
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +9 -6
- package/dist/client/index.js.map +1 -1
- package/dist/client/readContracts.d.ts +8 -0
- package/dist/client/readContracts.d.ts.map +1 -1
- package/dist/client/readContracts.js +7 -0
- package/dist/client/readContracts.js.map +1 -1
- package/dist/client/settlement/execution.d.ts.map +1 -1
- package/dist/client/settlement/execution.js +30 -3
- package/dist/client/settlement/execution.js.map +1 -1
- package/dist/client/settlement/reconciliation.d.ts.map +1 -1
- package/dist/client/settlement/reconciliation.js +16 -2
- package/dist/client/settlement/reconciliation.js.map +1 -1
- package/dist/client/webhooks/disputeRecovery.d.ts +4 -0
- package/dist/client/webhooks/disputeRecovery.d.ts.map +1 -0
- package/dist/client/webhooks/disputeRecovery.js +40 -0
- package/dist/client/webhooks/disputeRecovery.js.map +1 -0
- package/dist/client/webhooks/processors.d.ts.map +1 -1
- package/dist/client/webhooks/processors.js +14 -29
- package/dist/client/webhooks/processors.js.map +1 -1
- package/dist/component/_generated/component.d.ts +560 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/affiliateEarnings/mutations.d.ts +22 -0
- package/dist/component/affiliateEarnings/mutations.d.ts.map +1 -0
- package/dist/component/affiliateEarnings/mutations.js +160 -0
- package/dist/component/affiliateEarnings/mutations.js.map +1 -0
- package/dist/component/affiliatePayouts/mutations.d.ts +25 -0
- package/dist/component/affiliatePayouts/mutations.d.ts.map +1 -0
- package/dist/component/affiliatePayouts/mutations.js +104 -0
- package/dist/component/affiliatePayouts/mutations.js.map +1 -0
- package/dist/component/affiliatePayouts/queries.d.ts +23 -0
- package/dist/component/affiliatePayouts/queries.d.ts.map +1 -0
- package/dist/component/affiliatePayouts/queries.js +23 -0
- package/dist/component/affiliatePayouts/queries.js.map +1 -0
- package/dist/component/affiliatePayouts/recipientGuard.d.ts +12 -0
- package/dist/component/affiliatePayouts/recipientGuard.d.ts.map +1 -0
- package/dist/component/affiliatePayouts/recipientGuard.js +26 -0
- package/dist/component/affiliatePayouts/recipientGuard.js.map +1 -0
- package/dist/component/affiliateRecovery/accounting.d.ts +28 -0
- package/dist/component/affiliateRecovery/accounting.d.ts.map +1 -0
- package/dist/component/affiliateRecovery/accounting.js +71 -0
- package/dist/component/affiliateRecovery/accounting.js.map +1 -0
- package/dist/component/affiliateRecovery/mutations.d.ts +65 -0
- package/dist/component/affiliateRecovery/mutations.d.ts.map +1 -0
- package/dist/component/affiliateRecovery/mutations.js +250 -0
- package/dist/component/affiliateRecovery/mutations.js.map +1 -0
- package/dist/component/affiliateRecovery/queries.d.ts +305 -0
- package/dist/component/affiliateRecovery/queries.d.ts.map +1 -0
- package/dist/component/affiliateRecovery/queries.js +113 -0
- package/dist/component/affiliateRecovery/queries.js.map +1 -0
- package/dist/component/affiliateRecovery/schema.d.ts +171 -0
- package/dist/component/affiliateRecovery/schema.d.ts.map +1 -0
- package/dist/component/affiliateRecovery/schema.js +71 -0
- package/dist/component/affiliateRecovery/schema.js.map +1 -0
- package/dist/component/connect/mutations.d.ts +36 -23
- package/dist/component/connect/mutations.d.ts.map +1 -1
- package/dist/component/connect/mutations.js +11 -151
- package/dist/component/connect/mutations.js.map +1 -1
- package/dist/component/connect/payoutWrites.d.ts +21 -0
- package/dist/component/connect/payoutWrites.d.ts.map +1 -0
- package/dist/component/connect/payoutWrites.js +19 -0
- package/dist/component/connect/payoutWrites.js.map +1 -0
- package/dist/component/connect/queries.d.ts +10 -0
- package/dist/component/connect/queries.d.ts.map +1 -1
- package/dist/component/connect/queries.js +3 -40
- package/dist/component/connect/queries.js.map +1 -1
- package/dist/component/connect/reversalClaims.d.ts +169 -0
- package/dist/component/connect/reversalClaims.d.ts.map +1 -0
- package/dist/component/connect/reversalClaims.js +176 -0
- package/dist/component/connect/reversalClaims.js.map +1 -0
- package/dist/component/connect/reversalDiagnostics.d.ts +59 -0
- package/dist/component/connect/reversalDiagnostics.d.ts.map +1 -0
- package/dist/component/connect/reversalDiagnostics.js +50 -0
- package/dist/component/connect/reversalDiagnostics.js.map +1 -0
- package/dist/component/connect/reversalReceipts.d.ts +27 -0
- package/dist/component/connect/reversalReceipts.d.ts.map +1 -0
- package/dist/component/connect/reversalReceipts.js +85 -0
- package/dist/component/connect/reversalReceipts.js.map +1 -0
- package/dist/component/connect/schema.d.ts +31 -1
- package/dist/component/connect/schema.d.ts.map +1 -1
- package/dist/component/connect/schema.js +3 -1
- package/dist/component/connect/schema.js.map +1 -1
- package/dist/component/connect/validators.d.ts +49 -1
- package/dist/component/connect/validators.d.ts.map +1 -1
- package/dist/component/connect/validators.js +2 -0
- package/dist/component/connect/validators.js.map +1 -1
- package/dist/component/earnings/triggers.d.ts +454 -2
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/payoutRelease/mutations.d.ts.map +1 -1
- package/dist/component/payoutRelease/mutations.js +6 -0
- package/dist/component/payoutRelease/mutations.js.map +1 -1
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/payoutRelease/queries.js +3 -1
- package/dist/component/payoutRelease/queries.js.map +1 -1
- package/dist/component/payoutSync/helpers.d.ts +44 -0
- package/dist/component/payoutSync/helpers.d.ts.map +1 -0
- package/dist/component/payoutSync/helpers.js +60 -0
- package/dist/component/payoutSync/helpers.js.map +1 -0
- package/dist/component/payoutSync/mutations.d.ts +51 -0
- package/dist/component/payoutSync/mutations.d.ts.map +1 -0
- package/dist/component/payoutSync/mutations.js +88 -0
- package/dist/component/payoutSync/mutations.js.map +1 -0
- package/dist/component/payoutSync/queries.d.ts +16 -0
- package/dist/component/payoutSync/queries.d.ts.map +1 -0
- package/dist/component/payoutSync/queries.js +11 -0
- package/dist/component/payoutSync/queries.js.map +1 -0
- package/dist/component/payoutSync/schema.d.ts +46 -0
- package/dist/component/payoutSync/schema.d.ts.map +1 -0
- package/dist/component/payoutSync/schema.js +22 -0
- package/dist/component/payoutSync/schema.js.map +1 -0
- package/dist/component/payoutSync/validators.d.ts +137 -0
- package/dist/component/payoutSync/validators.d.ts.map +1 -0
- package/dist/component/payoutSync/validators.js +19 -0
- package/dist/component/payoutSync/validators.js.map +1 -0
- package/dist/component/schema.d.ts +268 -1
- package/dist/component/schema.js +11 -0
- package/dist/component/schema.js.map +1 -1
- package/dist/component/settlement/clawbackSchema.d.ts +161 -0
- package/dist/component/settlement/clawbackSchema.d.ts.map +1 -0
- package/dist/component/settlement/clawbackSchema.js +73 -0
- package/dist/component/settlement/clawbackSchema.js.map +1 -0
- package/dist/component/settlement/clawbacks.d.ts +55 -0
- package/dist/component/settlement/clawbacks.d.ts.map +1 -0
- package/dist/component/settlement/clawbacks.js +146 -0
- package/dist/component/settlement/clawbacks.js.map +1 -0
- package/dist/component/settlement/mutations.d.ts +16 -0
- package/dist/component/settlement/mutations.d.ts.map +1 -1
- package/dist/component/settlement/mutations.js +48 -0
- package/dist/component/settlement/mutations.js.map +1 -1
- package/dist/component/settlement/queries.d.ts +53 -0
- package/dist/component/settlement/queries.d.ts.map +1 -1
- package/dist/component/settlement/queries.js +26 -0
- package/dist/component/settlement/queries.js.map +1 -1
- package/dist/react/workflows/AffiliateRecovery.d.ts +46 -0
- package/dist/react/workflows/AffiliateRecovery.d.ts.map +1 -0
- package/dist/react/workflows/AffiliateRecovery.js +84 -0
- package/dist/react/workflows/AffiliateRecovery.js.map +1 -0
- package/dist/react/workflows/index.d.ts +2 -0
- package/dist/react/workflows/index.d.ts.map +1 -1
- package/dist/react/workflows/index.js +1 -0
- package/dist/react/workflows/index.js.map +1 -1
- package/dist/testing/affiliate-recovery.d.ts +10 -0
- package/dist/testing/affiliate-recovery.d.ts.map +1 -0
- package/dist/testing/affiliate-recovery.js +126 -0
- package/dist/testing/affiliate-recovery.js.map +1 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +1 -0
- package/dist/testing/index.js.map +1 -1
- package/docs/affiliate-clawbacks.md +306 -0
- package/docs/read-contracts.md +40 -5
- package/docs/settlement.md +17 -0
- package/package.json +2 -1
- package/src/client/affiliateRecovery/disputes.ts +62 -0
- package/src/client/affiliateRecovery/engine.ts +196 -0
- package/src/client/affiliateRecovery/payoutGate.ts +65 -0
- package/src/client/affiliateRecovery/provider.ts +127 -0
- package/src/client/affiliateRecovery/review.ts +117 -0
- package/src/client/affiliateRecovery/validators.ts +38 -0
- package/src/client/affiliateRecovery.ts +173 -0
- package/src/client/connect/commissionReceipts.test.ts +157 -0
- package/src/client/connect/commissionReceipts.ts +23 -0
- package/src/client/connect/payoutSync.test.ts +313 -0
- package/src/client/connect/payoutSync.ts +93 -0
- package/src/client/connect/payoutSyncTestHelpers.ts +82 -0
- package/src/client/connect/payoutSyncValidation.ts +74 -0
- package/src/client/connect/payouts.ts +75 -15
- package/src/client/connect/refundPrincipal.test.ts +46 -0
- package/src/client/connect/refundPrincipal.ts +26 -0
- package/src/client/connect/reversalExecution.ts +130 -0
- package/src/client/connect/transfers.test.ts +3 -3
- package/src/client/connect/transfers.ts +93 -92
- package/src/client/index.ts +20 -18
- package/src/client/readContracts.ts +12 -0
- package/src/client/settlement/execution.test.ts +5 -0
- package/src/client/settlement/execution.ts +50 -3
- package/src/client/settlement/reconciliation.ts +20 -2
- package/src/client/webhooks/disputeRecovery.ts +74 -0
- package/src/client/webhooks/processors.test.ts +36 -53
- package/src/client/webhooks/processors.ts +18 -31
- package/src/component/_generated/api.ts +34 -0
- package/src/component/_generated/component.ts +696 -1
- package/src/component/affiliate-clawbacks.test.ts +370 -0
- package/src/component/affiliate-component-pagination.test.ts +83 -0
- package/src/component/affiliate-direct-payout.test.ts +160 -0
- package/src/component/affiliate-recovery-lifecycle.test.ts +587 -0
- package/src/component/affiliateEarnings/mutations.ts +196 -0
- package/src/component/affiliatePayouts/mutations.ts +121 -0
- package/src/component/affiliatePayouts/queries.ts +28 -0
- package/src/component/affiliatePayouts/recipientGuard.ts +42 -0
- package/src/component/affiliateRecovery/accounting.ts +111 -0
- package/src/component/affiliateRecovery/mutations.ts +275 -0
- package/src/component/affiliateRecovery/queries.ts +138 -0
- package/src/component/affiliateRecovery/schema.ts +86 -0
- package/src/component/connect/mutations.ts +13 -190
- package/src/component/connect/payoutWrites.ts +25 -0
- package/src/component/connect/queries.ts +4 -47
- package/src/component/connect/reversalClaims.ts +232 -0
- package/src/component/connect/reversalDiagnostics.ts +61 -0
- package/src/component/connect/reversalReceipts.ts +147 -0
- package/src/component/connect/schema.ts +3 -3
- package/src/component/connect/validators.ts +2 -0
- package/src/component/payout-recovery-integration.test.ts +172 -0
- package/src/component/payout-sync.test.ts +117 -0
- package/src/component/payoutRelease/mutations.ts +9 -0
- package/src/component/payoutRelease/queries.ts +3 -1
- package/src/component/payoutSync/helpers.ts +86 -0
- package/src/component/payoutSync/mutations.ts +102 -0
- package/src/component/payoutSync/queries.ts +10 -0
- package/src/component/payoutSync/schema.ts +25 -0
- package/src/component/payoutSync/validators.ts +21 -0
- package/src/component/schema.ts +20 -0
- package/src/component/settlement/clawbackSchema.ts +78 -0
- package/src/component/settlement/clawbacks.ts +233 -0
- package/src/component/settlement/mutations.ts +54 -0
- package/src/component/settlement/queries.ts +35 -0
- package/src/component/summary-arithmetic.test.ts +9 -4
- package/src/react/workflows/AffiliateRecovery.test.tsx +106 -0
- package/src/react/workflows/AffiliateRecovery.tsx +273 -0
- package/src/react/workflows/index.ts +9 -0
- package/src/testing/affiliate-recovery.ts +137 -0
- package/src/testing/index.ts +2 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { successfulRefundPrincipal } from "../connect/refundPrincipal.js";
|
|
2
|
+
/** Operator-selected provenance is verified against exact provider receipts. */
|
|
3
|
+
export async function verifiedLegacyReview(stripe, row, opts) {
|
|
4
|
+
if (!opts.note.trim() ||
|
|
5
|
+
opts.reversalIds.length > 100 ||
|
|
6
|
+
new Set(opts.reversalIds).size !== opts.reversalIds.length ||
|
|
7
|
+
(opts.restorationTransferIds?.length ?? 0) > 100)
|
|
8
|
+
throw new Error("Provide a review note and at most 100 unique receipts.");
|
|
9
|
+
if (!row.stripeTransferId)
|
|
10
|
+
throw new Error("Legacy review requires an original Connect transfer.");
|
|
11
|
+
const original = await stripe.transfers.retrieve(row.stripeTransferId);
|
|
12
|
+
const destination = typeof original.destination === "string"
|
|
13
|
+
? original.destination
|
|
14
|
+
: original.destination?.id;
|
|
15
|
+
if (destination !== row.affiliateAccountId ||
|
|
16
|
+
original.currency !== row.currency ||
|
|
17
|
+
original.source_transaction !== row.sourceChargeId)
|
|
18
|
+
throw new Error("Legacy transfer identity mismatch.");
|
|
19
|
+
const receipts = [];
|
|
20
|
+
for (const id of opts.reversalIds) {
|
|
21
|
+
const receipt = await stripe.transfers.retrieveReversal(row.stripeTransferId, id);
|
|
22
|
+
if (receipt.transfer !== row.stripeTransferId ||
|
|
23
|
+
receipt.currency !== row.currency ||
|
|
24
|
+
receipt.id !== id)
|
|
25
|
+
throw new Error("Legacy reversal receipt identity mismatch.");
|
|
26
|
+
receipts.push({ id, amount: receipt.amount });
|
|
27
|
+
}
|
|
28
|
+
const recoveredAmount = receipts.reduce((sum, r) => sum + r.amount, 0);
|
|
29
|
+
if (recoveredAmount > original.amount_reversed)
|
|
30
|
+
throw new Error("Legacy receipts exceed confirmed provider reversals.");
|
|
31
|
+
let restoredAmount = 0;
|
|
32
|
+
const restorationIds = opts.restorationTransferIds ?? [];
|
|
33
|
+
if (new Set(restorationIds).size !== restorationIds.length)
|
|
34
|
+
throw new Error("Restoration receipts must be unique.");
|
|
35
|
+
for (const id of restorationIds) {
|
|
36
|
+
const transfer = await stripe.transfers.retrieve(id);
|
|
37
|
+
const recipient = typeof transfer.destination === "string"
|
|
38
|
+
? transfer.destination
|
|
39
|
+
: transfer.destination?.id;
|
|
40
|
+
if (recipient !== row.affiliateAccountId ||
|
|
41
|
+
transfer.currency !== row.currency ||
|
|
42
|
+
transfer.metadata.bsReinstateOf !== row.sourceChargeId)
|
|
43
|
+
throw new Error("Legacy restoration receipt identity mismatch.");
|
|
44
|
+
restoredAmount += transfer.amount;
|
|
45
|
+
}
|
|
46
|
+
const charge = await stripe.charges.retrieve(row.sourceChargeId);
|
|
47
|
+
const refundedPrincipal = await successfulRefundPrincipal(stripe, row.sourceChargeId);
|
|
48
|
+
const disputes = [];
|
|
49
|
+
for await (const dispute of stripe.disputes.list({
|
|
50
|
+
charge: row.sourceChargeId,
|
|
51
|
+
limit: 100,
|
|
52
|
+
})) {
|
|
53
|
+
if (disputes.length >= 10)
|
|
54
|
+
throw new Error("Legacy dispute history requires manual source allocation.");
|
|
55
|
+
if (!dispute.status.startsWith("warning_") &&
|
|
56
|
+
dispute.status !== "prevented")
|
|
57
|
+
disputes.push(dispute);
|
|
58
|
+
}
|
|
59
|
+
if (disputes.length > 1)
|
|
60
|
+
throw new Error("Multiple monetary disputes require manual source allocation.");
|
|
61
|
+
const dispute = disputes[0];
|
|
62
|
+
return {
|
|
63
|
+
obligationId: row._id,
|
|
64
|
+
recoveredAmount,
|
|
65
|
+
restoredAmount,
|
|
66
|
+
receipts,
|
|
67
|
+
restorationIds,
|
|
68
|
+
note: opts.note,
|
|
69
|
+
exposure: {
|
|
70
|
+
kind: dispute ? "dispute" : "refund",
|
|
71
|
+
chargeAmount: charge.amount,
|
|
72
|
+
principal: dispute?.amount ?? refundedPrincipal,
|
|
73
|
+
finalized: dispute ? dispute.status === "lost" : true,
|
|
74
|
+
refundedPrincipal,
|
|
75
|
+
disputeId: dispute?.id,
|
|
76
|
+
disputeState: dispute
|
|
77
|
+
? dispute.status === "won"
|
|
78
|
+
? "won"
|
|
79
|
+
: dispute.status === "lost"
|
|
80
|
+
? "lost"
|
|
81
|
+
: "open"
|
|
82
|
+
: undefined,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=review.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review.js","sourceRoot":"","sources":["../../../src/client/affiliateRecovery/review.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,GAAuB,EACvB,IAIC;IAED,IACE,CAAC,IAAI,C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K,KAAK;oBACxB,CAAC,CAAE,KAAe;oBAClB,CAAC,CAAC,OAAO,CAAC,MAAM,KAAK,MAAM;wBACzB,CAAC,CAAE,MAAgB;wBACnB,CAAC,CAAE,MAAgB;gBACvB,CAAC,CAAC,SAAS;SACd;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
export declare const affiliateObligationValidator: import("convex/values").VObject<{
|
|
2
|
+
_creationTime: number;
|
|
3
|
+
_id: string;
|
|
4
|
+
accounted?: boolean | undefined;
|
|
5
|
+
activeOperationId?: string | undefined;
|
|
6
|
+
affiliateAccountId: string;
|
|
7
|
+
chargeAmount: number;
|
|
8
|
+
creditAmount?: number | undefined;
|
|
9
|
+
currency: string;
|
|
10
|
+
debtAmount?: number | undefined;
|
|
11
|
+
debtStatus?: "open" | "settled" | undefined;
|
|
12
|
+
disputeId?: string | undefined;
|
|
13
|
+
disputeState?: "lost" | "open" | "won" | undefined;
|
|
14
|
+
disputedPrincipal: number;
|
|
15
|
+
earningId?: string | undefined;
|
|
16
|
+
finalizedAmount: number;
|
|
17
|
+
lastError?: string | undefined;
|
|
18
|
+
lastRefundId?: string | undefined;
|
|
19
|
+
lastState?: string | undefined;
|
|
20
|
+
legacyReceiptIds?: string[] | undefined;
|
|
21
|
+
legacyRestorationIds?: string[] | undefined;
|
|
22
|
+
lostPrincipal: number;
|
|
23
|
+
needsReconciliation: boolean;
|
|
24
|
+
offsetAmount?: number | undefined;
|
|
25
|
+
operationSequence?: number | undefined;
|
|
26
|
+
operatorNote?: string | undefined;
|
|
27
|
+
originalCommission: number;
|
|
28
|
+
paymentId?: string | undefined;
|
|
29
|
+
paymentIntentId?: string | undefined;
|
|
30
|
+
provisionalAmount: number;
|
|
31
|
+
recoveredAmount: number;
|
|
32
|
+
refundedPrincipal: number;
|
|
33
|
+
releasedCommission?: number | undefined;
|
|
34
|
+
reservedRecovery?: number | undefined;
|
|
35
|
+
reservedRestoration?: number | undefined;
|
|
36
|
+
restoredAmount?: number | undefined;
|
|
37
|
+
sourceChargeId: string;
|
|
38
|
+
sourceInvoiceId?: string | undefined;
|
|
39
|
+
storeAccountId?: string | undefined;
|
|
40
|
+
stripeTransferId?: string | undefined;
|
|
41
|
+
}, {
|
|
42
|
+
stripeTransferId: import("convex/values").VString<string | undefined, "optional">;
|
|
43
|
+
sourceChargeId: import("convex/values").VString<string, "required">;
|
|
44
|
+
sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
|
|
45
|
+
paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
|
|
46
|
+
paymentId: import("convex/values").VString<string | undefined, "optional">;
|
|
47
|
+
storeAccountId: import("convex/values").VString<string | undefined, "optional">;
|
|
48
|
+
lastRefundId: import("convex/values").VString<string | undefined, "optional">;
|
|
49
|
+
affiliateAccountId: import("convex/values").VString<string, "required">;
|
|
50
|
+
currency: import("convex/values").VString<string, "required">;
|
|
51
|
+
chargeAmount: import("convex/values").VFloat64<number, "required">;
|
|
52
|
+
originalCommission: import("convex/values").VFloat64<number, "required">;
|
|
53
|
+
refundedPrincipal: import("convex/values").VFloat64<number, "required">;
|
|
54
|
+
disputedPrincipal: import("convex/values").VFloat64<number, "required">;
|
|
55
|
+
lostPrincipal: import("convex/values").VFloat64<number, "required">;
|
|
56
|
+
finalizedAmount: import("convex/values").VFloat64<number, "required">;
|
|
57
|
+
provisionalAmount: import("convex/values").VFloat64<number, "required">;
|
|
58
|
+
recoveredAmount: import("convex/values").VFloat64<number, "required">;
|
|
59
|
+
needsReconciliation: import("convex/values").VBoolean<boolean, "required">;
|
|
60
|
+
accounted: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
61
|
+
legacyReceiptIds: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
|
|
62
|
+
legacyRestorationIds: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
|
|
63
|
+
operatorNote: import("convex/values").VString<string | undefined, "optional">;
|
|
64
|
+
releasedCommission: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
65
|
+
offsetAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
66
|
+
restoredAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
67
|
+
reservedRecovery: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
68
|
+
reservedRestoration: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
69
|
+
debtAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
70
|
+
creditAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
71
|
+
debtStatus: import("convex/values").VUnion<"open" | "settled" | undefined, [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"settled", "required">], "optional", never>;
|
|
72
|
+
disputeState: import("convex/values").VUnion<"lost" | "open" | "won" | undefined, [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"lost", "required">, import("convex/values").VLiteral<"won", "required">], "optional", never>;
|
|
73
|
+
disputeId: import("convex/values").VString<string | undefined, "optional">;
|
|
74
|
+
lastState: import("convex/values").VString<string | undefined, "optional">;
|
|
75
|
+
lastError: import("convex/values").VString<string | undefined, "optional">;
|
|
76
|
+
operationSequence: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
77
|
+
_id: import("convex/values").VString<string, "required">;
|
|
78
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
79
|
+
earningId: import("convex/values").VString<string | undefined, "optional">;
|
|
80
|
+
activeOperationId: import("convex/values").VString<string | undefined, "optional">;
|
|
81
|
+
}, "required", "_creationTime" | "_id" | "accounted" | "activeOperationId" | "affiliateAccountId" | "chargeAmount" | "creditAmount" | "currency" | "debtAmount" | "debtStatus" | "disputeId" | "disputeState" | "disputedPrincipal" | "earningId" | "finalizedAmount" | "lastError" | "lastRefundId" | "lastState" | "legacyReceiptIds" | "legacyRestorationIds" | "lostPrincipal" | "needsReconciliation" | "offsetAmount" | "operationSequence" | "operatorNote" | "originalCommission" | "paymentId" | "paymentIntentId" | "provisionalAmount" | "recoveredAmount" | "refundedPrincipal" | "releasedCommission" | "reservedRecovery" | "reservedRestoration" | "restoredAmount" | "sourceChargeId" | "sourceInvoiceId" | "storeAccountId" | "stripeTransferId">;
|
|
82
|
+
export declare const affiliateOperationValidator: import("convex/values").VObject<{
|
|
83
|
+
_creationTime: number;
|
|
84
|
+
_id: string;
|
|
85
|
+
amount: number;
|
|
86
|
+
attempted: boolean;
|
|
87
|
+
createdAt: number;
|
|
88
|
+
error?: string | undefined;
|
|
89
|
+
kind: "recovery" | "restoration";
|
|
90
|
+
obligationId: string;
|
|
91
|
+
providerBaseline?: number | undefined;
|
|
92
|
+
receiptId?: string | undefined;
|
|
93
|
+
sourceEventId?: string | undefined;
|
|
94
|
+
state: "canceled" | "failed" | "insufficient_balance" | "pending" | "succeeded" | "unknown" | "unsupported";
|
|
95
|
+
}, {
|
|
96
|
+
sourceEventId: import("convex/values").VString<string | undefined, "optional">;
|
|
97
|
+
kind: import("convex/values").VUnion<"recovery" | "restoration", [import("convex/values").VLiteral<"recovery", "required">, import("convex/values").VLiteral<"restoration", "required">], "required", never>;
|
|
98
|
+
amount: import("convex/values").VFloat64<number, "required">;
|
|
99
|
+
state: import("convex/values").VUnion<"canceled" | "failed" | "insufficient_balance" | "pending" | "succeeded" | "unknown" | "unsupported", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"unknown", "required">, import("convex/values").VLiteral<"insufficient_balance", "required">, import("convex/values").VLiteral<"unsupported", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"succeeded", "required">, import("convex/values").VLiteral<"canceled", "required">], "required", never>;
|
|
100
|
+
receiptId: import("convex/values").VString<string | undefined, "optional">;
|
|
101
|
+
error: import("convex/values").VString<string | undefined, "optional">;
|
|
102
|
+
attempted: import("convex/values").VBoolean<boolean, "required">;
|
|
103
|
+
providerBaseline: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
104
|
+
createdAt: import("convex/values").VFloat64<number, "required">;
|
|
105
|
+
_id: import("convex/values").VString<string, "required">;
|
|
106
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
107
|
+
obligationId: import("convex/values").VString<string, "required">;
|
|
108
|
+
}, "required", "_creationTime" | "_id" | "amount" | "attempted" | "createdAt" | "error" | "kind" | "obligationId" | "providerBaseline" | "receiptId" | "sourceEventId" | "state">;
|
|
109
|
+
export declare const affiliateSnapshotValidator: import("convex/values").VObject<{
|
|
110
|
+
balance: {
|
|
111
|
+
_creationTime: number;
|
|
112
|
+
_id: string;
|
|
113
|
+
activePayoutKey?: string | undefined;
|
|
114
|
+
affiliateAccountId: string;
|
|
115
|
+
currency: string;
|
|
116
|
+
netPayable: number;
|
|
117
|
+
offsetAmount: number;
|
|
118
|
+
originalCommission: number;
|
|
119
|
+
outstandingDebt: number;
|
|
120
|
+
pendingPayoutAmount?: number | undefined;
|
|
121
|
+
recoveredAmount: number;
|
|
122
|
+
reservedRecovery: number;
|
|
123
|
+
reservedRestoration: number;
|
|
124
|
+
restorationDue: number;
|
|
125
|
+
restoredAmount: number;
|
|
126
|
+
withheldAmount: number;
|
|
127
|
+
} | null;
|
|
128
|
+
obligations: {
|
|
129
|
+
continueCursor: string;
|
|
130
|
+
isDone: boolean;
|
|
131
|
+
page: {
|
|
132
|
+
_creationTime: number;
|
|
133
|
+
_id: string;
|
|
134
|
+
accounted?: boolean | undefined;
|
|
135
|
+
activeOperationId?: string | undefined;
|
|
136
|
+
affiliateAccountId: string;
|
|
137
|
+
chargeAmount: number;
|
|
138
|
+
creditAmount?: number | undefined;
|
|
139
|
+
currency: string;
|
|
140
|
+
debtAmount?: number | undefined;
|
|
141
|
+
debtStatus?: "open" | "settled" | undefined;
|
|
142
|
+
disputeId?: string | undefined;
|
|
143
|
+
disputeState?: "lost" | "open" | "won" | undefined;
|
|
144
|
+
disputedPrincipal: number;
|
|
145
|
+
earningId?: string | undefined;
|
|
146
|
+
finalizedAmount: number;
|
|
147
|
+
lastError?: string | undefined;
|
|
148
|
+
lastRefundId?: string | undefined;
|
|
149
|
+
lastState?: string | undefined;
|
|
150
|
+
legacyReceiptIds?: string[] | undefined;
|
|
151
|
+
legacyRestorationIds?: string[] | undefined;
|
|
152
|
+
lostPrincipal: number;
|
|
153
|
+
needsReconciliation: boolean;
|
|
154
|
+
offsetAmount?: number | undefined;
|
|
155
|
+
operationSequence?: number | undefined;
|
|
156
|
+
operatorNote?: string | undefined;
|
|
157
|
+
originalCommission: number;
|
|
158
|
+
paymentId?: string | undefined;
|
|
159
|
+
paymentIntentId?: string | undefined;
|
|
160
|
+
provisionalAmount: number;
|
|
161
|
+
recoveredAmount: number;
|
|
162
|
+
refundedPrincipal: number;
|
|
163
|
+
releasedCommission?: number | undefined;
|
|
164
|
+
reservedRecovery?: number | undefined;
|
|
165
|
+
reservedRestoration?: number | undefined;
|
|
166
|
+
restoredAmount?: number | undefined;
|
|
167
|
+
sourceChargeId: string;
|
|
168
|
+
sourceInvoiceId?: string | undefined;
|
|
169
|
+
storeAccountId?: string | undefined;
|
|
170
|
+
stripeTransferId?: string | undefined;
|
|
171
|
+
}[];
|
|
172
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null | undefined;
|
|
173
|
+
splitCursor?: string | null | undefined;
|
|
174
|
+
};
|
|
175
|
+
}, {
|
|
176
|
+
balance: import("convex/values").VUnion<{
|
|
177
|
+
_creationTime: number;
|
|
178
|
+
_id: string;
|
|
179
|
+
activePayoutKey?: string | undefined;
|
|
180
|
+
affiliateAccountId: string;
|
|
181
|
+
currency: string;
|
|
182
|
+
netPayable: number;
|
|
183
|
+
offsetAmount: number;
|
|
184
|
+
originalCommission: number;
|
|
185
|
+
outstandingDebt: number;
|
|
186
|
+
pendingPayoutAmount?: number | undefined;
|
|
187
|
+
recoveredAmount: number;
|
|
188
|
+
reservedRecovery: number;
|
|
189
|
+
reservedRestoration: number;
|
|
190
|
+
restorationDue: number;
|
|
191
|
+
restoredAmount: number;
|
|
192
|
+
withheldAmount: number;
|
|
193
|
+
} | null, [import("convex/values").VObject<{
|
|
194
|
+
_creationTime: number;
|
|
195
|
+
_id: string;
|
|
196
|
+
activePayoutKey?: string | undefined;
|
|
197
|
+
affiliateAccountId: string;
|
|
198
|
+
currency: string;
|
|
199
|
+
netPayable: number;
|
|
200
|
+
offsetAmount: number;
|
|
201
|
+
originalCommission: number;
|
|
202
|
+
outstandingDebt: number;
|
|
203
|
+
pendingPayoutAmount?: number | undefined;
|
|
204
|
+
recoveredAmount: number;
|
|
205
|
+
reservedRecovery: number;
|
|
206
|
+
reservedRestoration: number;
|
|
207
|
+
restorationDue: number;
|
|
208
|
+
restoredAmount: number;
|
|
209
|
+
withheldAmount: number;
|
|
210
|
+
}, {
|
|
211
|
+
activePayoutKey: import("convex/values").VString<string | undefined, "optional">;
|
|
212
|
+
pendingPayoutAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
213
|
+
affiliateAccountId: import("convex/values").VString<string, "required">;
|
|
214
|
+
currency: import("convex/values").VString<string, "required">;
|
|
215
|
+
originalCommission: import("convex/values").VFloat64<number, "required">;
|
|
216
|
+
recoveredAmount: import("convex/values").VFloat64<number, "required">;
|
|
217
|
+
offsetAmount: import("convex/values").VFloat64<number, "required">;
|
|
218
|
+
restoredAmount: import("convex/values").VFloat64<number, "required">;
|
|
219
|
+
outstandingDebt: import("convex/values").VFloat64<number, "required">;
|
|
220
|
+
reservedRecovery: import("convex/values").VFloat64<number, "required">;
|
|
221
|
+
reservedRestoration: import("convex/values").VFloat64<number, "required">;
|
|
222
|
+
restorationDue: import("convex/values").VFloat64<number, "required">;
|
|
223
|
+
withheldAmount: import("convex/values").VFloat64<number, "required">;
|
|
224
|
+
netPayable: import("convex/values").VFloat64<number, "required">;
|
|
225
|
+
_id: import("convex/values").VString<string, "required">;
|
|
226
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
227
|
+
}, "required", "_creationTime" | "_id" | "activePayoutKey" | "affiliateAccountId" | "currency" | "netPayable" | "offsetAmount" | "originalCommission" | "outstandingDebt" | "pendingPayoutAmount" | "recoveredAmount" | "reservedRecovery" | "reservedRestoration" | "restorationDue" | "restoredAmount" | "withheldAmount">, import("convex/values").VNull<null, "required">], "required", "_creationTime" | "_id" | "activePayoutKey" | "affiliateAccountId" | "currency" | "netPayable" | "offsetAmount" | "originalCommission" | "outstandingDebt" | "pendingPayoutAmount" | "recoveredAmount" | "reservedRecovery" | "reservedRestoration" | "restorationDue" | "restoredAmount" | "withheldAmount">;
|
|
228
|
+
obligations: import("convex/values").VObject<{
|
|
229
|
+
continueCursor: string;
|
|
230
|
+
isDone: boolean;
|
|
231
|
+
page: {
|
|
232
|
+
_creationTime: number;
|
|
233
|
+
_id: string;
|
|
234
|
+
accounted?: boolean | undefined;
|
|
235
|
+
activeOperationId?: string | undefined;
|
|
236
|
+
affiliateAccountId: string;
|
|
237
|
+
chargeAmount: number;
|
|
238
|
+
creditAmount?: number | undefined;
|
|
239
|
+
currency: string;
|
|
240
|
+
debtAmount?: number | undefined;
|
|
241
|
+
debtStatus?: "open" | "settled" | undefined;
|
|
242
|
+
disputeId?: string | undefined;
|
|
243
|
+
disputeState?: "lost" | "open" | "won" | undefined;
|
|
244
|
+
disputedPrincipal: number;
|
|
245
|
+
earningId?: string | undefined;
|
|
246
|
+
finalizedAmount: number;
|
|
247
|
+
lastError?: string | undefined;
|
|
248
|
+
lastRefundId?: string | undefined;
|
|
249
|
+
lastState?: string | undefined;
|
|
250
|
+
legacyReceiptIds?: string[] | undefined;
|
|
251
|
+
legacyRestorationIds?: string[] | undefined;
|
|
252
|
+
lostPrincipal: number;
|
|
253
|
+
needsReconciliation: boolean;
|
|
254
|
+
offsetAmount?: number | undefined;
|
|
255
|
+
operationSequence?: number | undefined;
|
|
256
|
+
operatorNote?: string | undefined;
|
|
257
|
+
originalCommission: number;
|
|
258
|
+
paymentId?: string | undefined;
|
|
259
|
+
paymentIntentId?: string | undefined;
|
|
260
|
+
provisionalAmount: number;
|
|
261
|
+
recoveredAmount: number;
|
|
262
|
+
refundedPrincipal: number;
|
|
263
|
+
releasedCommission?: number | undefined;
|
|
264
|
+
reservedRecovery?: number | undefined;
|
|
265
|
+
reservedRestoration?: number | undefined;
|
|
266
|
+
restoredAmount?: number | undefined;
|
|
267
|
+
sourceChargeId: string;
|
|
268
|
+
sourceInvoiceId?: string | undefined;
|
|
269
|
+
storeAccountId?: string | undefined;
|
|
270
|
+
stripeTransferId?: string | undefined;
|
|
271
|
+
}[];
|
|
272
|
+
pageStatus?: "SplitRecommended" | "SplitRequired" | null | undefined;
|
|
273
|
+
splitCursor?: string | null | undefined;
|
|
274
|
+
}, {
|
|
275
|
+
page: import("convex/values").VArray<{
|
|
276
|
+
_creationTime: number;
|
|
277
|
+
_id: string;
|
|
278
|
+
accounted?: boolean | undefined;
|
|
279
|
+
activeOperationId?: string | undefined;
|
|
280
|
+
affiliateAccountId: string;
|
|
281
|
+
chargeAmount: number;
|
|
282
|
+
creditAmount?: number | undefined;
|
|
283
|
+
currency: string;
|
|
284
|
+
debtAmount?: number | undefined;
|
|
285
|
+
debtStatus?: "open" | "settled" | undefined;
|
|
286
|
+
disputeId?: string | undefined;
|
|
287
|
+
disputeState?: "lost" | "open" | "won" | undefined;
|
|
288
|
+
disputedPrincipal: number;
|
|
289
|
+
earningId?: string | undefined;
|
|
290
|
+
finalizedAmount: number;
|
|
291
|
+
lastError?: string | undefined;
|
|
292
|
+
lastRefundId?: string | undefined;
|
|
293
|
+
lastState?: string | undefined;
|
|
294
|
+
legacyReceiptIds?: string[] | undefined;
|
|
295
|
+
legacyRestorationIds?: string[] | undefined;
|
|
296
|
+
lostPrincipal: number;
|
|
297
|
+
needsReconciliation: boolean;
|
|
298
|
+
offsetAmount?: number | undefined;
|
|
299
|
+
operationSequence?: number | undefined;
|
|
300
|
+
operatorNote?: string | undefined;
|
|
301
|
+
originalCommission: number;
|
|
302
|
+
paymentId?: string | undefined;
|
|
303
|
+
paymentIntentId?: string | undefined;
|
|
304
|
+
provisionalAmount: number;
|
|
305
|
+
recoveredAmount: number;
|
|
306
|
+
refundedPrincipal: number;
|
|
307
|
+
releasedCommission?: number | undefined;
|
|
308
|
+
reservedRecovery?: number | undefined;
|
|
309
|
+
reservedRestoration?: number | undefined;
|
|
310
|
+
restoredAmount?: number | undefined;
|
|
311
|
+
sourceChargeId: string;
|
|
312
|
+
sourceInvoiceId?: string | undefined;
|
|
313
|
+
storeAccountId?: string | undefined;
|
|
314
|
+
stripeTransferId?: string | undefined;
|
|
315
|
+
}[], import("convex/values").VObject<{
|
|
316
|
+
_creationTime: number;
|
|
317
|
+
_id: string;
|
|
318
|
+
accounted?: boolean | undefined;
|
|
319
|
+
activeOperationId?: string | undefined;
|
|
320
|
+
affiliateAccountId: string;
|
|
321
|
+
chargeAmount: number;
|
|
322
|
+
creditAmount?: number | undefined;
|
|
323
|
+
currency: string;
|
|
324
|
+
debtAmount?: number | undefined;
|
|
325
|
+
debtStatus?: "open" | "settled" | undefined;
|
|
326
|
+
disputeId?: string | undefined;
|
|
327
|
+
disputeState?: "lost" | "open" | "won" | undefined;
|
|
328
|
+
disputedPrincipal: number;
|
|
329
|
+
earningId?: string | undefined;
|
|
330
|
+
finalizedAmount: number;
|
|
331
|
+
lastError?: string | undefined;
|
|
332
|
+
lastRefundId?: string | undefined;
|
|
333
|
+
lastState?: string | undefined;
|
|
334
|
+
legacyReceiptIds?: string[] | undefined;
|
|
335
|
+
legacyRestorationIds?: string[] | undefined;
|
|
336
|
+
lostPrincipal: number;
|
|
337
|
+
needsReconciliation: boolean;
|
|
338
|
+
offsetAmount?: number | undefined;
|
|
339
|
+
operationSequence?: number | undefined;
|
|
340
|
+
operatorNote?: string | undefined;
|
|
341
|
+
originalCommission: number;
|
|
342
|
+
paymentId?: string | undefined;
|
|
343
|
+
paymentIntentId?: string | undefined;
|
|
344
|
+
provisionalAmount: number;
|
|
345
|
+
recoveredAmount: number;
|
|
346
|
+
refundedPrincipal: number;
|
|
347
|
+
releasedCommission?: number | undefined;
|
|
348
|
+
reservedRecovery?: number | undefined;
|
|
349
|
+
reservedRestoration?: number | undefined;
|
|
350
|
+
restoredAmount?: number | undefined;
|
|
351
|
+
sourceChargeId: string;
|
|
352
|
+
sourceInvoiceId?: string | undefined;
|
|
353
|
+
storeAccountId?: string | undefined;
|
|
354
|
+
stripeTransferId?: string | undefined;
|
|
355
|
+
}, {
|
|
356
|
+
stripeTransferId: import("convex/values").VString<string | undefined, "optional">;
|
|
357
|
+
sourceChargeId: import("convex/values").VString<string, "required">;
|
|
358
|
+
sourceInvoiceId: import("convex/values").VString<string | undefined, "optional">;
|
|
359
|
+
paymentIntentId: import("convex/values").VString<string | undefined, "optional">;
|
|
360
|
+
paymentId: import("convex/values").VString<string | undefined, "optional">;
|
|
361
|
+
storeAccountId: import("convex/values").VString<string | undefined, "optional">;
|
|
362
|
+
lastRefundId: import("convex/values").VString<string | undefined, "optional">;
|
|
363
|
+
affiliateAccountId: import("convex/values").VString<string, "required">;
|
|
364
|
+
currency: import("convex/values").VString<string, "required">;
|
|
365
|
+
chargeAmount: import("convex/values").VFloat64<number, "required">;
|
|
366
|
+
originalCommission: import("convex/values").VFloat64<number, "required">;
|
|
367
|
+
refundedPrincipal: import("convex/values").VFloat64<number, "required">;
|
|
368
|
+
disputedPrincipal: import("convex/values").VFloat64<number, "required">;
|
|
369
|
+
lostPrincipal: import("convex/values").VFloat64<number, "required">;
|
|
370
|
+
finalizedAmount: import("convex/values").VFloat64<number, "required">;
|
|
371
|
+
provisionalAmount: import("convex/values").VFloat64<number, "required">;
|
|
372
|
+
recoveredAmount: import("convex/values").VFloat64<number, "required">;
|
|
373
|
+
needsReconciliation: import("convex/values").VBoolean<boolean, "required">;
|
|
374
|
+
accounted: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
375
|
+
legacyReceiptIds: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
|
|
376
|
+
legacyRestorationIds: import("convex/values").VArray<string[] | undefined, import("convex/values").VString<string, "required">, "optional">;
|
|
377
|
+
operatorNote: import("convex/values").VString<string | undefined, "optional">;
|
|
378
|
+
releasedCommission: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
379
|
+
offsetAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
380
|
+
restoredAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
381
|
+
reservedRecovery: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
382
|
+
reservedRestoration: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
383
|
+
debtAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
384
|
+
creditAmount: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
385
|
+
debtStatus: import("convex/values").VUnion<"open" | "settled" | undefined, [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"settled", "required">], "optional", never>;
|
|
386
|
+
disputeState: import("convex/values").VUnion<"lost" | "open" | "won" | undefined, [import("convex/values").VLiteral<"open", "required">, import("convex/values").VLiteral<"lost", "required">, import("convex/values").VLiteral<"won", "required">], "optional", never>;
|
|
387
|
+
disputeId: import("convex/values").VString<string | undefined, "optional">;
|
|
388
|
+
lastState: import("convex/values").VString<string | undefined, "optional">;
|
|
389
|
+
lastError: import("convex/values").VString<string | undefined, "optional">;
|
|
390
|
+
operationSequence: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
391
|
+
_id: import("convex/values").VString<string, "required">;
|
|
392
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
393
|
+
earningId: import("convex/values").VString<string | undefined, "optional">;
|
|
394
|
+
activeOperationId: import("convex/values").VString<string | undefined, "optional">;
|
|
395
|
+
}, "required", "_creationTime" | "_id" | "accounted" | "activeOperationId" | "affiliateAccountId" | "chargeAmount" | "creditAmount" | "currency" | "debtAmount" | "debtStatus" | "disputeId" | "disputeState" | "disputedPrincipal" | "earningId" | "finalizedAmount" | "lastError" | "lastRefundId" | "lastState" | "legacyReceiptIds" | "legacyRestorationIds" | "lostPrincipal" | "needsReconciliation" | "offsetAmount" | "operationSequence" | "operatorNote" | "originalCommission" | "paymentId" | "paymentIntentId" | "provisionalAmount" | "recoveredAmount" | "refundedPrincipal" | "releasedCommission" | "reservedRecovery" | "reservedRestoration" | "restoredAmount" | "sourceChargeId" | "sourceInvoiceId" | "storeAccountId" | "stripeTransferId">, "required">;
|
|
396
|
+
continueCursor: import("convex/values").VString<string, "required">;
|
|
397
|
+
isDone: import("convex/values").VBoolean<boolean, "required">;
|
|
398
|
+
splitCursor: import("convex/values").VUnion<string | null | undefined, [import("convex/values").VString<string, "required">, import("convex/values").VNull<null, "required">], "optional", never>;
|
|
399
|
+
pageStatus: import("convex/values").VUnion<"SplitRecommended" | "SplitRequired" | null | undefined, [import("convex/values").VLiteral<"SplitRecommended", "required">, import("convex/values").VLiteral<"SplitRequired", "required">, import("convex/values").VNull<null, "required">], "optional", never>;
|
|
400
|
+
}, "required", "continueCursor" | "isDone" | "page" | "pageStatus" | "splitCursor">;
|
|
401
|
+
}, "required", "balance" | "balance._creationTime" | "balance._id" | "balance.activePayoutKey" | "balance.affiliateAccountId" | "balance.currency" | "balance.netPayable" | "balance.offsetAmount" | "balance.originalCommission" | "balance.outstandingDebt" | "balance.pendingPayoutAmount" | "balance.recoveredAmount" | "balance.reservedRecovery" | "balance.reservedRestoration" | "balance.restorationDue" | "balance.restoredAmount" | "balance.withheldAmount" | "obligations" | "obligations.continueCursor" | "obligations.isDone" | "obligations.page" | "obligations.pageStatus" | "obligations.splitCursor">;
|
|
402
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/client/affiliateRecovery/validators.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kuBAMvC,CAAC;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;iLAKtC,CAAC;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0lBAkBrC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { obligationFields } from "../../component/settlement/clawbackSchema.js";
|
|
3
|
+
import { balanceFields, operationFields, } from "../../component/affiliateRecovery/schema.js";
|
|
4
|
+
export const affiliateObligationValidator = v.object({
|
|
5
|
+
...obligationFields,
|
|
6
|
+
_id: v.string(),
|
|
7
|
+
_creationTime: v.number(),
|
|
8
|
+
earningId: v.optional(v.string()),
|
|
9
|
+
activeOperationId: v.optional(v.string()),
|
|
10
|
+
});
|
|
11
|
+
export const affiliateOperationValidator = v.object({
|
|
12
|
+
...operationFields,
|
|
13
|
+
_id: v.string(),
|
|
14
|
+
_creationTime: v.number(),
|
|
15
|
+
obligationId: v.string(),
|
|
16
|
+
});
|
|
17
|
+
export const affiliateSnapshotValidator = v.object({
|
|
18
|
+
balance: v.union(v.object({ ...balanceFields, _id: v.string(), _creationTime: v.number() }), v.null()),
|
|
19
|
+
obligations: v.object({
|
|
20
|
+
page: v.array(affiliateObligationValidator),
|
|
21
|
+
continueCursor: v.string(),
|
|
22
|
+
isDone: v.boolean(),
|
|
23
|
+
splitCursor: v.optional(v.union(v.string(), v.null())),
|
|
24
|
+
pageStatus: v.optional(v.union(v.literal("SplitRecommended"), v.literal("SplitRequired"), v.null())),
|
|
25
|
+
}),
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/client/affiliateRecovery/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAChF,OAAO,EACL,aAAa,EACb,eAAe,GAChB,MAAM,6CAA6C,CAAC;AACrD,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,GAAG,gBAAgB;IACnB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IACjC,iBAAiB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC1C,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,GAAG,eAAe;IAClB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;IACf,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;CACzB,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,EAC1E,CAAC,CAAC,IAAI,EAAE,CACT;IACD,WAAW,EAAE,CAAC,CAAC,MAAM,C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