@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
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { paginator } from "convex-helpers/server/pagination";
|
|
2
|
+
import schema from "../schema.js";
|
|
1
3
|
import { transferDocValidator } from "../connect/validators.js";
|
|
2
4
|
import { readFees } from "./fees.js";
|
|
3
5
|
import { paginationOptsValidator } from "convex/server";
|
|
@@ -39,7 +41,7 @@ export const pending = query({
|
|
|
39
41
|
args.paginationOpts.numItems < 1 ||
|
|
40
42
|
args.paginationOpts.numItems > 100)
|
|
41
43
|
throw new Error("Invalid payout claim page.");
|
|
42
|
-
const result = await ctx.db
|
|
44
|
+
const result = await paginator(ctx.db, schema)
|
|
43
45
|
.query("payoutReleaseClaims")
|
|
44
46
|
.withIndex("by_account_status", (q) => q.eq("accountId", args.accountId).eq("status", "reserved"))
|
|
45
47
|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CAAC,EAAE,EAAE,CAC5C,CAAC,CAAC,EAAE,CAAC,sBAAsB,EAAE,IAAI,CAAC,SAAS,CAAC,CAC7C;aACA,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE;aACxB,KAAK,CAAC,qBAAqB,CAAC;aAC5B,SAAS,CAAC,mBAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;aACxE,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,IAAI,SAAS,CAAC,MAAM,GAAG,GAAG,IAAI,MAAM,CAAC,MAAM,GAAG,GAAG;YAC/C,OAAO,EAAE,MAAM,EAAE,MAAe,EAAE,MAAM,EAAE,gBAAyB,EAAE,CAAC;QACxE,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,CAAC;YAClD,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,OAAO,EAAE,MAAM,EAAE,OAAgB,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IACzD,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Infer } from "convex/values";
|
|
2
|
+
import type { MutationCtx, QueryCtx } from "../_generated/server.js";
|
|
3
|
+
import type { Doc } from "../_generated/dataModel.js";
|
|
4
|
+
import type { snapshot } from "./validators.js";
|
|
5
|
+
export declare function validateIdentity(args: {
|
|
6
|
+
stripePayoutId: string;
|
|
7
|
+
accountId: string;
|
|
8
|
+
}): void;
|
|
9
|
+
export declare function claimByPayout(ctx: QueryCtx | MutationCtx, args: {
|
|
10
|
+
stripePayoutId: string;
|
|
11
|
+
accountId: string;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
_creationTime: number;
|
|
14
|
+
_id: import("convex/values").GenericId<"payoutSyncClaims">;
|
|
15
|
+
acceptedAt?: number | undefined;
|
|
16
|
+
acceptedFingerprint?: string | undefined;
|
|
17
|
+
acceptedGeneration?: number | undefined;
|
|
18
|
+
accountId: string;
|
|
19
|
+
generation: number;
|
|
20
|
+
startedAt: number;
|
|
21
|
+
status: "accepted" | "pending" | "unknown";
|
|
22
|
+
stripePayoutId: string;
|
|
23
|
+
} | null>;
|
|
24
|
+
export declare function payoutById(ctx: QueryCtx | MutationCtx, args: {
|
|
25
|
+
stripePayoutId: string;
|
|
26
|
+
accountId: string;
|
|
27
|
+
}): Promise<{
|
|
28
|
+
_creationTime: number;
|
|
29
|
+
_id: import("convex/values").GenericId<"payouts">;
|
|
30
|
+
accountId: string;
|
|
31
|
+
amount: number;
|
|
32
|
+
arrivalDate?: string | undefined;
|
|
33
|
+
currency: string;
|
|
34
|
+
failureCode?: string | undefined;
|
|
35
|
+
failureMessage?: string | undefined;
|
|
36
|
+
metadata?: any;
|
|
37
|
+
method?: string | undefined;
|
|
38
|
+
status: "canceled" | "failed" | "in_transit" | "paid" | "pending";
|
|
39
|
+
stripePayoutId: string;
|
|
40
|
+
totalsRecorded?: true | undefined;
|
|
41
|
+
} | null>;
|
|
42
|
+
export declare function validateSnapshot(p: Infer<typeof snapshot>): void;
|
|
43
|
+
export declare function fingerprint(p: Infer<typeof snapshot> | Doc<"payouts">): Promise<string>;
|
|
44
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/component/payoutSync/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,4BAA4B,CAAC;AAEtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;CACnB,QASA;AACD,wBAAsB,aAAa,CACjC,GAAG,EAAE,QAAQ,GAAG,WAAW,EAC3B,IAAI,EAAE;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;UAYpD;AACD,wBAAsB,UAAU,CAC9B,GAAG,EAAE,QAAQ,GAAG,WAAW,EAC3B,IAAI,EAAE;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;;;;;;;;;;;;;;UAWpD;AACD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,QAAQ,CAAC,QAoBzD;AACD,wBAAsB,WAAW,CAAC,CAAC,EAAE,KAAK,CAAC,OAAO,QAAQ,CAAC,GAAG,GAAG,CAAC,SAAS,CAAC,mBAiB3E"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { generateIdempotencyKey } from "../lib/idempotency.js";
|
|
2
|
+
export function validateIdentity(args) {
|
|
3
|
+
if (!/^po_[A-Za-z0-9_]+$/.test(args.stripePayoutId) ||
|
|
4
|
+
args.stripePayoutId.length > 255 ||
|
|
5
|
+
(args.accountId !== "platform" &&
|
|
6
|
+
!/^acct_[A-Za-z0-9_]+$/.test(args.accountId)) ||
|
|
7
|
+
args.accountId.length > 255)
|
|
8
|
+
throw new Error("Invalid payout synchronization identity.");
|
|
9
|
+
}
|
|
10
|
+
export async function claimByPayout(ctx, args) {
|
|
11
|
+
validateIdentity(args);
|
|
12
|
+
const claim = await ctx.db
|
|
13
|
+
.query("payoutSyncClaims")
|
|
14
|
+
.withIndex("by_stripe_payout_id", (q) => q.eq("stripePayoutId", args.stripePayoutId))
|
|
15
|
+
.unique();
|
|
16
|
+
if (claim && claim.accountId !== args.accountId)
|
|
17
|
+
throw new Error("Payout synchronization account does not match.");
|
|
18
|
+
return claim;
|
|
19
|
+
}
|
|
20
|
+
export async function payoutById(ctx, args) {
|
|
21
|
+
const payout = await ctx.db
|
|
22
|
+
.query("payouts")
|
|
23
|
+
.withIndex("by_stripe_payout_id", (q) => q.eq("stripePayoutId", args.stripePayoutId))
|
|
24
|
+
.unique();
|
|
25
|
+
if (payout && payout.accountId !== args.accountId)
|
|
26
|
+
throw new Error("Existing payout account does not match.");
|
|
27
|
+
return payout;
|
|
28
|
+
}
|
|
29
|
+
export function validateSnapshot(p) {
|
|
30
|
+
validateIdentity(p);
|
|
31
|
+
if (!Number.isSafeInteger(p.amount) ||
|
|
32
|
+
p.amount <= 0 ||
|
|
33
|
+
!/^[a-z]{3}$/.test(p.currency) ||
|
|
34
|
+
(p.method !== undefined && !["standard", "instant"].includes(p.method)))
|
|
35
|
+
throw new Error("Invalid payout synchronization money or method.");
|
|
36
|
+
if (p.arrivalDate !== undefined &&
|
|
37
|
+
(!Number.isFinite(Date.parse(p.arrivalDate)) ||
|
|
38
|
+
new Date(p.arrivalDate).toISOString() !== p.arrivalDate))
|
|
39
|
+
throw new Error("Invalid payout arrival date.");
|
|
40
|
+
if ((p.failureCode !== undefined && p.failureCode.length > 255) ||
|
|
41
|
+
(p.failureMessage !== undefined && p.failureMessage.length > 4096))
|
|
42
|
+
throw new Error("Invalid payout failure detail.");
|
|
43
|
+
}
|
|
44
|
+
export async function fingerprint(p) {
|
|
45
|
+
return generateIdempotencyKey("payout-sync", {
|
|
46
|
+
snapshot: [
|
|
47
|
+
p.stripePayoutId,
|
|
48
|
+
p.accountId,
|
|
49
|
+
p.amount,
|
|
50
|
+
p.currency,
|
|
51
|
+
p.status,
|
|
52
|
+
p.arrivalDate,
|
|
53
|
+
p.method,
|
|
54
|
+
p.failureCode,
|
|
55
|
+
p.failureMessage,
|
|
56
|
+
Object.entries(p.metadata ?? {}).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0),
|
|
57
|
+
],
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../src/component/payoutSync/helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,MAAM,UAAU,gBAAgB,CAAC,IAGhC;IACC,IACE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC;QAC/C,IAAI,CAAC,cAAc,CAAC,MAAM,GAAG,GAAG;QAChC,CAAC,IAAI,CAAC,SAAS,KAAK,UAAU;YAC5B,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/C,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,GAAG;QAE3B,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAChE,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,GAA2B,EAC3B,IAAmD;IAEnD,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvB,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,EAAE;SACvB,KAAK,CAAC,kBAAkB,CAAC;SACzB,SAAS,CAAC,qBAAqB,EAAE,CAAC,CAAC,EAAE,EAAE,CACtC,CAAC,CAAC,EAAE,CAAC,gBAAgB,EAAE,IAAI,CAAC,cAAc,CAAC,CAC5C;SACA,MAAM,EAAE,CAAC;IACZ,IAAI,KAAK,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,SAAS;QAC7C,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,OAAO,KAAK,CAAC;AACf,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,GAA2B,EAC3B,IAAmD;IAEnD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,EAAE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AAM,GAAG,IAAI,CAAC;QAElE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACtD,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,CAA0C;IAC1E,OAAO,sBAAsB,CAAC,aAAa,EAAE;QAC3C,QAAQ,EAAE;YACR,CAAC,CAAC,cAAc;YAChB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,QAAQ;YACV,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,MAAM;YACR,CAAC,CAAC,WAAW;YACb,CAAC,CAAC,cAAc;YAChB,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACjD,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3B;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare const begin: import("convex/server").RegisteredMutation<"public", {
|
|
2
|
+
accountId: string;
|
|
3
|
+
stripePayoutId: string;
|
|
4
|
+
}, Promise<number>>;
|
|
5
|
+
export declare const finish: import("convex/server").RegisteredMutation<"public", {
|
|
6
|
+
accountId: string;
|
|
7
|
+
generation: number;
|
|
8
|
+
payout: {
|
|
9
|
+
accountId: string;
|
|
10
|
+
amount: number;
|
|
11
|
+
arrivalDate?: string | undefined;
|
|
12
|
+
currency: string;
|
|
13
|
+
failureCode?: string | undefined;
|
|
14
|
+
failureMessage?: string | undefined;
|
|
15
|
+
metadata?: Record<string, string> | undefined;
|
|
16
|
+
method?: string | undefined;
|
|
17
|
+
status: "canceled" | "failed" | "in_transit" | "paid" | "pending";
|
|
18
|
+
stripePayoutId: string;
|
|
19
|
+
};
|
|
20
|
+
stripePayoutId: string;
|
|
21
|
+
}, Promise<{
|
|
22
|
+
status: "superseded";
|
|
23
|
+
generation: number;
|
|
24
|
+
changed?: undefined;
|
|
25
|
+
payout?: undefined;
|
|
26
|
+
} | {
|
|
27
|
+
status: "accepted";
|
|
28
|
+
generation: number;
|
|
29
|
+
changed: boolean;
|
|
30
|
+
payout: {
|
|
31
|
+
_creationTime: number;
|
|
32
|
+
_id: import("convex/values").GenericId<"payouts">;
|
|
33
|
+
accountId: string;
|
|
34
|
+
amount: number;
|
|
35
|
+
arrivalDate?: string | undefined;
|
|
36
|
+
currency: string;
|
|
37
|
+
failureCode?: string | undefined;
|
|
38
|
+
failureMessage?: string | undefined;
|
|
39
|
+
metadata?: any;
|
|
40
|
+
method?: string | undefined;
|
|
41
|
+
status: "canceled" | "failed" | "in_transit" | "paid" | "pending";
|
|
42
|
+
stripePayoutId: string;
|
|
43
|
+
totalsRecorded?: true | undefined;
|
|
44
|
+
};
|
|
45
|
+
}>>;
|
|
46
|
+
export declare const markUnknown: import("convex/server").RegisteredMutation<"public", {
|
|
47
|
+
accountId: string;
|
|
48
|
+
generation: number;
|
|
49
|
+
stripePayoutId: string;
|
|
50
|
+
}, Promise<null>>;
|
|
51
|
+
//# sourceMappingURL=mutations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../../src/component/payoutSync/mutations.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,KAAK;;;mBAwBhB,CAAC;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;YAOI,YAAY;;;;;YA8BnB,UAAU;;;;;;;;;;;;;;;;;;GAmBxB,CAAC;AACH,eAAO,MAAM,WAAW;;;;iBAStB,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { mutation } from "../earnings/triggers.js";
|
|
3
|
+
import { writePayout } from "../connect/payoutWrites.js";
|
|
4
|
+
import { claimByPayout, payoutById, validateSnapshot, fingerprint, } from "./helpers.js";
|
|
5
|
+
import { identity, prepared, result } from "./validators.js";
|
|
6
|
+
export const begin = mutation({
|
|
7
|
+
args: identity,
|
|
8
|
+
returns: v.number(),
|
|
9
|
+
handler: async (ctx, args) => {
|
|
10
|
+
const claim = await claimByPayout(ctx, args);
|
|
11
|
+
await payoutById(ctx, args);
|
|
12
|
+
const generation = (claim?.generation ?? 0) + 1;
|
|
13
|
+
if (!Number.isSafeInteger(generation))
|
|
14
|
+
throw new Error("Payout synchronization generation exhausted.");
|
|
15
|
+
if (claim)
|
|
16
|
+
await ctx.db.patch("payoutSyncClaims", claim._id, {
|
|
17
|
+
generation,
|
|
18
|
+
status: "pending",
|
|
19
|
+
startedAt: Date.now(),
|
|
20
|
+
});
|
|
21
|
+
else
|
|
22
|
+
await ctx.db.insert("payoutSyncClaims", {
|
|
23
|
+
...args,
|
|
24
|
+
generation,
|
|
25
|
+
status: "pending",
|
|
26
|
+
startedAt: Date.now(),
|
|
27
|
+
});
|
|
28
|
+
return generation;
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
export const finish = mutation({
|
|
32
|
+
args: prepared,
|
|
33
|
+
returns: result,
|
|
34
|
+
handler: async (ctx, args) => {
|
|
35
|
+
const claim = await claimByPayout(ctx, args);
|
|
36
|
+
if (!claim)
|
|
37
|
+
throw new Error("Payout synchronization claim is missing.");
|
|
38
|
+
if (claim.generation !== args.generation)
|
|
39
|
+
return { status: "superseded", generation: args.generation };
|
|
40
|
+
validateSnapshot(args.payout);
|
|
41
|
+
if (args.payout.accountId !== args.accountId ||
|
|
42
|
+
args.payout.stripePayoutId !== args.stripePayoutId)
|
|
43
|
+
throw new Error("Payout synchronization snapshot identity does not match.");
|
|
44
|
+
const existing = await payoutById(ctx, args);
|
|
45
|
+
if (existing &&
|
|
46
|
+
(existing.amount !== args.payout.amount ||
|
|
47
|
+
existing.currency !== args.payout.currency))
|
|
48
|
+
throw new Error("Existing payout original money does not match.");
|
|
49
|
+
const nextFingerprint = await fingerprint(args.payout);
|
|
50
|
+
if (claim.status === "accepted" &&
|
|
51
|
+
claim.acceptedFingerprint !== nextFingerprint)
|
|
52
|
+
throw new Error("An accepted payout observation cannot be replaced.");
|
|
53
|
+
const changed = !existing || (await fingerprint(existing)) !== nextFingerprint;
|
|
54
|
+
if (claim.status === "accepted" && changed)
|
|
55
|
+
throw new Error("Accepted payout state changed outside its synchronization.");
|
|
56
|
+
if (claim.status === "accepted")
|
|
57
|
+
return {
|
|
58
|
+
status: "accepted",
|
|
59
|
+
generation: args.generation,
|
|
60
|
+
changed: false,
|
|
61
|
+
payout: existing,
|
|
62
|
+
};
|
|
63
|
+
const payout = changed ? await writePayout(ctx, args.payout) : existing;
|
|
64
|
+
await ctx.db.patch("payoutSyncClaims", claim._id, {
|
|
65
|
+
status: "accepted",
|
|
66
|
+
acceptedGeneration: args.generation,
|
|
67
|
+
acceptedAt: Date.now(),
|
|
68
|
+
acceptedFingerprint: nextFingerprint,
|
|
69
|
+
});
|
|
70
|
+
return {
|
|
71
|
+
status: "accepted",
|
|
72
|
+
generation: args.generation,
|
|
73
|
+
changed,
|
|
74
|
+
payout,
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
export const markUnknown = mutation({
|
|
79
|
+
args: { ...identity, generation: v.number() },
|
|
80
|
+
returns: v.null(),
|
|
81
|
+
handler: async (ctx, args) => {
|
|
82
|
+
const claim = await claimByPayout(ctx, args);
|
|
83
|
+
if (claim?.generation === args.generation && claim.status === "pending")
|
|
84
|
+
await ctx.db.patch("payoutSyncClaims", claim._id, { status: "unknown" });
|
|
85
|
+
return null;
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
//# sourceMappingURL=mutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutations.js","sourceRoot":"","sources":["../../../src/component/payout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K,CAAC,MAAM,KAAK,SAAS;YACrE,MAAM,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,kBAAkB,EAAE,KAAK,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;QAC3E,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const get: import("convex/server").RegisteredQuery<"public", {
|
|
2
|
+
stripePayoutId: string;
|
|
3
|
+
accountId: string;
|
|
4
|
+
}, Promise<{
|
|
5
|
+
_creationTime: number;
|
|
6
|
+
_id: import("convex/values").GenericId<"payoutSyncClaims">;
|
|
7
|
+
acceptedAt?: number | undefined;
|
|
8
|
+
acceptedFingerprint?: string | undefined;
|
|
9
|
+
acceptedGeneration?: number | undefined;
|
|
10
|
+
accountId: string;
|
|
11
|
+
generation: number;
|
|
12
|
+
startedAt: number;
|
|
13
|
+
status: "accepted" | "pending" | "unknown";
|
|
14
|
+
stripePayoutId: string;
|
|
15
|
+
} | null>>;
|
|
16
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../../src/component/payoutSync/queries.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,GAAG;;;;;;;;;;;;;;UAId,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { query } from "../_generated/server.js";
|
|
3
|
+
import { claimByPayout } from "./helpers.js";
|
|
4
|
+
import { claimDoc } from "./schema.js";
|
|
5
|
+
import { identity } from "./validators.js";
|
|
6
|
+
export const get = query({
|
|
7
|
+
args: identity,
|
|
8
|
+
returns: v.union(claimDoc, v.null()),
|
|
9
|
+
handler: claimByPayout,
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../../src/component/payoutSync/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,MAAM,CAAC,MAAM,GAAG,GAAG,KAAK,CAAC;IACvB,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpC,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare const claimDoc: import("convex/values").VObject<{
|
|
2
|
+
_creationTime: number;
|
|
3
|
+
_id: import("convex/values").GenericId<"payoutSyncClaims">;
|
|
4
|
+
acceptedAt?: number | undefined;
|
|
5
|
+
acceptedFingerprint?: string | undefined;
|
|
6
|
+
acceptedGeneration?: number | undefined;
|
|
7
|
+
accountId: string;
|
|
8
|
+
generation: number;
|
|
9
|
+
startedAt: number;
|
|
10
|
+
status: "accepted" | "pending" | "unknown";
|
|
11
|
+
stripePayoutId: string;
|
|
12
|
+
}, {
|
|
13
|
+
stripePayoutId: import("convex/values").VString<string, "required">;
|
|
14
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
15
|
+
generation: import("convex/values").VFloat64<number, "required">;
|
|
16
|
+
status: import("convex/values").VUnion<"accepted" | "pending" | "unknown", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"accepted", "required">, import("convex/values").VLiteral<"unknown", "required">], "required", never>;
|
|
17
|
+
startedAt: import("convex/values").VFloat64<number, "required">;
|
|
18
|
+
acceptedGeneration: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
19
|
+
acceptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
20
|
+
acceptedFingerprint: import("convex/values").VString<string | undefined, "optional">;
|
|
21
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"payoutSyncClaims">, "required">;
|
|
22
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
23
|
+
}, "required", "_creationTime" | "_id" | "acceptedAt" | "acceptedFingerprint" | "acceptedGeneration" | "accountId" | "generation" | "startedAt" | "status" | "stripePayoutId">;
|
|
24
|
+
/** Operational generations only. Financial facts remain in the existing payouts table. */
|
|
25
|
+
export declare const claimsTable: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
26
|
+
acceptedAt?: number | undefined;
|
|
27
|
+
acceptedFingerprint?: string | undefined;
|
|
28
|
+
acceptedGeneration?: number | undefined;
|
|
29
|
+
accountId: string;
|
|
30
|
+
generation: number;
|
|
31
|
+
startedAt: number;
|
|
32
|
+
status: "accepted" | "pending" | "unknown";
|
|
33
|
+
stripePayoutId: string;
|
|
34
|
+
}, {
|
|
35
|
+
stripePayoutId: import("convex/values").VString<string, "required">;
|
|
36
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
37
|
+
generation: import("convex/values").VFloat64<number, "required">;
|
|
38
|
+
status: import("convex/values").VUnion<"accepted" | "pending" | "unknown", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"accepted", "required">, import("convex/values").VLiteral<"unknown", "required">], "required", never>;
|
|
39
|
+
startedAt: import("convex/values").VFloat64<number, "required">;
|
|
40
|
+
acceptedGeneration: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
41
|
+
acceptedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
42
|
+
acceptedFingerprint: import("convex/values").VString<string | undefined, "optional">;
|
|
43
|
+
}, "required", "acceptedAt" | "acceptedFingerprint" | "acceptedGeneration" | "accountId" | "generation" | "startedAt" | "status" | "stripePayoutId">, {
|
|
44
|
+
by_stripe_payout_id: ["stripePayoutId", "_creationTime"];
|
|
45
|
+
}, {}, {}>;
|
|
46
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/component/payoutSync/schema.ts"],"names":[],"mappings":"AAgBA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;8KAInB,CAAC;AACH,0FAA0F;AAC1F,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;UAEtB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineTable } from "convex/server";
|
|
2
|
+
import { v } from "convex/values";
|
|
3
|
+
import { identity } from "./validators.js";
|
|
4
|
+
const fields = {
|
|
5
|
+
...identity,
|
|
6
|
+
generation: v.number(),
|
|
7
|
+
status: v.union(v.literal("pending"), v.literal("accepted"), v.literal("unknown")),
|
|
8
|
+
startedAt: v.number(),
|
|
9
|
+
acceptedGeneration: v.optional(v.number()),
|
|
10
|
+
acceptedAt: v.optional(v.number()),
|
|
11
|
+
acceptedFingerprint: v.optional(v.string()),
|
|
12
|
+
};
|
|
13
|
+
export const claimDoc = v.object({
|
|
14
|
+
...fields,
|
|
15
|
+
_id: v.id("payoutSyncClaims"),
|
|
16
|
+
_creationTime: v.number(),
|
|
17
|
+
});
|
|
18
|
+
/** Operational generations only. Financial facts remain in the existing payouts table. */
|
|
19
|
+
export const claimsTable = defineTable(fields).index("by_stripe_payout_id", [
|
|
20
|
+
"stripePayoutId",
|
|
21
|
+
]);
|
|
22
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/component/payoutSync/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,MAAM,MAAM,GAAG;IACb,GAAG,QAAQ;IACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,MAAM,EAAE,CAAC,CAAC,KAAK,CACb,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,EACpB,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EACrB,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CACrB;IACD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,kBAAkB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC1C,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,mBAAmB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC5C,CAAC;AACF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,GAAG,MAAM;IACT,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,kBAAkB,CAAC;IAC7B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAC;AACH,0FAA0F;AAC1F,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,qBAAqB,EAAE;IAC1E,gBAAgB;CACjB,CAAC,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
export declare const identity: {
|
|
2
|
+
stripePayoutId: import("convex/values").VString<string, "required">;
|
|
3
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
4
|
+
};
|
|
5
|
+
export declare const snapshot: import("convex/values").VObject<{
|
|
6
|
+
accountId: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
arrivalDate?: string | undefined;
|
|
9
|
+
currency: string;
|
|
10
|
+
failureCode?: string | undefined;
|
|
11
|
+
failureMessage?: string | undefined;
|
|
12
|
+
metadata?: Record<string, string> | undefined;
|
|
13
|
+
method?: string | undefined;
|
|
14
|
+
status: "canceled" | "failed" | "in_transit" | "paid" | "pending";
|
|
15
|
+
stripePayoutId: string;
|
|
16
|
+
}, {
|
|
17
|
+
stripePayoutId: import("convex/values").VString<string, "required">;
|
|
18
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
19
|
+
amount: import("convex/values").VFloat64<number, "required">;
|
|
20
|
+
currency: import("convex/values").VString<string, "required">;
|
|
21
|
+
status: import("convex/values").VUnion<"canceled" | "failed" | "in_transit" | "paid" | "pending", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"paid", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"canceled", "required">, import("convex/values").VLiteral<"in_transit", "required">], "required", never>;
|
|
22
|
+
arrivalDate: import("convex/values").VString<string | undefined, "optional">;
|
|
23
|
+
method: import("convex/values").VString<string | undefined, "optional">;
|
|
24
|
+
failureCode: import("convex/values").VString<string | undefined, "optional">;
|
|
25
|
+
failureMessage: import("convex/values").VString<string | undefined, "optional">;
|
|
26
|
+
metadata: import("convex/values").VRecord<Record<string, string> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "optional", string>;
|
|
27
|
+
}, "required", "accountId" | "amount" | "arrivalDate" | "currency" | "failureCode" | "failureMessage" | "metadata" | "method" | "status" | "stripePayoutId" | `metadata.${string}`>;
|
|
28
|
+
export declare const prepared: {
|
|
29
|
+
stripePayoutId: import("convex/values").VString<string, "required">;
|
|
30
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
31
|
+
generation: import("convex/values").VFloat64<number, "required">;
|
|
32
|
+
payout: import("convex/values").VObject<{
|
|
33
|
+
accountId: string;
|
|
34
|
+
amount: number;
|
|
35
|
+
arrivalDate?: string | undefined;
|
|
36
|
+
currency: string;
|
|
37
|
+
failureCode?: string | undefined;
|
|
38
|
+
failureMessage?: string | undefined;
|
|
39
|
+
metadata?: Record<string, string> | undefined;
|
|
40
|
+
method?: string | undefined;
|
|
41
|
+
status: "canceled" | "failed" | "in_transit" | "paid" | "pending";
|
|
42
|
+
stripePayoutId: string;
|
|
43
|
+
}, {
|
|
44
|
+
stripePayoutId: import("convex/values").VString<string, "required">;
|
|
45
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
46
|
+
amount: import("convex/values").VFloat64<number, "required">;
|
|
47
|
+
currency: import("convex/values").VString<string, "required">;
|
|
48
|
+
status: import("convex/values").VUnion<"canceled" | "failed" | "in_transit" | "paid" | "pending", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"paid", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"canceled", "required">, import("convex/values").VLiteral<"in_transit", "required">], "required", never>;
|
|
49
|
+
arrivalDate: import("convex/values").VString<string | undefined, "optional">;
|
|
50
|
+
method: import("convex/values").VString<string | undefined, "optional">;
|
|
51
|
+
failureCode: import("convex/values").VString<string | undefined, "optional">;
|
|
52
|
+
failureMessage: import("convex/values").VString<string | undefined, "optional">;
|
|
53
|
+
metadata: import("convex/values").VRecord<Record<string, string> | undefined, import("convex/values").VString<string, "required">, import("convex/values").VString<string, "required">, "optional", string>;
|
|
54
|
+
}, "required", "accountId" | "amount" | "arrivalDate" | "currency" | "failureCode" | "failureMessage" | "metadata" | "method" | "status" | "stripePayoutId" | `metadata.${string}`>;
|
|
55
|
+
};
|
|
56
|
+
export declare const result: import("convex/values").VUnion<{
|
|
57
|
+
changed: boolean;
|
|
58
|
+
generation: number;
|
|
59
|
+
payout: {
|
|
60
|
+
_creationTime: number;
|
|
61
|
+
_id: import("convex/values").GenericId<"payouts">;
|
|
62
|
+
accountId: string;
|
|
63
|
+
amount: number;
|
|
64
|
+
arrivalDate?: string | undefined;
|
|
65
|
+
currency: string;
|
|
66
|
+
failureCode?: string | undefined;
|
|
67
|
+
failureMessage?: string | undefined;
|
|
68
|
+
metadata?: any;
|
|
69
|
+
method?: string | undefined;
|
|
70
|
+
status: "canceled" | "failed" | "in_transit" | "paid" | "pending";
|
|
71
|
+
stripePayoutId: string;
|
|
72
|
+
totalsRecorded?: true | undefined;
|
|
73
|
+
};
|
|
74
|
+
status: "accepted";
|
|
75
|
+
} | {
|
|
76
|
+
generation: number;
|
|
77
|
+
status: "superseded";
|
|
78
|
+
}, [import("convex/values").VObject<{
|
|
79
|
+
changed: boolean;
|
|
80
|
+
generation: number;
|
|
81
|
+
payout: {
|
|
82
|
+
_creationTime: number;
|
|
83
|
+
_id: import("convex/values").GenericId<"payouts">;
|
|
84
|
+
accountId: string;
|
|
85
|
+
amount: number;
|
|
86
|
+
arrivalDate?: string | undefined;
|
|
87
|
+
currency: string;
|
|
88
|
+
failureCode?: string | undefined;
|
|
89
|
+
failureMessage?: string | undefined;
|
|
90
|
+
metadata?: any;
|
|
91
|
+
method?: string | undefined;
|
|
92
|
+
status: "canceled" | "failed" | "in_transit" | "paid" | "pending";
|
|
93
|
+
stripePayoutId: string;
|
|
94
|
+
totalsRecorded?: true | undefined;
|
|
95
|
+
};
|
|
96
|
+
status: "accepted";
|
|
97
|
+
}, {
|
|
98
|
+
status: import("convex/values").VLiteral<"accepted", "required">;
|
|
99
|
+
generation: import("convex/values").VFloat64<number, "required">;
|
|
100
|
+
changed: import("convex/values").VBoolean<boolean, "required">;
|
|
101
|
+
payout: import("convex/values").VObject<{
|
|
102
|
+
_creationTime: number;
|
|
103
|
+
_id: import("convex/values").GenericId<"payouts">;
|
|
104
|
+
accountId: string;
|
|
105
|
+
amount: number;
|
|
106
|
+
arrivalDate?: string | undefined;
|
|
107
|
+
currency: string;
|
|
108
|
+
failureCode?: string | undefined;
|
|
109
|
+
failureMessage?: string | undefined;
|
|
110
|
+
metadata?: any;
|
|
111
|
+
method?: string | undefined;
|
|
112
|
+
status: "canceled" | "failed" | "in_transit" | "paid" | "pending";
|
|
113
|
+
stripePayoutId: string;
|
|
114
|
+
totalsRecorded?: true | undefined;
|
|
115
|
+
}, {
|
|
116
|
+
stripePayoutId: import("convex/values").VString<string, "required">;
|
|
117
|
+
accountId: import("convex/values").VString<string, "required">;
|
|
118
|
+
amount: import("convex/values").VFloat64<number, "required">;
|
|
119
|
+
currency: import("convex/values").VString<string, "required">;
|
|
120
|
+
status: import("convex/values").VUnion<"canceled" | "failed" | "in_transit" | "paid" | "pending", [import("convex/values").VLiteral<"pending", "required">, import("convex/values").VLiteral<"paid", "required">, import("convex/values").VLiteral<"failed", "required">, import("convex/values").VLiteral<"canceled", "required">, import("convex/values").VLiteral<"in_transit", "required">], "required", never>;
|
|
121
|
+
arrivalDate: import("convex/values").VString<string | undefined, "optional">;
|
|
122
|
+
method: import("convex/values").VString<string | undefined, "optional">;
|
|
123
|
+
failureCode: import("convex/values").VString<string | undefined, "optional">;
|
|
124
|
+
failureMessage: import("convex/values").VString<string | undefined, "optional">;
|
|
125
|
+
metadata: import("convex/values").VAny<any, "optional", string>;
|
|
126
|
+
_id: import("convex/values").VId<import("convex/values").GenericId<"payouts">, "required">;
|
|
127
|
+
_creationTime: import("convex/values").VFloat64<number, "required">;
|
|
128
|
+
totalsRecorded: import("convex/values").VLiteral<true | undefined, "optional">;
|
|
129
|
+
}, "required", "_creationTime" | "_id" | "accountId" | "amount" | "arrivalDate" | "currency" | "failureCode" | "failureMessage" | "metadata" | "method" | "status" | "stripePayoutId" | "totalsRecorded" | `metadata.${string}`>;
|
|
130
|
+
}, "required", "changed" | "generation" | "payout" | "payout._creationTime" | "payout._id" | "payout.accountId" | "payout.amount" | "payout.arrivalDate" | "payout.currency" | "payout.failureCode" | "payout.failureMessage" | "payout.metadata" | "payout.method" | "payout.status" | "payout.stripePayoutId" | "payout.totalsRecorded" | "status" | `payout.metadata.${string}`>, import("convex/values").VObject<{
|
|
131
|
+
generation: number;
|
|
132
|
+
status: "superseded";
|
|
133
|
+
}, {
|
|
134
|
+
status: import("convex/values").VLiteral<"superseded", "required">;
|
|
135
|
+
generation: import("convex/values").VFloat64<number, "required">;
|
|
136
|
+
}, "required", "generation" | "status">], "required", "changed" | "generation" | "payout" | "payout._creationTime" | "payout._id" | "payout.accountId" | "payout.amount" | "payout.arrivalDate" | "payout.currency" | "payout.failureCode" | "payout.failureMessage" | "payout.metadata" | "payout.method" | "payout.status" | "payout.stripePayoutId" | "payout.totalsRecorded" | "status" | `payout.metadata.${string}`>;
|
|
137
|
+
//# sourceMappingURL=validators.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../../../src/component/payoutSync/validators.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;IAAK,cAAc;IAAc,SAAS;CAAc,CAAC;AAC9E,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;mLAGnB,CAAC;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIpB,CAAC;AACF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0ZAQlB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { v } from "convex/values";
|
|
2
|
+
import { payoutFields, payoutDocValidator } from "../connect/validators.js";
|
|
3
|
+
export const identity = { stripePayoutId: v.string(), accountId: v.string() };
|
|
4
|
+
export const snapshot = v.object({
|
|
5
|
+
...payoutFields,
|
|
6
|
+
metadata: v.optional(v.record(v.string(), v.string())),
|
|
7
|
+
});
|
|
8
|
+
export const prepared = {
|
|
9
|
+
...identity,
|
|
10
|
+
generation: v.number(),
|
|
11
|
+
payout: snapshot,
|
|
12
|
+
};
|
|
13
|
+
export const result = v.union(v.object({
|
|
14
|
+
status: v.literal("accepted"),
|
|
15
|
+
generation: v.number(),
|
|
16
|
+
changed: v.boolean(),
|
|
17
|
+
payout: payoutDocValidator,
|
|
18
|
+
}), v.object({ status: v.literal("superseded"), generation: v.number() }));
|
|
19
|
+
//# sourceMappingURL=validators.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/component/payoutSync/validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC5E,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;AAC9E,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,GAAG,YAAY;IACf,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;CACvD,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,GAAG,QAAQ;IACX,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,MAAM,EAAE,QAAQ;CACjB,CAAC;AACF,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAC3B,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAC7B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,MAAM,EAAE,kBAAkB;CAC3B,CAAC,EACF,CAAC,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACtE,CAAC"}
|