@fantastic.dev/better-stripe 0.28.5 → 0.29.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 +12 -0
- package/MIGRATION.md +6 -0
- package/README.md +7 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +28 -8
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutCollectedInput.d.ts +110 -0
- package/dist/client/connect/payoutCollectedInput.d.ts.map +1 -0
- package/dist/client/connect/payoutCollectedInput.js +70 -0
- package/dist/client/connect/payoutCollectedInput.js.map +1 -0
- package/dist/client/connect/payoutExecution.d.ts +1 -0
- package/dist/client/connect/payoutExecution.d.ts.map +1 -1
- package/dist/client/connect/payoutExecution.js +94 -67
- package/dist/client/connect/payoutExecution.js.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +16 -4
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.js +9 -6
- package/dist/client/connect/payoutExecutionTestHelpers.js.map +1 -1
- package/dist/client/connect/payoutPreview.d.ts +1 -0
- package/dist/client/connect/payoutPreview.d.ts.map +1 -1
- package/dist/client/connect/payoutPreview.js +31 -19
- package/dist/client/connect/payoutPreview.js.map +1 -1
- package/dist/client/connect/payoutQualification.d.ts +7 -1
- package/dist/client/connect/payoutQualification.d.ts.map +1 -1
- package/dist/client/connect/payoutQualification.js +39 -20
- package/dist/client/connect/payoutQualification.js.map +1 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +14 -4
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutWorker.d.ts.map +1 -1
- package/dist/client/connect/payoutWorker.js +4 -1
- package/dist/client/connect/payoutWorker.js.map +1 -1
- package/dist/client/costRecovery.d.ts +5 -0
- package/dist/client/costRecovery.d.ts.map +1 -1
- package/dist/client/costRecovery.js +5 -0
- package/dist/client/costRecovery.js.map +1 -1
- package/dist/client/payoutPolicy.d.ts +4 -0
- package/dist/client/payoutPolicy.d.ts.map +1 -1
- package/dist/component/_generated/component.d.ts +175 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/costRecovery/mutations.js +1 -1
- package/dist/component/costRecovery/queries.d.ts +9 -0
- package/dist/component/costRecovery/queries.d.ts.map +1 -1
- package/dist/component/costRecovery/queries.js +20 -0
- package/dist/component/costRecovery/queries.js.map +1 -1
- package/dist/component/earnings/triggers.d.ts +16 -6
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/payoutRelease/adoption.d.ts +6 -0
- package/dist/component/payoutRelease/adoption.d.ts.map +1 -1
- package/dist/component/payoutRelease/helpers.d.ts +4 -1
- package/dist/component/payoutRelease/helpers.d.ts.map +1 -1
- package/dist/component/payoutRelease/helpers.js +18 -10
- package/dist/component/payoutRelease/helpers.js.map +1 -1
- package/dist/component/payoutRelease/mutations.d.ts +20 -0
- package/dist/component/payoutRelease/mutations.d.ts.map +1 -1
- package/dist/component/payoutRelease/mutations.js +14 -2
- package/dist/component/payoutRelease/mutations.js.map +1 -1
- package/dist/component/payoutRelease/planning.d.ts +4 -0
- package/dist/component/payoutRelease/planning.d.ts.map +1 -1
- package/dist/component/payoutRelease/planning.js +4 -2
- package/dist/component/payoutRelease/planning.js.map +1 -1
- package/dist/component/payoutRelease/preview.d.ts +2 -0
- package/dist/component/payoutRelease/preview.d.ts.map +1 -1
- package/dist/component/payoutRelease/preview.js +5 -1
- package/dist/component/payoutRelease/preview.js.map +1 -1
- package/dist/component/payoutRelease/queries.d.ts +11 -0
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/payoutRelease/schema.d.ts +17 -2
- package/dist/component/payoutRelease/schema.d.ts.map +1 -1
- package/dist/component/payoutRelease/schema.js +3 -0
- package/dist/component/payoutRelease/schema.js.map +1 -1
- package/dist/component/payoutSnapshots/financial.d.ts +35 -0
- package/dist/component/payoutSnapshots/financial.d.ts.map +1 -0
- package/dist/component/payoutSnapshots/financial.js +89 -0
- package/dist/component/payoutSnapshots/financial.js.map +1 -0
- package/dist/component/payoutSnapshots/liabilities.d.ts +7 -0
- package/dist/component/payoutSnapshots/liabilities.d.ts.map +1 -0
- package/dist/component/payoutSnapshots/liabilities.js +18 -0
- package/dist/component/payoutSnapshots/liabilities.js.map +1 -0
- package/dist/component/payoutSnapshots/localState.d.ts +2 -0
- package/dist/component/payoutSnapshots/localState.d.ts.map +1 -1
- package/dist/component/payoutSnapshots/localState.js +6 -3
- package/dist/component/payoutSnapshots/localState.js.map +1 -1
- package/dist/component/payoutSnapshots/mutations.d.ts +6 -0
- package/dist/component/payoutSnapshots/mutations.d.ts.map +1 -1
- package/dist/component/payoutSnapshots/mutations.js +2 -0
- package/dist/component/payoutSnapshots/mutations.js.map +1 -1
- package/dist/component/payoutSnapshots/queries.d.ts +133 -0
- package/dist/component/payoutSnapshots/queries.d.ts.map +1 -0
- package/dist/component/payoutSnapshots/queries.js +84 -0
- package/dist/component/payoutSnapshots/queries.js.map +1 -0
- package/dist/component/payoutSnapshots/revisions.d.ts.map +1 -1
- package/dist/component/payoutSnapshots/revisions.js +19 -0
- package/dist/component/payoutSnapshots/revisions.js.map +1 -1
- package/dist/component/payoutSnapshots/schema.d.ts +15 -5
- package/dist/component/payoutSnapshots/schema.d.ts.map +1 -1
- package/dist/component/payoutSnapshots/schema.js +3 -1
- package/dist/component/payoutSnapshots/schema.js.map +1 -1
- package/dist/component/payoutWorker/mutations.d.ts.map +1 -1
- package/dist/component/payoutWorker/mutations.js +3 -1
- package/dist/component/payoutWorker/mutations.js.map +1 -1
- package/dist/component/schema.d.ts +14 -4
- package/dist/react/workflows/payout-attempt-state.d.ts.map +1 -1
- package/dist/react/workflows/payout-attempt-state.js +3 -0
- package/dist/react/workflows/payout-attempt-state.js.map +1 -1
- package/dist/react/workflows/payout-progress-state.d.ts.map +1 -1
- package/dist/react/workflows/payout-progress-state.js +3 -0
- package/dist/react/workflows/payout-progress-state.js.map +1 -1
- package/docs/settlement.md +84 -17
- package/package.json +1 -1
- package/src/client/connect/payoutCollectedInput.ts +120 -0
- package/src/client/connect/payoutExecution.ts +116 -84
- package/src/client/connect/payoutExecutionTestHelpers.ts +19 -6
- package/src/client/connect/payoutLargeHistory.test.ts +222 -0
- package/src/client/connect/payoutLiabilityVersion.test.ts +221 -0
- package/src/client/connect/payoutPreview.ts +43 -23
- package/src/client/connect/payoutQualification.ts +69 -22
- package/src/client/connect/payoutQualificationFreshness.test.ts +192 -0
- package/src/client/connect/payoutWorker.ts +4 -1
- package/src/client/costRecovery.ts +8 -0
- package/src/component/_generated/api.ts +6 -0
- package/src/component/_generated/component.ts +203 -0
- package/src/component/costRecovery/mutations.ts +1 -1
- package/src/component/costRecovery/queries.ts +21 -0
- package/src/component/payoutRelease/helpers.ts +21 -11
- package/src/component/payoutRelease/mutations.ts +25 -2
- package/src/component/payoutRelease/planning.ts +8 -1
- package/src/component/payoutRelease/preview.ts +5 -1
- package/src/component/payoutRelease/schema.ts +3 -0
- package/src/component/payoutSnapshots/financial.ts +121 -0
- package/src/component/payoutSnapshots/liabilities.ts +25 -0
- package/src/component/payoutSnapshots/localState.ts +7 -3
- package/src/component/payoutSnapshots/mutations.ts +2 -0
- package/src/component/payoutSnapshots/queries.ts +102 -0
- package/src/component/payoutSnapshots/revisions.ts +26 -0
- package/src/component/payoutSnapshots/schema.ts +3 -0
- package/src/component/payoutWorker/mutations.ts +3 -1
- package/src/react/workflows/payout-attempt-state.ts +6 -0
- package/src/react/workflows/payout-progress-state.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -26,6 +26,18 @@
|
|
|
26
26
|
- Remove internal tracker references from public documentation and add a
|
|
27
27
|
regression check that prevents their reintroduction.
|
|
28
28
|
|
|
29
|
+
## [0.29.0](https://github.com/FantasticDevHQ/better-stripe/compare/v0.28.6...v0.29.0) (2026-10-15)
|
|
30
|
+
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
- **payouts:** bind complete history and version recovery liabilities ([#222](https://github.com/FantasticDevHQ/better-stripe/issues/222)) ([65ee1e0](https://github.com/FantasticDevHQ/better-stripe/commit/65ee1e034309d687df9eb989d97437b87f607537))
|
|
34
|
+
|
|
35
|
+
## [0.28.6](https://github.com/FantasticDevHQ/better-stripe/compare/v0.28.5...v0.28.6) (2026-10-15)
|
|
36
|
+
|
|
37
|
+
### Bug Fixes
|
|
38
|
+
|
|
39
|
+
- **payouts:** renew verified source freshness per currency ([#220](https://github.com/FantasticDevHQ/better-stripe/issues/220)) ([2ef7b09](https://github.com/FantasticDevHQ/better-stripe/commit/2ef7b0909662db76a4f3692b0eab3923bcd3b48c))
|
|
40
|
+
|
|
29
41
|
## [0.28.5](https://github.com/FantasticDevHQ/better-stripe/compare/v0.28.4...v0.28.5) (2026-10-15)
|
|
30
42
|
|
|
31
43
|
### Bug Fixes
|
package/MIGRATION.md
CHANGED
|
@@ -198,3 +198,9 @@ A cancellation timestamp at another date is not classified as period-end cancell
|
|
|
198
198
|
See the [read contract guide](docs/read-contracts.md) for reactive product, price and payout
|
|
199
199
|
cursors, exact currency summaries, legacy backfill, payout failure details, and
|
|
200
200
|
published-version adoption requirements.
|
|
201
|
+
|
|
202
|
+
## Versioned payout recovery quotes
|
|
203
|
+
|
|
204
|
+
Hosts with component recovery balance records must now pass `stripe.costRecovery.payoutQuote(ctx, authorizedScope)` into payout preview/release/worker options. Pass the returned `independentLiabilities` and `liabilityRevision` together for the same authorized account/currency/scope. Calls without a required version fail safely; accounts without recovery records retain the unversioned path. The example adapters are updated. Additional host-owned liabilities still require host authorization and consistency guards; the component version does not cover external databases.
|
|
205
|
+
|
|
206
|
+
Do not backfill old attempted claims with guessed quotes. Reconcile their existing request, or replay an unattempted operation to cancel its exact reservations, then use a new operation and fresh quote. Obsolete read-only collection fingerprints can be discarded and recollected; financially bound or unresolved claim state must remain intact.
|
package/README.md
CHANGED
|
@@ -70,7 +70,7 @@ claim execution are completed.
|
|
|
70
70
|
|
|
71
71
|
## Status
|
|
72
72
|
|
|
73
|
-
**Version**: `0.
|
|
73
|
+
**Version**: `0.29.0` <!-- x-release-please-version --> (pre-1.0). API may change between minor versions until 1.0.
|
|
74
74
|
|
|
75
75
|
Used in production by its authors. Webhook pipeline is covered by unit tests and a live E2E harness (`npm run e2e:webhooks`) that fires real Stripe-signed events and asserts the ledger.
|
|
76
76
|
|
|
@@ -1740,3 +1740,9 @@ Custom recipient payout minimums are waived during the final day before the veri
|
|
|
1740
1740
|
Holding-expiry recovery remains visible and retryable after schedule restoration. The package preserves unresolved provider balances and payout claims, and prevents reset or custom reactivation from erasing them. See [expiry recovery](docs/settlement.md) for operator handling.
|
|
1741
1741
|
|
|
1742
1742
|
Automatic payout status is reusable through `payoutAttemptStatus`, `payoutAttemptValidator`, and the React `PayoutAttemptStatus` workflow. Rejection reasons and retry times remain separate from eligibility previews and bank arrival dates. See [React workflow guidance](docs/react-workflows.md).
|
|
1743
|
+
|
|
1744
|
+
Payout qualification renews source verification for the selected currency only after a complete matching provider-history check. Slower receipt scans retain the same freshness and local reservation safeguards; partial or changed history stays held. See [settlement guidance](docs/settlement.md).
|
|
1745
|
+
|
|
1746
|
+
Automatic combined payouts use a complete paginated ledger collection above 100 historical sources or claims. The collection is checked and bound to the immutable claim before Stripe is contacted; incomplete scans resume without authorizing money. See [settlement guidance](docs/settlement.md#resumable-local-collections).
|
|
1747
|
+
|
|
1748
|
+
Resolve recovery-backed payout liabilities with `stripe.costRecovery.payoutQuote(ctx, authorizedScope)` and pass its amount/version together to preview or automatic release. The example does this for seller refund/dispute costs; stale or missing required versions fail safely. See [versioned liability guidance](docs/settlement.md#versioned-recovery-liabilities).
|
|
@@ -59,13 +59,13 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
59
59
|
payoutRiskEvents: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
60
60
|
accountId: string;
|
|
61
61
|
key: string;
|
|
62
|
-
kind: "allocation" | "claim" | "fee" | "provider_payout" | "transfer";
|
|
62
|
+
kind: "allocation" | "claim" | "fee" | "liability" | "provider_payout" | "transfer";
|
|
63
63
|
removed?: boolean | undefined;
|
|
64
64
|
riskRevision: number;
|
|
65
65
|
}, {
|
|
66
66
|
accountId: import("convex/values").VString<string, "required">;
|
|
67
67
|
riskRevision: import("convex/values").VFloat64<number, "required">;
|
|
68
|
-
kind: import("convex/values").VUnion<"allocation" | "claim" | "fee" | "provider_payout" | "transfer", [import("convex/values").VLiteral<"transfer", "required">, import("convex/values").VLiteral<"provider_payout", "required">, import("convex/values").VLiteral<"allocation", "required">, import("convex/values").VLiteral<"claim", "required">, import("convex/values").VLiteral<"fee", "required">], "required", never>;
|
|
68
|
+
kind: import("convex/values").VUnion<"allocation" | "claim" | "fee" | "liability" | "provider_payout" | "transfer", [import("convex/values").VLiteral<"transfer", "required">, import("convex/values").VLiteral<"provider_payout", "required">, import("convex/values").VLiteral<"allocation", "required">, import("convex/values").VLiteral<"claim", "required">, import("convex/values").VLiteral<"fee", "required">, import("convex/values").VLiteral<"liability", "required">], "required", never>;
|
|
69
69
|
key: import("convex/values").VString<string, "required">;
|
|
70
70
|
removed: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
71
71
|
}, "required", "accountId" | "key" | "kind" | "removed" | "riskRevision">, {
|
|
@@ -84,6 +84,8 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
84
84
|
accountId: string;
|
|
85
85
|
allocationCount: number;
|
|
86
86
|
allocationCursor?: string | undefined;
|
|
87
|
+
boundOperationKey?: string | undefined;
|
|
88
|
+
boundRiskRevision?: number | undefined;
|
|
87
89
|
claimCount: number;
|
|
88
90
|
claimCursor?: string | undefined;
|
|
89
91
|
deferredPositiveChanges: boolean;
|
|
@@ -109,6 +111,8 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
109
111
|
step: number;
|
|
110
112
|
}, {
|
|
111
113
|
readOnly: import("convex/values").VBoolean<boolean, "required">;
|
|
114
|
+
boundOperationKey: import("convex/values").VString<string | undefined, "optional">;
|
|
115
|
+
boundRiskRevision: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
112
116
|
accountId: import("convex/values").VString<string, "required">;
|
|
113
117
|
ownerKey: import("convex/values").VString<string, "required">;
|
|
114
118
|
operationKey: import("convex/values").VString<string, "required">;
|
|
@@ -134,7 +138,7 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
134
138
|
providerChanged: import("convex/values").VBoolean<boolean, "required">;
|
|
135
139
|
expiresAt: import("convex/values").VFloat64<number, "required">;
|
|
136
140
|
reason: import("convex/values").VString<string | undefined, "optional">;
|
|
137
|
-
}, "required", "accountId" | "allocationCount" | "allocationCursor" | "claimCount" | "claimCursor" | "deferredPositiveChanges" | "expectedRevision" | "expiresAt" | "feeCount" | "feeCursor" | "initialRevision" | "initialRiskRevision" | "observedRevision" | "operationKey" | "ownerKey" | "phase" | "policyMode" | "policyOperationKey" | "providerChanged" | "readOnly" | "reason" | "riskRevision" | "sourceCount" | "sourceCursor" | "sourceFence" | "step">, {
|
|
141
|
+
}, "required", "accountId" | "allocationCount" | "allocationCursor" | "boundOperationKey" | "boundRiskRevision" | "claimCount" | "claimCursor" | "deferredPositiveChanges" | "expectedRevision" | "expiresAt" | "feeCount" | "feeCursor" | "initialRevision" | "initialRiskRevision" | "observedRevision" | "operationKey" | "ownerKey" | "phase" | "policyMode" | "policyOperationKey" | "providerChanged" | "readOnly" | "reason" | "riskRevision" | "sourceCount" | "sourceCursor" | "sourceFence" | "step">, {
|
|
138
142
|
by_account_phase: ["accountId", "phase", "_creationTime"];
|
|
139
143
|
by_operation: ["operationKey", "_creationTime"];
|
|
140
144
|
by_read_only: ["readOnly", "_creationTime"];
|
|
@@ -508,6 +512,8 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
508
512
|
expectedRevision: number;
|
|
509
513
|
feeRevision?: number | undefined;
|
|
510
514
|
historical?: boolean | undefined;
|
|
515
|
+
independentLiabilities?: number | undefined;
|
|
516
|
+
liabilityRevision?: number | undefined;
|
|
511
517
|
observations: {
|
|
512
518
|
currency: string;
|
|
513
519
|
ledgerFingerprint: string;
|
|
@@ -525,12 +531,16 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
525
531
|
requestId: string;
|
|
526
532
|
} | undefined;
|
|
527
533
|
returnTransactionId?: string | undefined;
|
|
534
|
+
snapshotId?: import("convex/values").GenericId<"payoutSnapshots"> | undefined;
|
|
528
535
|
status: "canceled" | "paid" | "rejected" | "reserved" | "returned" | "submitted";
|
|
529
536
|
stripePayoutId?: string | undefined;
|
|
530
537
|
}, {
|
|
531
538
|
accountId: import("convex/values").VString<string, "required">;
|
|
532
539
|
ownerKey: import("convex/values").VString<string, "required">;
|
|
533
540
|
historical: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
541
|
+
snapshotId: import("convex/values").VId<import("convex/values").GenericId<"payoutSnapshots"> | undefined, "optional">;
|
|
542
|
+
liabilityRevision: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
543
|
+
independentLiabilities: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
534
544
|
operationKey: import("convex/values").VString<string, "required">;
|
|
535
545
|
expectedRevision: import("convex/values").VFloat64<number, "required">;
|
|
536
546
|
currency: import("convex/values").VString<string, "required">;
|
|
@@ -589,7 +599,7 @@ export declare function setup(amounts?: number[], currency?: string): Promise<{
|
|
|
589
599
|
requestId: import("convex/values").VString<string, "required">;
|
|
590
600
|
code: import("convex/values").VUnion<"amount_too_small" | "balance_insufficient", [import("convex/values").VLiteral<"balance_insufficient", "required">, import("convex/values").VLiteral<"amount_too_small", "required">], "required", never>;
|
|
591
601
|
}, "optional", "code" | "requestId">;
|
|
592
|
-
}, "required", "accountId" | "allocations" | "amount" | "attemptedAt" | "currency" | "debitFee" | "debitTransactionId" | "destinationId" | "expectedRevision" | "feeRevision" | "historical" | "observations" | "operationKey" | "ownerKey" | "providerFee" | "rejection" | "rejection.code" | "rejection.requestId" | "returnTransactionId" | "status" | "stripePayoutId">, {
|
|
602
|
+
}, "required", "accountId" | "allocations" | "amount" | "attemptedAt" | "currency" | "debitFee" | "debitTransactionId" | "destinationId" | "expectedRevision" | "feeRevision" | "historical" | "independentLiabilities" | "liabilityRevision" | "observations" | "operationKey" | "ownerKey" | "providerFee" | "rejection" | "rejection.code" | "rejection.requestId" | "returnTransactionId" | "snapshotId" | "status" | "stripePayoutId">, {
|
|
593
603
|
by_account_status: ["accountId", "status", "_creationTime"];
|
|
594
604
|
by_debit_receipt: ["debitTransactionId", "_creationTime"];
|
|
595
605
|
by_operation: ["operationKey", "_creationTime"];
|
|
@@ -1903,13 +1913,13 @@ export declare function historical(currency?: string): Promise<{
|
|
|
1903
1913
|
payoutRiskEvents: import("convex/server").TableDefinition<import("convex/values").VObject<{
|
|
1904
1914
|
accountId: string;
|
|
1905
1915
|
key: string;
|
|
1906
|
-
kind: "allocation" | "claim" | "fee" | "provider_payout" | "transfer";
|
|
1916
|
+
kind: "allocation" | "claim" | "fee" | "liability" | "provider_payout" | "transfer";
|
|
1907
1917
|
removed?: boolean | undefined;
|
|
1908
1918
|
riskRevision: number;
|
|
1909
1919
|
}, {
|
|
1910
1920
|
accountId: import("convex/values").VString<string, "required">;
|
|
1911
1921
|
riskRevision: import("convex/values").VFloat64<number, "required">;
|
|
1912
|
-
kind: import("convex/values").VUnion<"allocation" | "claim" | "fee" | "provider_payout" | "transfer", [import("convex/values").VLiteral<"transfer", "required">, import("convex/values").VLiteral<"provider_payout", "required">, import("convex/values").VLiteral<"allocation", "required">, import("convex/values").VLiteral<"claim", "required">, import("convex/values").VLiteral<"fee", "required">], "required", never>;
|
|
1922
|
+
kind: import("convex/values").VUnion<"allocation" | "claim" | "fee" | "liability" | "provider_payout" | "transfer", [import("convex/values").VLiteral<"transfer", "required">, import("convex/values").VLiteral<"provider_payout", "required">, import("convex/values").VLiteral<"allocation", "required">, import("convex/values").VLiteral<"claim", "required">, import("convex/values").VLiteral<"fee", "required">, import("convex/values").VLiteral<"liability", "required">], "required", never>;
|
|
1913
1923
|
key: import("convex/values").VString<string, "required">;
|
|
1914
1924
|
removed: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
1915
1925
|
}, "required", "accountId" | "key" | "kind" | "removed" | "riskRevision">, {
|
|
@@ -1928,6 +1938,8 @@ export declare function historical(currency?: string): Promise<{
|
|
|
1928
1938
|
accountId: string;
|
|
1929
1939
|
allocationCount: number;
|
|
1930
1940
|
allocationCursor?: string | undefined;
|
|
1941
|
+
boundOperationKey?: string | undefined;
|
|
1942
|
+
boundRiskRevision?: number | undefined;
|
|
1931
1943
|
claimCount: number;
|
|
1932
1944
|
claimCursor?: string | undefined;
|
|
1933
1945
|
deferredPositiveChanges: boolean;
|
|
@@ -1953,6 +1965,8 @@ export declare function historical(currency?: string): Promise<{
|
|
|
1953
1965
|
step: number;
|
|
1954
1966
|
}, {
|
|
1955
1967
|
readOnly: import("convex/values").VBoolean<boolean, "required">;
|
|
1968
|
+
boundOperationKey: import("convex/values").VString<string | undefined, "optional">;
|
|
1969
|
+
boundRiskRevision: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
1956
1970
|
accountId: import("convex/values").VString<string, "required">;
|
|
1957
1971
|
ownerKey: import("convex/values").VString<string, "required">;
|
|
1958
1972
|
operationKey: import("convex/values").VString<string, "required">;
|
|
@@ -1978,7 +1992,7 @@ export declare function historical(currency?: string): Promise<{
|
|
|
1978
1992
|
providerChanged: import("convex/values").VBoolean<boolean, "required">;
|
|
1979
1993
|
expiresAt: import("convex/values").VFloat64<number, "required">;
|
|
1980
1994
|
reason: import("convex/values").VString<string | undefined, "optional">;
|
|
1981
|
-
}, "required", "accountId" | "allocationCount" | "allocationCursor" | "claimCount" | "claimCursor" | "deferredPositiveChanges" | "expectedRevision" | "expiresAt" | "feeCount" | "feeCursor" | "initialRevision" | "initialRiskRevision" | "observedRevision" | "operationKey" | "ownerKey" | "phase" | "policyMode" | "policyOperationKey" | "providerChanged" | "readOnly" | "reason" | "riskRevision" | "sourceCount" | "sourceCursor" | "sourceFence" | "step">, {
|
|
1995
|
+
}, "required", "accountId" | "allocationCount" | "allocationCursor" | "boundOperationKey" | "boundRiskRevision" | "claimCount" | "claimCursor" | "deferredPositiveChanges" | "expectedRevision" | "expiresAt" | "feeCount" | "feeCursor" | "initialRevision" | "initialRiskRevision" | "observedRevision" | "operationKey" | "ownerKey" | "phase" | "policyMode" | "policyOperationKey" | "providerChanged" | "readOnly" | "reason" | "riskRevision" | "sourceCount" | "sourceCursor" | "sourceFence" | "step">, {
|
|
1982
1996
|
by_account_phase: ["accountId", "phase", "_creationTime"];
|
|
1983
1997
|
by_operation: ["operationKey", "_creationTime"];
|
|
1984
1998
|
by_read_only: ["readOnly", "_creationTime"];
|
|
@@ -2352,6 +2366,8 @@ export declare function historical(currency?: string): Promise<{
|
|
|
2352
2366
|
expectedRevision: number;
|
|
2353
2367
|
feeRevision?: number | undefined;
|
|
2354
2368
|
historical?: boolean | undefined;
|
|
2369
|
+
independentLiabilities?: number | undefined;
|
|
2370
|
+
liabilityRevision?: number | undefined;
|
|
2355
2371
|
observations: {
|
|
2356
2372
|
currency: string;
|
|
2357
2373
|
ledgerFingerprint: string;
|
|
@@ -2369,12 +2385,16 @@ export declare function historical(currency?: string): Promise<{
|
|
|
2369
2385
|
requestId: string;
|
|
2370
2386
|
} | undefined;
|
|
2371
2387
|
returnTransactionId?: string | undefined;
|
|
2388
|
+
snapshotId?: import("convex/values").GenericId<"payoutSnapshots"> | undefined;
|
|
2372
2389
|
status: "canceled" | "paid" | "rejected" | "reserved" | "returned" | "submitted";
|
|
2373
2390
|
stripePayoutId?: string | undefined;
|
|
2374
2391
|
}, {
|
|
2375
2392
|
accountId: import("convex/values").VString<string, "required">;
|
|
2376
2393
|
ownerKey: import("convex/values").VString<string, "required">;
|
|
2377
2394
|
historical: import("convex/values").VBoolean<boolean | undefined, "optional">;
|
|
2395
|
+
snapshotId: import("convex/values").VId<import("convex/values").GenericId<"payoutSnapshots"> | undefined, "optional">;
|
|
2396
|
+
liabilityRevision: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
2397
|
+
independentLiabilities: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
2378
2398
|
operationKey: import("convex/values").VString<string, "required">;
|
|
2379
2399
|
expectedRevision: import("convex/values").VFloat64<number, "required">;
|
|
2380
2400
|
currency: import("convex/values").VString<string, "required">;
|
|
@@ -2433,7 +2453,7 @@ export declare function historical(currency?: string): Promise<{
|
|
|
2433
2453
|
requestId: import("convex/values").VString<string, "required">;
|
|
2434
2454
|
code: import("convex/values").VUnion<"amount_too_small" | "balance_insufficient", [import("convex/values").VLiteral<"balance_insufficient", "required">, import("convex/values").VLiteral<"amount_too_small", "required">], "required", never>;
|
|
2435
2455
|
}, "optional", "code" | "requestId">;
|
|
2436
|
-
}, "required", "accountId" | "allocations" | "amount" | "attemptedAt" | "currency" | "debitFee" | "debitTransactionId" | "destinationId" | "expectedRevision" | "feeRevision" | "historical" | "observations" | "operationKey" | "ownerKey" | "providerFee" | "rejection" | "rejection.code" | "rejection.requestId" | "returnTransactionId" | "status" | "stripePayoutId">, {
|
|
2456
|
+
}, "required", "accountId" | "allocations" | "amount" | "attemptedAt" | "currency" | "debitFee" | "debitTransactionId" | "destinationId" | "expectedRevision" | "feeRevision" | "historical" | "independentLiabilities" | "liabilityRevision" | "observations" | "operationKey" | "ownerKey" | "providerFee" | "rejection" | "rejection.code" | "rejection.requestId" | "returnTransactionId" | "snapshotId" | "status" | "stripePayoutId">, {
|
|
2437
2457
|
by_account_status: ["accountId", "status", "_creationTime"];
|
|
2438
2458
|
by_debit_receipt: ["debitTransactionId", "_creationTime"];
|
|
2439
2459
|
by_operation: ["operationKey", "_creationTime"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payoutAdoptionTestHelpers.d.ts","sourceRoot":"","sources":["../../../src/client/connect/payoutAdoptionTestHelp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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YArJ3C,oBAAoB;;;;;;;;;;;YAapB,QAAQ,6BAAmB,MAAM;;;;;;;;;YAYjC,aAAa;;;;;;YAGb,QAAQ,6BAAmB,MAAM;;;;;;;;;;;YAcjC,IAAI,iCAAuB;gBAAE,MAAM,CAAC,EAAE,MAAM,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,CAAA;aAAE;;;;;;;;;;;;;;;;YAM9D,QAAQ,6BAAmB,MAAM;;;;;;;;;;;;;;;YAKjC,QAAQ;;;;;wBAQA,IAAI;;;;;;;YAUZ,IAAI;;;;YAIJ,QAAQ,8BAAoB,MAAM;YAGlC,MAAM,iCACW;gBACb,MAAM,EAAE,MAAM,CAAC;gBACf,QAAQ,EAAE,MAAM,CAAC;gBACjB,QAAQ,EAAE,MAAM,CAAC;aAClB;;;;gBA2CG,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDrB"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { Infer } from "convex/values";
|
|
2
|
+
import type { Component, RunCtx } from "../helpers.js";
|
|
3
|
+
import type { snapshotDoc } from "../../component/payoutSnapshots/schema.js";
|
|
4
|
+
import type { transferDocValidator } from "../../component/connect/validators.js";
|
|
5
|
+
import type { claimDoc } from "../../component/payoutRelease/schema.js";
|
|
6
|
+
export type CollectionRef = {
|
|
7
|
+
accountId: string;
|
|
8
|
+
ownerKey: string;
|
|
9
|
+
operationKey: string;
|
|
10
|
+
snapshotId: Infer<typeof snapshotDoc>["_id"];
|
|
11
|
+
};
|
|
12
|
+
export type PayoutInput = {
|
|
13
|
+
status: "ready";
|
|
14
|
+
transfers: Infer<typeof transferDocValidator>[];
|
|
15
|
+
claims: Infer<typeof claimDoc>[];
|
|
16
|
+
};
|
|
17
|
+
export declare function collectLargePayoutInput(component: Component, ctx: RunCtx, opts: {
|
|
18
|
+
accountId: string;
|
|
19
|
+
ownerKey: string;
|
|
20
|
+
operationKey?: string;
|
|
21
|
+
}, maxPages: number): Promise<{
|
|
22
|
+
status: "held";
|
|
23
|
+
reason: string;
|
|
24
|
+
transfers?: undefined;
|
|
25
|
+
claims?: undefined;
|
|
26
|
+
collection?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
status: "held";
|
|
29
|
+
reason: string;
|
|
30
|
+
collection: {
|
|
31
|
+
accountId: string;
|
|
32
|
+
ownerKey: string;
|
|
33
|
+
operationKey: string;
|
|
34
|
+
snapshotId: import("convex/values").GenericId<"payoutSnapshots">;
|
|
35
|
+
};
|
|
36
|
+
transfers?: undefined;
|
|
37
|
+
claims?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
reason?: undefined;
|
|
40
|
+
status: "ready";
|
|
41
|
+
transfers: {
|
|
42
|
+
_creationTime: number;
|
|
43
|
+
_id: import("convex/values").GenericId<"transfers">;
|
|
44
|
+
amount: number;
|
|
45
|
+
currency: string;
|
|
46
|
+
destinationAccountId: string;
|
|
47
|
+
metadata?: any;
|
|
48
|
+
paymentId?: string | undefined;
|
|
49
|
+
reinstatement?: boolean | undefined;
|
|
50
|
+
reversalClaimedAmount?: number | undefined;
|
|
51
|
+
reversalStatus?: "fully_reversed" | "partially_reversed" | undefined;
|
|
52
|
+
reversedAmount?: number | undefined;
|
|
53
|
+
role?: "affiliate" | "other" | "store" | undefined;
|
|
54
|
+
sourceChargeId?: string | undefined;
|
|
55
|
+
sourceInvoiceId?: string | undefined;
|
|
56
|
+
status: "failed" | "paid" | "pending" | "reversed";
|
|
57
|
+
stripeTransferId: string;
|
|
58
|
+
totalsRecorded?: true | undefined;
|
|
59
|
+
}[];
|
|
60
|
+
claims: {
|
|
61
|
+
_creationTime: number;
|
|
62
|
+
_id: import("convex/values").GenericId<"payoutReleaseClaims">;
|
|
63
|
+
accountId: string;
|
|
64
|
+
allocations: {
|
|
65
|
+
amount: number;
|
|
66
|
+
role?: "affiliate" | "other" | "store" | undefined;
|
|
67
|
+
stripeTransferId: string;
|
|
68
|
+
}[];
|
|
69
|
+
amount: number;
|
|
70
|
+
attemptedAt?: number | undefined;
|
|
71
|
+
currency: string;
|
|
72
|
+
debitFee?: number | undefined;
|
|
73
|
+
debitTransactionId?: string | undefined;
|
|
74
|
+
destinationId?: string | undefined;
|
|
75
|
+
expectedRevision: number;
|
|
76
|
+
feeRevision?: number | undefined;
|
|
77
|
+
historical?: boolean | undefined;
|
|
78
|
+
independentLiabilities?: number | undefined;
|
|
79
|
+
liabilityRevision?: number | undefined;
|
|
80
|
+
observations: {
|
|
81
|
+
currency: string;
|
|
82
|
+
ledgerFingerprint: string;
|
|
83
|
+
matureNet: number;
|
|
84
|
+
observedAt: number;
|
|
85
|
+
pendingCredits: number;
|
|
86
|
+
stripeTransferId: string;
|
|
87
|
+
transactionIds: string[];
|
|
88
|
+
}[];
|
|
89
|
+
operationKey: string;
|
|
90
|
+
ownerKey: string;
|
|
91
|
+
providerFee?: number | undefined;
|
|
92
|
+
rejection?: {
|
|
93
|
+
code: "amount_too_small" | "balance_insufficient";
|
|
94
|
+
requestId: string;
|
|
95
|
+
} | undefined;
|
|
96
|
+
returnTransactionId?: string | undefined;
|
|
97
|
+
snapshotId?: import("convex/values").GenericId<"payoutSnapshots"> | undefined;
|
|
98
|
+
status: "canceled" | "paid" | "rejected" | "reserved" | "returned" | "submitted";
|
|
99
|
+
stripePayoutId?: string | undefined;
|
|
100
|
+
}[];
|
|
101
|
+
collection: {
|
|
102
|
+
accountId: string;
|
|
103
|
+
ownerKey: string;
|
|
104
|
+
operationKey: string;
|
|
105
|
+
snapshotId: import("convex/values").GenericId<"payoutSnapshots">;
|
|
106
|
+
};
|
|
107
|
+
}>;
|
|
108
|
+
/** Bound unattempted claims retain their cache. Attempted/terminal claims keep their own immutable financial proof. */
|
|
109
|
+
export declare function discardQualificationInput(component: Component, ctx: RunCtx, collection?: CollectionRef, keep?: boolean): Promise<void>;
|
|
110
|
+
//# sourceMappingURL=payoutCollectedInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payoutCollectedInput.d.ts","sourceRoot":"","sources":["../../../src/client/connect/payoutCollectedInput.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yCAAyC,CAAC;AAMxE,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC;CAC9C,CAAC;AACF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC,OAAO,oBAAoB,CAAC,EAAE,CAAC;IAChD,MAAM,EAAE,KAAK,CAAC,OAAO,QAAQ,CAAC,EAAE,CAAC;CAClC,CAAC;AACF,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACpE,QAAQ,EAAE,MAAM;YAGG,MAAM;;;;;;YA2Bb,MAAM;;;;;;;;;;;;YAiCR,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQlB;AACD,uHAAuH;AACvH,wBAAsB,yBAAyB,CAC7C,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,MAAM,EACX,UAAU,CAAC,EAAE,aAAa,EAC1B,IAAI,UAAQ,iBAiBb"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { componentRef } from "../webhooks/helpers.js";
|
|
2
|
+
import { collectPayoutSnapshot, discardPayoutSnapshot, } from "./payoutCollection.js";
|
|
3
|
+
export async function collectLargePayoutInput(component, ctx, opts, maxPages) {
|
|
4
|
+
if (!ctx.runMutation)
|
|
5
|
+
return { status: "held", reason: "collection_requires_action" };
|
|
6
|
+
const policy = (await ctx.runQuery(componentRef(component, "payoutPolicy/queries/get"), { accountId: opts.accountId, ownerKey: opts.ownerKey }));
|
|
7
|
+
const scope = {
|
|
8
|
+
accountId: opts.accountId,
|
|
9
|
+
ownerKey: opts.ownerKey,
|
|
10
|
+
operationKey: opts.operationKey ?? crypto.randomUUID(),
|
|
11
|
+
};
|
|
12
|
+
let h = await collectPayoutSnapshot(component, ctx, {
|
|
13
|
+
...scope,
|
|
14
|
+
expectedRevision: policy?.revision ?? -1,
|
|
15
|
+
});
|
|
16
|
+
for (let i = 0; i < maxPages * 25 && h.phase !== "local_ready" && h.phase !== "invalidated"; i++)
|
|
17
|
+
h = await collectPayoutSnapshot(component, ctx, {
|
|
18
|
+
...scope,
|
|
19
|
+
expectedRevision: h.expectedRevision,
|
|
20
|
+
expectedStep: h.step,
|
|
21
|
+
});
|
|
22
|
+
const collection = { ...scope, snapshotId: h._id };
|
|
23
|
+
if (h.phase !== "local_ready")
|
|
24
|
+
return {
|
|
25
|
+
status: "held",
|
|
26
|
+
reason: h.phase === "invalidated"
|
|
27
|
+
? "collection_invalidated"
|
|
28
|
+
: "collection_pending",
|
|
29
|
+
collection,
|
|
30
|
+
};
|
|
31
|
+
async function pages(kind, count) {
|
|
32
|
+
const rows = [];
|
|
33
|
+
let cursor = null;
|
|
34
|
+
for (let i = 0; i <= Math.ceil(count / 25); i++) {
|
|
35
|
+
const page = (await ctx.runQuery(componentRef(component, `payoutSnapshots/queries/${kind}`), { ...scope, paginationOpts: { cursor, numItems: 25 } }));
|
|
36
|
+
rows.push(...page.page);
|
|
37
|
+
if (page.isDone) {
|
|
38
|
+
if (rows.length !== count)
|
|
39
|
+
throw new Error("Collected payout membership changed.");
|
|
40
|
+
return rows;
|
|
41
|
+
}
|
|
42
|
+
if (!page.continueCursor || page.continueCursor === cursor)
|
|
43
|
+
throw new Error("Collected payout cursor did not advance.");
|
|
44
|
+
cursor = page.continueCursor;
|
|
45
|
+
}
|
|
46
|
+
throw new Error("Collected payout page budget exhausted; preserve collection for retry.");
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
status: "ready",
|
|
50
|
+
transfers: await pages("sources", h.sourceCount),
|
|
51
|
+
claims: await pages("claims", h.claimCount),
|
|
52
|
+
collection,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/** Bound unattempted claims retain their cache. Attempted/terminal claims keep their own immutable financial proof. */
|
|
56
|
+
export async function discardQualificationInput(component, ctx, collection, keep = false) {
|
|
57
|
+
if (!collection || keep || !ctx.runMutation)
|
|
58
|
+
return;
|
|
59
|
+
const { snapshotId: _, ...scope } = collection;
|
|
60
|
+
const h = (await ctx.runQuery(componentRef(component, "payoutSnapshots/queries/get"), scope));
|
|
61
|
+
if (!h?.readOnly)
|
|
62
|
+
return;
|
|
63
|
+
for (let i = 0; i < 1000; i++)
|
|
64
|
+
if (!(await discardPayoutSnapshot(component, ctx, {
|
|
65
|
+
...scope,
|
|
66
|
+
batchSize: 100,
|
|
67
|
+
})))
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=payoutCollectedInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payoutCollectedInput.js","sourceRoot":"","sources":["../../../src/client/connect/payoutCollectedInput.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAY/B,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,SAAoB,EACpB,GAAW,EACX,IAAoE,EACpE,QAAgB;IAEhB,IAAI,CAAC,GAAG,CAAC,WAAW;QAClB,OAAO,EAAE,MAAM,EAAE,MAAe,EAAE,MAAM,EAAE,4BAA4B,EAAE,CAAC;IAC3E,MAAM,MAAM,GAAG,CAAC,MAAM,GAAG,CAAC,QAAQ,CAChC,YAAY,CAAC,SAAS,EAAE,0BAA0B,CAAC,EACnD,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CACvD,CAAgC,CAAC;IAClC,MAAM,KAAK,GAAG;QACZ,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,MAAM,CAAC,UAAU,EAAE;KACvD,CAAC;IACF,IAAI,CAAC,GAAG,MAAM,qBAAqB,CAAC,SAAS,EAAE,GAAG,EAAE;QAClD,GAAG,KAAK;QACR,gBAAgB,EAAE,MAAM,EAAE,QAAQ,IAAI,CAAC,CAAC;KACzC,CAAC,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CAAC,CAAC;YAEH,OAAO;AACb,CAAC"}
|
|
@@ -11,6 +11,7 @@ export type PayoutReleaseOptions = {
|
|
|
11
11
|
currency: string;
|
|
12
12
|
/** Host supplies all authorized off-provider debts/reserves, without double counting provider receipt debits. */
|
|
13
13
|
independentLiabilities: number;
|
|
14
|
+
liabilityRevision?: number;
|
|
14
15
|
maxPages?: number;
|
|
15
16
|
};
|
|
16
17
|
type Held = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payoutExecution.d.ts","sourceRoot":"","sources":["../../../src/client/connect/payoutExecution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payoutExecution.d.ts","sourceRoot":"","sources":["../../../src/client/connect/payoutExecution.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAIvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAGxE,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,2BAA2B,CAAC;AAEnC,KAAK,MAAM,GAAG,KAAK,CAAC,OAAO,SAAS,CAAC,CAAC;AACtC,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,iHAAiH;IACjH,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AACF,KAAK,IAAI,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/C,MAAM,MAAM,mBAAmB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