@fantastic.dev/better-stripe 0.28.2 → 0.28.4
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/README.md +5 -1
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts +96 -2
- package/dist/client/connect/payoutAdoptionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts +48 -1
- package/dist/client/connect/payoutExecutionTestHelpers.d.ts.map +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.js +1 -1
- package/dist/client/connect/payoutExecutionTestHelpers.js.map +1 -1
- package/dist/client/connect/payoutExpiry.d.ts +42 -0
- package/dist/client/connect/payoutExpiry.d.ts.map +1 -0
- package/dist/client/connect/payoutExpiry.js +93 -0
- package/dist/client/connect/payoutExpiry.js.map +1 -0
- package/dist/client/connect/payoutSyncTestHelpers.d.ts +38 -1
- package/dist/client/connect/payoutSyncTestHelpers.d.ts.map +1 -1
- package/dist/client/payoutPolicy.d.ts +18 -2
- package/dist/client/payoutPolicy.d.ts.map +1 -1
- package/dist/client/payoutPolicy.js +3 -25
- package/dist/client/payoutPolicy.js.map +1 -1
- package/dist/component/_generated/component.d.ts +118 -0
- package/dist/component/_generated/component.d.ts.map +1 -1
- package/dist/component/core/resetSafety.d.ts.map +1 -1
- package/dist/component/core/resetSafety.js +7 -1
- package/dist/component/core/resetSafety.js.map +1 -1
- package/dist/component/earnings/triggers.d.ts +22 -2
- package/dist/component/earnings/triggers.d.ts.map +1 -1
- package/dist/component/payoutPolicy/expiry.d.ts +78 -0
- package/dist/component/payoutPolicy/expiry.d.ts.map +1 -0
- package/dist/component/payoutPolicy/expiry.js +57 -0
- package/dist/component/payoutPolicy/expiry.js.map +1 -0
- package/dist/component/payoutPolicy/helpers.d.ts +10 -0
- package/dist/component/payoutPolicy/helpers.d.ts.map +1 -1
- package/dist/component/payoutPolicy/mutations.d.ts +77 -0
- package/dist/component/payoutPolicy/mutations.d.ts.map +1 -1
- package/dist/component/payoutPolicy/mutations.js +36 -3
- package/dist/component/payoutPolicy/mutations.js.map +1 -1
- package/dist/component/payoutPolicy/queries.d.ts +20 -0
- package/dist/component/payoutPolicy/queries.d.ts.map +1 -1
- package/dist/component/payoutPolicy/schema.d.ts +139 -2
- package/dist/component/payoutPolicy/schema.d.ts.map +1 -1
- package/dist/component/payoutPolicy/schema.js +12 -0
- package/dist/component/payoutPolicy/schema.js.map +1 -1
- package/dist/component/payoutRelease/deadline.d.ts +10 -0
- package/dist/component/payoutRelease/deadline.d.ts.map +1 -0
- package/dist/component/payoutRelease/deadline.js +20 -0
- package/dist/component/payoutRelease/deadline.js.map +1 -0
- package/dist/component/payoutRelease/helpers.d.ts +10 -0
- package/dist/component/payoutRelease/helpers.d.ts.map +1 -1
- package/dist/component/payoutRelease/planning.d.ts +1 -0
- package/dist/component/payoutRelease/planning.d.ts.map +1 -1
- package/dist/component/payoutRelease/planning.js +5 -2
- package/dist/component/payoutRelease/planning.js.map +1 -1
- package/dist/component/payoutRelease/preview.d.ts +7 -1
- 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 +2 -0
- package/dist/component/payoutRelease/queries.d.ts.map +1 -1
- package/dist/component/payoutWorker/mutations.d.ts.map +1 -1
- package/dist/component/payoutWorker/mutations.js +12 -4
- package/dist/component/payoutWorker/mutations.js.map +1 -1
- package/dist/component/payoutWorker/queries.d.ts +20 -0
- package/dist/component/payoutWorker/queries.d.ts.map +1 -1
- package/dist/component/schema.d.ts +38 -1
- package/dist/react/workflows/PayoutProgress.d.ts.map +1 -1
- package/dist/react/workflows/PayoutProgress.js +2 -2
- package/dist/react/workflows/PayoutProgress.js.map +1 -1
- package/dist/react/workflows/PayoutSettings.d.ts.map +1 -1
- package/dist/react/workflows/PayoutSettings.js +1 -1
- package/dist/react/workflows/PayoutSettings.js.map +1 -1
- package/dist/react/workflows/payout-progress-state.d.ts +11 -1
- package/dist/react/workflows/payout-progress-state.d.ts.map +1 -1
- package/dist/react/workflows/payout-progress-state.js +42 -7
- package/dist/react/workflows/payout-progress-state.js.map +1 -1
- package/docs/react-workflows.md +14 -0
- package/docs/settlement.md +50 -0
- package/package.json +1 -1
- package/src/client/connect/payoutDeadline.test.ts +238 -0
- package/src/client/connect/payoutExecutionTestHelpers.ts +1 -1
- package/src/client/connect/payoutExpiry.ts +132 -0
- package/src/client/payoutPolicy.test.ts +196 -0
- package/src/client/payoutPolicy.ts +9 -23
- package/src/component/_generated/api.ts +4 -0
- package/src/component/_generated/component.ts +145 -0
- package/src/component/core/resetSafety.ts +49 -33
- package/src/component/payout-reset-safety.test.ts +28 -0
- package/src/component/payoutPolicy/expiry.ts +80 -0
- package/src/component/payoutPolicy/mutations.ts +47 -2
- package/src/component/payoutPolicy/schema.ts +17 -0
- package/src/component/payoutRelease/deadline.ts +24 -0
- package/src/component/payoutRelease/planning.ts +5 -2
- package/src/component/payoutRelease/preview.ts +5 -0
- package/src/component/payoutWorker/mutations.ts +20 -4
- package/src/react/workflows/PayoutProgress.test.tsx +65 -0
- package/src/react/workflows/PayoutProgress.tsx +25 -1
- package/src/react/workflows/PayoutSettings.tsx +4 -1
- package/src/react/workflows/payout-progress-state.ts +60 -8
|
@@ -608,6 +608,16 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
608
608
|
accountId: string;
|
|
609
609
|
country: string;
|
|
610
610
|
holdDeadline?: number | undefined;
|
|
611
|
+
holdingExpiry?: {
|
|
612
|
+
balances?: {
|
|
613
|
+
available: number;
|
|
614
|
+
currency: string;
|
|
615
|
+
pending: number;
|
|
616
|
+
}[] | undefined;
|
|
617
|
+
deadline: number;
|
|
618
|
+
observedAt?: number | undefined;
|
|
619
|
+
status: "balance_remaining" | "claims_unresolved" | "no_held_balance" | "unverified";
|
|
620
|
+
} | undefined;
|
|
611
621
|
mode: "custom" | "stripe_managed";
|
|
612
622
|
operationKey: string;
|
|
613
623
|
ownerKey: string;
|
|
@@ -650,7 +660,34 @@ declare const _default: import("convex/server").SchemaDefinition<{
|
|
|
650
660
|
monthlyDays: import("convex/values").VArray<number[] | undefined, import("convex/values").VFloat64<number, "required">, "optional">;
|
|
651
661
|
}, "optional", "interval" | "monthlyDays" | "weeklyDays">;
|
|
652
662
|
holdDeadline: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
653
|
-
|
|
663
|
+
holdingExpiry: import("convex/values").VObject<{
|
|
664
|
+
balances?: {
|
|
665
|
+
available: number;
|
|
666
|
+
currency: string;
|
|
667
|
+
pending: number;
|
|
668
|
+
}[] | undefined;
|
|
669
|
+
deadline: number;
|
|
670
|
+
observedAt?: number | undefined;
|
|
671
|
+
status: "balance_remaining" | "claims_unresolved" | "no_held_balance" | "unverified";
|
|
672
|
+
} | undefined, {
|
|
673
|
+
deadline: import("convex/values").VFloat64<number, "required">;
|
|
674
|
+
status: import("convex/values").VUnion<"balance_remaining" | "claims_unresolved" | "no_held_balance" | "unverified", [import("convex/values").VLiteral<"unverified", "required">, import("convex/values").VLiteral<"balance_remaining", "required">, import("convex/values").VLiteral<"claims_unresolved", "required">, import("convex/values").VLiteral<"no_held_balance", "required">], "required", never>;
|
|
675
|
+
observedAt: import("convex/values").VFloat64<number | undefined, "optional">;
|
|
676
|
+
balances: import("convex/values").VArray<{
|
|
677
|
+
available: number;
|
|
678
|
+
currency: string;
|
|
679
|
+
pending: number;
|
|
680
|
+
}[] | undefined, import("convex/values").VObject<{
|
|
681
|
+
available: number;
|
|
682
|
+
currency: string;
|
|
683
|
+
pending: number;
|
|
684
|
+
}, {
|
|
685
|
+
currency: import("convex/values").VString<string, "required">;
|
|
686
|
+
available: import("convex/values").VFloat64<number, "required">;
|
|
687
|
+
pending: import("convex/values").VFloat64<number, "required">;
|
|
688
|
+
}, "required", "available" | "currency" | "pending">, "optional">;
|
|
689
|
+
}, "optional", "balances" | "deadline" | "observedAt" | "status">;
|
|
690
|
+
}, "required", "accountId" | "country" | "holdDeadline" | "holdingExpiry" | "holdingExpiry.balances" | "holdingExpiry.deadline" | "holdingExpiry.observedAt" | "holdingExpiry.status" | "mode" | "operationKey" | "ownerKey" | "previousSchedule" | "previousSchedule.interval" | "previousSchedule.monthlyDays" | "previousSchedule.weeklyDays" | "revision" | "status" | "thresholds">, {
|
|
654
691
|
by_account: ["accountId", "_creationTime"];
|
|
655
692
|
by_deadline: ["holdDeadline", "_creationTime"];
|
|
656
693
|
by_mode_status: ["mode", "status", "_creationTime"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoutProgress.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/PayoutProgress.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,+
|
|
1
|
+
{"version":3,"file":"PayoutProgress.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/PayoutProgress.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AACpC,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,+BAuHxD"}
|
|
@@ -14,10 +14,10 @@ export function PayoutProgress(props) {
|
|
|
14
14
|
if (children)
|
|
15
15
|
return _jsx(_Fragment, { children: children(state) });
|
|
16
16
|
const date = (value) => formatter.format(value);
|
|
17
|
-
return (_jsxs("section", { className: className, "data-better-stripe": "payout-progress", children: [_jsxs("h2", { children: ["Automatic payout progress (", currency.toUpperCase(), ")"] }), _jsx("p", { role: "status", children: state.message }), _jsx("p", { children: "Stripe enforces its payout floor; a numeric amount is unavailable." }), state.progress && (_jsx("progress", { "aria-label": "Combined payout minimum", value: state.progress.value, max: state.progress.max })), state.metrics.length > 0 && (_jsx("dl", { children: state.metrics.map((metric) => (_jsxs("div", { children: [_jsx("dt", { children: metric.label }), _jsx("dd", { children: metric.formattedValue })] }, metric.key))) })), state.sources.length > 0 && (_jsxs(_Fragment, { children: [_jsx("p", { children: "All categories contribute to one minimum. Source amounts are before shared costs and obligations. Pending funds do not qualify." }), _jsxs("table", { children: [_jsx("caption", { children: "Source contributions" }), _jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: "Source" }), _jsx("th", { scope: "col", children: "Mature unpaid" }), _jsx("th", { scope: "col", children: "Pending settlement" }), state.accounting && _jsx("th", { scope: "col", children: "In flight" }), state.accounting && _jsx("th", { scope: "col", children: "Paid out" })] }) }), _jsx("tbody", { children: state.sources.map((source) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: source.role === "store"
|
|
17
|
+
return (_jsxs("section", { className: className, "data-better-stripe": "payout-progress", children: [_jsxs("h2", { children: ["Automatic payout progress (", currency.toUpperCase(), ")"] }), _jsx("p", { role: "status", children: state.message }), _jsx("p", { children: "Stripe enforces its payout floor; a numeric amount is unavailable." }), state.recovery?.balances && (_jsxs("div", { children: [_jsx("h3", { children: "Stripe balances at last expiry check" }), _jsx("p", { children: "Provider balances are not a payable earnings assessment. Currencies remain separate." }), _jsx("dl", { children: state.recovery.balances.map((balance) => (_jsxs("div", { children: [_jsxs("dt", { children: [balance.currency.toUpperCase(), " available"] }), _jsx("dd", { children: balance.availableLabel }), _jsxs("dt", { children: [balance.currency.toUpperCase(), " pending"] }), _jsx("dd", { children: balance.pendingLabel })] }, balance.currency))) })] })), state.progress && (_jsx("progress", { "aria-label": "Combined payout minimum", value: state.progress.value, max: state.progress.max })), state.metrics.length > 0 && (_jsx("dl", { children: state.metrics.map((metric) => (_jsxs("div", { children: [_jsx("dt", { children: metric.label }), _jsx("dd", { children: metric.formattedValue })] }, metric.key))) })), state.sources.length > 0 && (_jsxs(_Fragment, { children: [_jsx("p", { children: "All categories contribute to one minimum. Source amounts are before shared costs and obligations. Pending funds do not qualify." }), _jsxs("table", { children: [_jsx("caption", { children: "Source contributions" }), _jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { scope: "col", children: "Source" }), _jsx("th", { scope: "col", children: "Mature unpaid" }), _jsx("th", { scope: "col", children: "Pending settlement" }), state.accounting && _jsx("th", { scope: "col", children: "In flight" }), state.accounting && _jsx("th", { scope: "col", children: "Paid out" })] }) }), _jsx("tbody", { children: state.sources.map((source) => (_jsxs("tr", { children: [_jsx("th", { scope: "row", children: source.role === "store"
|
|
18
18
|
? "Store"
|
|
19
19
|
: source.role === "affiliate"
|
|
20
20
|
? "Affiliate"
|
|
21
|
-
: "Other" }), _jsx("td", { children: source.matureLabel }), _jsx("td", { children: source.pendingLabel }), state.accounting && (_jsx("td", { children: source.reservedLabel ?? "Not assessed" })), state.accounting && (_jsx("td", { children: source.releasedLabel ?? "Not assessed" }))] }, source.role))) })] })] })), state.accounting && (_jsx("p", { children: "Carried-forward funds remain owed. In-flight payouts are separate from completed payouts. Paid-out amounts exclude returned payouts." })), state.nextAttemptAt !== null && (_jsxs("p", { children: ["Next automatic attempt: ", date(state.nextAttemptAt), ". This is not a bank arrival date."] })), state.holdDeadline !== null && (_jsxs("p", { children: ["Custom holding deadline: ", date(state.holdDeadline)] })), state.observedAt !== null && _jsxs("p", { children: ["Assessed: ", date(state.observedAt)] })] }));
|
|
21
|
+
: "Other" }), _jsx("td", { children: source.matureLabel }), _jsx("td", { children: source.pendingLabel }), state.accounting && (_jsx("td", { children: source.reservedLabel ?? "Not assessed" })), state.accounting && (_jsx("td", { children: source.releasedLabel ?? "Not assessed" }))] }, source.role))) })] })] })), state.accounting && (_jsx("p", { children: "Carried-forward funds remain owed. In-flight payouts are separate from completed payouts. Paid-out amounts exclude returned payouts." })), state.nextAttemptAt !== null && (_jsxs("p", { children: ["Next automatic attempt: ", date(state.nextAttemptAt), ". This is not a bank arrival date."] })), state.holdDeadline !== null && (_jsxs("p", { children: ["Custom holding deadline: ", date(state.holdDeadline)] })), state.observedAt !== null && (_jsxs("p", { children: [state.recovery ? "Last recovery check" : "Assessed", ":", " ", date(state.observedAt)] }))] }));
|
|
22
22
|
}
|
|
23
23
|
//# sourceMappingURL=PayoutProgress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoutProgress.js","sourceRoot":"","sources":["../../../src/react/workflows/PayoutProgress.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EACL,mBAAmB,GAEpB,MAAM,4BAA4B,CAAC;AAMpC,qFAAqF;AACrF,MAAM,UAAU,cAAc,CAAC,KAA0B;IACvD,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAC5E,MAAM,KAAK,GAAG,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,SAAS,GAAG,OAAO,CACvB,GAAG,EAAE,CACH,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE;QAC9B,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,OAAO;QAClB,QAAQ;KACT,CAAC,EACJ,CAAC,MAAM,EAAE,QAAQ,CAAC,CACnB,CAAC;IACF,IAAI,QAAQ;QAAE,OAAO,4BAAG,QAAQ,CAAC,KAAK,CAAC,GAAI,CAAC;IAC5C,MAAM,IAAI,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACxD,OAAO,CACL,mBAAS,SAAS,EAAE,SAAS,wBAAqB,iBAAiB,aACjE,wDAAgC,QAAQ,CAAC,WAAW,EAA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CAAC,OAAO,CAAC,CAAC;IAC7B,KAAK,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/B,CAAC;AAYF,oFAAoF;AACpF,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,mBAAmB,GACzB,mBAAmB,CA8DrB;AACD,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,+BAgFxD"}
|
|
@@ -79,6 +79,6 @@ export function PayoutSettings(props) {
|
|
|
79
79
|
return (_jsxs("form", { "data-better-stripe": "payout-settings", onSubmit: (event) => {
|
|
80
80
|
event.preventDefault();
|
|
81
81
|
void state.save();
|
|
82
|
-
}, children: [_jsx("h2", { children: "Payout settings" }), _jsx("label", { htmlFor: `${state.inputId}-mode`, children: "Automatic payout policy" }), _jsxs("select", { id: `${state.inputId}-mode`, value: state.mode, disabled: state.isLoading || state.isPending || state.isChanging, onChange: (event) => state.setMode(event.target.value), children: [_jsx("option", { value: "stripe_managed", children: "Stripe-managed automatic payouts, all currencies" }), _jsx("option", { value: "custom", children: "Custom combined minimum" })] }), state.mode === "custom" && (_jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: `${state.inputId}-minimum`, children: ["Minimum (", props.currency.toUpperCase(), ")"] }), _jsx("input", { id: `${state.inputId}-minimum`, inputMode: "decimal", value: state.minimum, disabled: state.isPending || state.isChanging, onChange: (event) => state.setMinimum(event.target.value) }), _jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: state.consent, disabled: state.isPending || state.isChanging, onChange: (event) => state.setConsent(event.target.checked) }), "I agree to hold funds in my Stripe balance until the combined minimum is met, subject to the holding deadline."] }), _jsx("p", { children: "Store and affiliate earnings combine per currency. Below-minimum funds remain owed. Other currency minimums are preserved." })] })), state.isLoading && _jsx("p", { role: "status", children: "Loading payout settings\u2026" }), state.isChanging && (_jsx("p", { role: "status", children: "A settings change is being verified. The automatic worker will resume it." })), state.error && _jsx("p", { role: "alert", children: state.error }), state.message && _jsx("p", { role: "status", children: state.message }), _jsx("button", { type: "submit", disabled: !state.canSave, children: state.isPending ? "Saving…" : "Save payout settings" }), state.isChanging && props.onRetry && (_jsx("button", { type: "button", disabled: state.isPending, onClick: () => void state.retry(), children: "Retry settings verification" }))] }));
|
|
82
|
+
}, children: [_jsx("h2", { children: "Payout settings" }), _jsx("label", { htmlFor: `${state.inputId}-mode`, children: "Automatic payout policy" }), _jsxs("select", { id: `${state.inputId}-mode`, value: state.mode, disabled: state.isLoading || state.isPending || state.isChanging, onChange: (event) => state.setMode(event.target.value), children: [_jsx("option", { value: "stripe_managed", children: "Stripe-managed automatic payouts, all currencies" }), _jsx("option", { value: "custom", children: "Custom combined minimum" })] }), state.mode === "custom" && (_jsxs(_Fragment, { children: [_jsxs("label", { htmlFor: `${state.inputId}-minimum`, children: ["Minimum (", props.currency.toUpperCase(), ")"] }), _jsx("input", { id: `${state.inputId}-minimum`, inputMode: "decimal", value: state.minimum, disabled: state.isPending || state.isChanging, onChange: (event) => state.setMinimum(event.target.value) }), _jsxs("label", { children: [_jsx("input", { type: "checkbox", checked: state.consent, disabled: state.isPending || state.isChanging, onChange: (event) => state.setConsent(event.target.checked) }), "I agree to hold funds in my Stripe balance until the combined minimum is met, subject to the holding deadline."] }), _jsx("p", { children: "Store and affiliate earnings combine per currency. Below-minimum funds remain owed. During the final day before the holding deadline, the application minimum is waived for automatic payout attempts. Stripe payout limits and balance checks still apply. Other currency minimums are preserved." })] })), state.isLoading && _jsx("p", { role: "status", children: "Loading payout settings\u2026" }), state.isChanging && (_jsx("p", { role: "status", children: "A settings change is being verified. The automatic worker will resume it." })), state.error && _jsx("p", { role: "alert", children: state.error }), state.message && _jsx("p", { role: "status", children: state.message }), _jsx("button", { type: "submit", disabled: !state.canSave, children: state.isPending ? "Saving…" : "Save payout settings" }), state.isChanging && props.onRetry && (_jsx("button", { type: "button", disabled: state.isPending, onClick: () => void state.retry(), children: "Retry settings verification" }))] }));
|
|
83
83
|
}
|
|
84
84
|
//# sourceMappingURL=Pay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,EACzB,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,KAAK,CAAC,KAAK,EAAE,4CAG1B,CACV,IACI,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -33,9 +33,19 @@ export type PayoutProgressState = {
|
|
|
33
33
|
nextAttemptAt: number | null;
|
|
34
34
|
holdDeadline: number | null;
|
|
35
35
|
observedAt: number | null;
|
|
36
|
+
recovery?: {
|
|
37
|
+
status: NonNullable<PayoutPolicy["holdingExpiry"]>["status"];
|
|
38
|
+
balances?: {
|
|
39
|
+
currency: string;
|
|
40
|
+
available: number;
|
|
41
|
+
pending: number;
|
|
42
|
+
availableLabel: string;
|
|
43
|
+
pendingLabel: string;
|
|
44
|
+
}[];
|
|
45
|
+
};
|
|
36
46
|
};
|
|
37
47
|
export type PayoutProgressProps = {
|
|
38
|
-
policy: Pick<PayoutPolicy, "mode" | "status" | "thresholds" | "holdDeadline"> | null | undefined;
|
|
48
|
+
policy: Pick<PayoutPolicy, "mode" | "status" | "thresholds" | "holdDeadline" | "holdingExpiry"> | null | undefined;
|
|
39
49
|
preview?: PayoutPreview | null;
|
|
40
50
|
currency: string;
|
|
41
51
|
/** Application worker attempt time, never a bank arrival estimate. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payout-progress-state.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/payout-progress-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAEhF,MAAM,MAAM,oBAAoB,GAAG;IACjC,GAAG,EACC,YAAY,GACZ,SAAS,GACT,SAAS,GACT,UAAU,GACV,MAAM,GACN,aAAa,GACb,SAAS,GACT,UAAU,GACV,UAAU,GACV,UAAU,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EACJ,SAAS,GAAG,gBAAgB,GAAG,UAAU,GAAG,aAAa,GAAG,UAAU,CAAC;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,WAAW,CACtB,OAAO,CAAC,aAAa,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC,YAAY,CAAC,CAC3D,CAAC;IACF,OAAO,EAAE;QACP,IAAI,EAAE,OAAO,GAAG,WAAW,GAAG,OAAO,CAAC;QACtC,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,EAAE,CAAC;IACJ,QAAQ,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChD,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"payout-progress-state.d.ts","sourceRoot":"","sources":["../../../src/react/workflows/payout-progress-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAEhF,MAAM,MAAM,oBAAo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E;QACT,MAAM,EAAE,WAAW,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;QAC7D,QAAQ,CAAC,EAAE;YACT,QAAQ,EAAE,MAAM,CAAC;YACjB,SAAS,EAAE,MAAM,CAAC;YAClB,OAAO,EAAE,MAAM,CAAC;YAChB,cAAc,EAAE,MAAM,CAAC;YACvB,YAAY,EAAE,MAAM,CAAC;SACtB,EAAE,CAAC;KACL,CAAC;CACH,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EACF,IAAI,CACF,YAAY,EACZ,MAAM,GAAG,QAAQ,GAAG,YAAY,GAAG,cAAc,GAAG,eAAe,CACpE,GACD,IAAI,GACJ,SAAS,CAAC;IACd,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;CACtD,CAAC;AAqBF,wBAAgB,mBAAmB,CAAC,EAClC,MAAM,EACN,OAAO,EACP,QAAQ,EACR,aAAa,EACb,MAAgB,GACjB,EAAE,mBAAmB,GAAG,mBAAmB,CAyJ3C"}
|
|
@@ -31,6 +31,32 @@ export function payoutProgressState({ policy, preview, currency, nextAttemptAt,
|
|
|
31
31
|
state.message =
|
|
32
32
|
"Payout settings are being verified. Eligibility is unavailable until the change completes.";
|
|
33
33
|
}
|
|
34
|
+
else if (policy?.holdingExpiry &&
|
|
35
|
+
policy.holdingExpiry.status !== "no_held_balance") {
|
|
36
|
+
const expiry = policy.holdingExpiry;
|
|
37
|
+
state.status = "unavailable";
|
|
38
|
+
state.reason = "holding_expiry_unresolved";
|
|
39
|
+
state.holdDeadline = expiry.deadline;
|
|
40
|
+
state.observedAt = expiry.observedAt ?? null;
|
|
41
|
+
state.message =
|
|
42
|
+
"The holding deadline has passed. Schedule restoration does not confirm disbursement. " +
|
|
43
|
+
(expiry.status === "unverified"
|
|
44
|
+
? "Stripe balance verification is unavailable. "
|
|
45
|
+
: "Stripe balances or payout claims still require recovery. ") +
|
|
46
|
+
"Contact platform support; automatic recovery checks will retry.";
|
|
47
|
+
state.recovery = {
|
|
48
|
+
status: expiry.status,
|
|
49
|
+
...(expiry.balances
|
|
50
|
+
? {
|
|
51
|
+
balances: expiry.balances.map((b) => ({
|
|
52
|
+
...b,
|
|
53
|
+
availableLabel: formatPrice(b.available, b.currency, locale),
|
|
54
|
+
pendingLabel: formatPrice(b.pending, b.currency, locale),
|
|
55
|
+
})),
|
|
56
|
+
}
|
|
57
|
+
: {}),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
34
60
|
else if (!policy || policy.mode === "stripe_managed") {
|
|
35
61
|
state.status = "stripe_managed";
|
|
36
62
|
state.message =
|
|
@@ -49,21 +75,30 @@ export function payoutProgressState({ policy, preview, currency, nextAttemptAt,
|
|
|
49
75
|
const configured = policy.thresholds.find((t) => t.currency === currency);
|
|
50
76
|
if (preview.currency !== currency ||
|
|
51
77
|
!configured ||
|
|
52
|
-
configured.amount !== preview.threshold
|
|
78
|
+
configured.amount !== preview.threshold ||
|
|
79
|
+
(preview.minimumWaived &&
|
|
80
|
+
preview.holdDeadline !== policy.holdDeadline))
|
|
53
81
|
throw new Error("Payout progress currency or policy does not match the assessment.");
|
|
54
82
|
state.status = "assessed";
|
|
55
83
|
state.reason = preview.reason ?? null;
|
|
56
|
-
state.message =
|
|
57
|
-
|
|
84
|
+
state.message = preview.minimumWaived
|
|
85
|
+
? "The holding deadline is approaching. The application minimum is waived for final automatic attempts; provider limits and all balance checks still apply. " +
|
|
86
|
+
(preview.status === "qualified"
|
|
87
|
+
? "The worker will verify eligibility again before any payout."
|
|
88
|
+
: (reasons[preview.reason ?? ""] ??
|
|
89
|
+
"Automatic payout remains on hold. Contact support before the deadline."))
|
|
90
|
+
: preview.status === "qualified"
|
|
58
91
|
? "The combined balance qualified at the assessment time. The automatic worker will verify it again before any payout."
|
|
59
92
|
: (reasons[preview.reason ?? ""] ??
|
|
60
93
|
"Automatic payout is on hold. Refresh or contact support.");
|
|
61
94
|
state.observedAt = preview.observedAt;
|
|
62
95
|
state.accounting = preview.accounting;
|
|
63
|
-
state.progress =
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
96
|
+
state.progress = preview.minimumWaived
|
|
97
|
+
? null
|
|
98
|
+
: {
|
|
99
|
+
value: Math.max(0, Math.min(preview.threshold, preview.matureUnpaid)),
|
|
100
|
+
max: preview.threshold,
|
|
101
|
+
};
|
|
67
102
|
const definitions = [
|
|
68
103
|
["qualifying", "Combined qualifying balance", preview.matureUnpaid],
|
|
69
104
|
["pending", "Pending settlement", preview.pendingCredits],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payout-progress-state.js","sourceRoot":"","sources":["../../../src/react/workflows/payout-progress-state.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"payout-progress-state.js","sourceRoot":"","sources":["../../../src/react/workflows/payout-progress-state.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAuEtD,MAAM,OAAO,GAA2B;IACtC,eAAe,EACb,iFAAiF;IACnF,sBAAsB,EACpB,gGAAgG;IAClG,0BAA0B,EACxB,4EAA4E;IAC9E,mBAAmB,EACjB,0FAA0F;IAC5F,aAAa,EACX,2EAA2E;IAC7E,mBAAmB,EACjB,gGAAgG;IAClG,kBAAkB,EAAE,wDAAwD;IAC5E,OAAO,EACL,wHAAwH;IAC1H,cAAc,EACZ,yFAAyF;IAC3F,cAAc,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ACT,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC;oBACxC,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC;oBAC3C,GAAG,CAAC,MAAM,CAAC,cAAc,KAAK,SAAS;wBACrC,CAAC,CAAC,EAAE;wBACJ,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;oBACrD,GAAG,CAAC,MAAM,CAAC,cAAc,KAAK,SAAS;wBACrC,CAAC,CAAC,EAAE;wBACJ,CAAC,CAAC,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,CAAC;iBACtD,CAAC,CAAC,CAAC;YACN,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/docs/react-workflows.md
CHANGED
|
@@ -680,6 +680,20 @@ Stripe-managed defaults without inventing a numeric provider floor. Changing
|
|
|
680
680
|
policies suppress prior financial progress during activation, opt-out and expiry
|
|
681
681
|
restoration. A policy preserves its prior mode until confirmation, so mode alone
|
|
682
682
|
does not establish verified controls while status is `changing`.
|
|
683
|
+
During the final day, an assessment with `minimumWaived` explains that only the
|
|
684
|
+
application minimum is waived; its saved threshold remains visible, and the
|
|
685
|
+
minimum progress bar is omitted. Stripe limits and balance checks still apply.
|
|
686
|
+
Hosts that project a policy into a public DTO must forward its optional
|
|
687
|
+
`holdingExpiry` field. Use the package's `payoutHoldingExpiryValidator` for that
|
|
688
|
+
nested field rather than copying its schema. Omitting it would hide unresolved
|
|
689
|
+
recovery after automatic scheduling is restored.
|
|
690
|
+
|
|
691
|
+
A policy with unresolved `holdingExpiry` shows recovery status even after
|
|
692
|
+
`mode` becomes `stripe_managed`. `state.recovery` supplies per-currency provider
|
|
693
|
+
balance labels and raw values from the last recovery check. These balances are
|
|
694
|
+
not payable earnings. An unavailable observation has no balance rows, rather
|
|
695
|
+
than fabricated zero. Pending controls still take precedence. The default
|
|
696
|
+
component and example show the original deadline and recovery check time.
|
|
683
697
|
An expired assessment explains the holding deadline and withholds financial
|
|
684
698
|
progress until the schedule is restored and verified.
|
|
685
699
|
For a ready custom policy, an
|
package/docs/settlement.md
CHANGED
|
@@ -216,6 +216,56 @@ thresholds never extends the original deadline. Current limits are 10 days for
|
|
|
216
216
|
Thailand, a conservative 730 days for the US, and 90 days elsewhere; verify
|
|
217
217
|
current provider rules before enabling the feature in production.
|
|
218
218
|
|
|
219
|
+
During the final 24 hours before the persisted holding deadline, combined release
|
|
220
|
+
waives the optional application minimum. It still verifies source maturity,
|
|
221
|
+
unpaid allocations, live Stripe balance, liabilities, reservations, schedule
|
|
222
|
+
control and provider payout constraints. The one-minor-unit positive amount
|
|
223
|
+
guard is not a claimed Stripe payout floor. The configured minimum and original
|
|
224
|
+
deadline remain unchanged. Preview includes `minimumWaived` and `holdDeadline`
|
|
225
|
+
so hosts can explain eligibility below the saved minimum.
|
|
226
|
+
|
|
227
|
+
Worker attempts are due at the start of this final window even if an older job
|
|
228
|
+
had a later daily cadence. Within the window, retries are scheduled no more than
|
|
229
|
+
five minutes apart. Hosts must invoke discovery at least that often; stored
|
|
230
|
+
attempt times do not execute themselves. Unknown outcomes retain the same claim
|
|
231
|
+
for reconciliation. A provider floor rejection remains explicit and does not
|
|
232
|
+
consume entitlement.
|
|
233
|
+
|
|
234
|
+
Restoring a weekly/monthly schedule at expiry is a control fallback, not proof
|
|
235
|
+
of funded disbursement within the country holding window. Monitor approaching
|
|
236
|
+
deadlines and escalate provider failures, unavailable bank destinations,
|
|
237
|
+
unreconciled history and unresolved claims before expiry. After restoration, `expire` separately observes fresh provider balances and checks
|
|
238
|
+
reserved/submitted payout claims under the component transaction. It returns
|
|
239
|
+
`expiry_unresolved` while a balance or claim remains, or when balance verification
|
|
240
|
+
is unavailable. `policy.holdingExpiry` preserves the original deadline, recovery
|
|
241
|
+
status and last observed balances per currency. These are provider balances,
|
|
242
|
+
not a payable earnings assessment; pending and negative amounts are not netted
|
|
243
|
+
across currencies.
|
|
244
|
+
|
|
245
|
+
An unresolved expiry retains `holdDeadline` even in `stripe_managed` mode so the
|
|
246
|
+
same `due()`/`expire()` loop continues recovery checks. Custom reactivation and
|
|
247
|
+
example reset cannot erase that record. Once a fresh observation has zero
|
|
248
|
+
available and pending balances in every currency and no reserved/submitted
|
|
249
|
+
claim remains, discovery clears the deadline and retains a `no_held_balance`
|
|
250
|
+
observation. That means no balance was held at the observation time, not that a
|
|
251
|
+
bank payout arrived or that off-provider obligations were forgiven.
|
|
252
|
+
|
|
253
|
+
Existing active policies gain the recovery record at their first due expiry
|
|
254
|
+
under the updated SDK. Already-restored older policies whose deadline was
|
|
255
|
+
removed are not automatically backfilled. Audit their historical policy
|
|
256
|
+
operations and Stripe receipts before treating them as financially settled;
|
|
257
|
+
absence of a recovery field does not prove disbursement.
|
|
258
|
+
|
|
259
|
+
Alert operators on `expiry_unresolved`. Reconcile unknown payout outcomes through
|
|
260
|
+
the existing worker or receipt APIs using their original operation identity;
|
|
261
|
+
never delete claims or blindly create replacements. Resolve provider capability,
|
|
262
|
+
bank destination and floor failures through supported Stripe configuration.
|
|
263
|
+
Do not add platform funds to cover a recipient shortfall. Continue the expiry
|
|
264
|
+
loop after resolving the cause so fresh observations can close recovery.
|
|
265
|
+
A provider balance read failure does not prevent schedule restoration and never
|
|
266
|
+
fabricates zero. Control-update failures preserve pending intent and remain
|
|
267
|
+
retryable. Do not claim a successful bank payout from a schedule update alone.
|
|
268
|
+
|
|
219
269
|
For opt-out, prepare a new operation with the latest revision,
|
|
220
270
|
`mode: "stripe_managed"`, and `thresholds: []`, then apply it. Restoration remains
|
|
221
271
|
available after Dashboard control is lost, subject to Stripe permissions. It
|
package/package.json
CHANGED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
// @vitest-environment edge-runtime
|
|
2
|
+
import { afterEach, expect, it, vi } from "vitest";
|
|
3
|
+
import type Stripe from "stripe";
|
|
4
|
+
import { setup, scope, component } from "./payoutExecutionTestHelpers.js";
|
|
5
|
+
import { PayoutWorkerClient } from "./payoutWorker.js";
|
|
6
|
+
import { reconcileRecipientPayout } from "./payoutReconciliation.js";
|
|
7
|
+
import { previewRecipientPayout } from "./payoutPreview.js";
|
|
8
|
+
afterEach(() => vi.useRealTimers());
|
|
9
|
+
async function recipient(hours: number, amounts = [599, 400]) {
|
|
10
|
+
const s = await setup(amounts);
|
|
11
|
+
const deadline = Date.now() + hours * 3600000;
|
|
12
|
+
await s.t.run(async (ctx) => {
|
|
13
|
+
const policy = (await ctx.db.query("payoutPolicies").first())!;
|
|
14
|
+
await ctx.db.patch(policy._id, { holdDeadline: deadline });
|
|
15
|
+
});
|
|
16
|
+
const client = new PayoutWorkerClient(
|
|
17
|
+
component,
|
|
18
|
+
(_ctx, opts) => s.run(opts),
|
|
19
|
+
(_ctx, opts) =>
|
|
20
|
+
reconcileRecipientPayout(
|
|
21
|
+
s.provider as unknown as Stripe,
|
|
22
|
+
component,
|
|
23
|
+
s.ctx,
|
|
24
|
+
opts,
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
const run = (cadenceMs = 300000) =>
|
|
28
|
+
client.run(s.ctx, { ...scope, cadenceMs });
|
|
29
|
+
return { ...s, deadline, client, worker: run };
|
|
30
|
+
}
|
|
31
|
+
it("the scheduled worker releases below-custom-minimum funds in the final day", async () => {
|
|
32
|
+
const s = await recipient(12);
|
|
33
|
+
expect(await s.worker()).toMatchObject({
|
|
34
|
+
payout: { claim: { status: "paid", amount: 999 } },
|
|
35
|
+
});
|
|
36
|
+
expect(s.provider.payouts.create).toHaveBeenCalledTimes(1);
|
|
37
|
+
const policy = await s.t.run((ctx) => ctx.db.query("payoutPolicies").first());
|
|
38
|
+
expect(policy).toMatchObject({
|
|
39
|
+
thresholds: [{ currency: "usd", amount: 1000 }],
|
|
40
|
+
holdDeadline: s.deadline,
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
it("retains the configured minimum before the final day", async () => {
|
|
44
|
+
const s = await recipient(48);
|
|
45
|
+
expect(await s.worker()).toMatchObject({
|
|
46
|
+
payout: { status: "held", reason: "below_threshold" },
|
|
47
|
+
});
|
|
48
|
+
expect(s.provider.payouts.create).not.toHaveBeenCalled();
|
|
49
|
+
});
|
|
50
|
+
it("the final attempt still subtracts known liabilities", async () => {
|
|
51
|
+
const s = await recipient(12);
|
|
52
|
+
expect(await s.run({ independentLiabilities: 100 })).toMatchObject({
|
|
53
|
+
claim: { status: "paid", amount: 899 },
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
it("previews the deadline waiver without changing the configured minimum or reserving money", async () => {
|
|
57
|
+
const s = await recipient(12);
|
|
58
|
+
expect(
|
|
59
|
+
await previewRecipientPayout(
|
|
60
|
+
s.provider as unknown as Stripe,
|
|
61
|
+
component,
|
|
62
|
+
s.ctx,
|
|
63
|
+
scope,
|
|
64
|
+
s.verify,
|
|
65
|
+
),
|
|
66
|
+
).toMatchObject({
|
|
67
|
+
status: "qualified",
|
|
68
|
+
amount: 999,
|
|
69
|
+
threshold: 1000,
|
|
70
|
+
minimumWaived: true,
|
|
71
|
+
holdDeadline: s.deadline,
|
|
72
|
+
providerMinimum: null,
|
|
73
|
+
});
|
|
74
|
+
expect(s.provider.payouts.create).not.toHaveBeenCalled();
|
|
75
|
+
expect(
|
|
76
|
+
await s.t.run((ctx) => ctx.db.query("payoutReleaseClaims").collect()),
|
|
77
|
+
).toEqual([]);
|
|
78
|
+
});
|
|
79
|
+
it("caps a daily cadence at the beginning of the final-attempt window", async () => {
|
|
80
|
+
vi.useFakeTimers();
|
|
81
|
+
const s = await recipient(25);
|
|
82
|
+
expect(await s.worker(86400000)).toMatchObject({
|
|
83
|
+
payout: { reason: "below_threshold" },
|
|
84
|
+
job: { nextAttemptAt: s.deadline - 86400000 },
|
|
85
|
+
});
|
|
86
|
+
vi.advanceTimersByTime(3600000);
|
|
87
|
+
expect(await s.worker(86400000)).toMatchObject({
|
|
88
|
+
payout: { claim: { amount: 999, status: "paid" } },
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
it("retains an unknown final-attempt claim and reconciles without another create", async () => {
|
|
92
|
+
vi.useFakeTimers();
|
|
93
|
+
const s = await recipient(12);
|
|
94
|
+
const create = s.provider.payouts.create.getMockImplementation()!;
|
|
95
|
+
s.provider.payouts.create.mockImplementationOnce(async (params) => {
|
|
96
|
+
await create(params);
|
|
97
|
+
throw new Error("response lost after provider accepted");
|
|
98
|
+
});
|
|
99
|
+
await expect(s.worker()).rejects.toThrow(/response lost/);
|
|
100
|
+
vi.advanceTimersByTime(300000);
|
|
101
|
+
expect(await s.worker()).toMatchObject({
|
|
102
|
+
payout: { claim: { amount: 999, status: "paid" } },
|
|
103
|
+
});
|
|
104
|
+
expect(s.provider.payouts.create).toHaveBeenCalledTimes(1);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it.each(["balance_insufficient", "amount_too_small"])(
|
|
108
|
+
"the final attempt preserves provider rejection %s",
|
|
109
|
+
async (code) => {
|
|
110
|
+
const s = await recipient(12);
|
|
111
|
+
s.provider.payouts.create.mockRejectedValueOnce(
|
|
112
|
+
Object.assign(new Error(code), {
|
|
113
|
+
type: "StripeInvalidRequestError",
|
|
114
|
+
code,
|
|
115
|
+
requestId: "req_declined",
|
|
116
|
+
}),
|
|
117
|
+
);
|
|
118
|
+
expect(await s.worker()).toMatchObject({
|
|
119
|
+
payout: { claim: { status: "rejected", rejection: { code } } },
|
|
120
|
+
});
|
|
121
|
+
expect(
|
|
122
|
+
await s.t.run((ctx) => ctx.db.query("payoutSourceAllocations").collect()),
|
|
123
|
+
).toMatchObject([{ reservedAmount: 0 }, { reservedAmount: 0 }]);
|
|
124
|
+
},
|
|
125
|
+
);
|
|
126
|
+
it("an exhausted balance cannot qualify a zero-amount final payout", async () => {
|
|
127
|
+
const s = await recipient(12);
|
|
128
|
+
expect(await s.run({ independentLiabilities: 999 })).toMatchObject({
|
|
129
|
+
status: "held",
|
|
130
|
+
amount: 0,
|
|
131
|
+
});
|
|
132
|
+
expect(s.provider.payouts.create).not.toHaveBeenCalled();
|
|
133
|
+
});
|
|
134
|
+
it("does not begin a new payout after the holding deadline", async () => {
|
|
135
|
+
const s = await recipient(-1);
|
|
136
|
+
expect(await s.worker()).toMatchObject({
|
|
137
|
+
status: "held",
|
|
138
|
+
reason: "policy_inactive",
|
|
139
|
+
});
|
|
140
|
+
expect(s.provider.payouts.create).not.toHaveBeenCalled();
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it("retries an unknown final attempt within five minutes even with a daily cadence", async () => {
|
|
144
|
+
vi.useFakeTimers();
|
|
145
|
+
const s = await recipient(12);
|
|
146
|
+
s.provider.payouts.create.mockRejectedValueOnce(
|
|
147
|
+
new Error("network outcome unknown"),
|
|
148
|
+
);
|
|
149
|
+
await expect(s.worker(86400000)).rejects.toThrow(/network outcome unknown/);
|
|
150
|
+
expect((await s.client.get(s.ctx, scope))!.nextAttemptAt).toBe(
|
|
151
|
+
Date.now() + 300000,
|
|
152
|
+
);
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it("rescues a pre-existing job whose stored cadence would skip the final window", async () => {
|
|
156
|
+
vi.useFakeTimers();
|
|
157
|
+
const s = await recipient(25);
|
|
158
|
+
await s.worker(86400000);
|
|
159
|
+
await s.t.run(async (ctx) => {
|
|
160
|
+
const job = (await ctx.db.query("payoutWorkerJobs").first())!;
|
|
161
|
+
await ctx.db.patch(job._id, { nextAttemptAt: Date.now() + 86400000 });
|
|
162
|
+
});
|
|
163
|
+
vi.advanceTimersByTime(3600000);
|
|
164
|
+
expect(await s.worker(86400000)).toMatchObject({
|
|
165
|
+
payout: { claim: { amount: 999, status: "paid" } },
|
|
166
|
+
});
|
|
167
|
+
expect(s.provider.payouts.create).toHaveBeenCalledTimes(1);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
it("final-window release subtracts verified refund and reversal receipts before paying", async () => {
|
|
171
|
+
const s = await recipient(12, [600, 450]);
|
|
172
|
+
await s.t.run(async (ctx) => {
|
|
173
|
+
const row = await ctx.db
|
|
174
|
+
.query("transfers")
|
|
175
|
+
.withIndex("by_stripe_transfer_id", (q) =>
|
|
176
|
+
q.eq("stripeTransferId", "tr_1"),
|
|
177
|
+
)
|
|
178
|
+
.unique();
|
|
179
|
+
await ctx.db.patch("transfers", row!._id, { reversedAmount: 100 });
|
|
180
|
+
});
|
|
181
|
+
const original = s.provider.transfers.retrieve.getMockImplementation()!;
|
|
182
|
+
s.provider.transfers.retrieve.mockImplementation(async (id) => ({
|
|
183
|
+
...(await original(id)),
|
|
184
|
+
amount_reversed: id === "tr_1" ? 100 : 0,
|
|
185
|
+
}));
|
|
186
|
+
s.provider.transfers.listReversals.mockImplementation(
|
|
187
|
+
async (...args: unknown[]) =>
|
|
188
|
+
({
|
|
189
|
+
data:
|
|
190
|
+
args[0] === "tr_1"
|
|
191
|
+
? [
|
|
192
|
+
{
|
|
193
|
+
id: "trr_one",
|
|
194
|
+
transfer: "tr_1",
|
|
195
|
+
amount: 100,
|
|
196
|
+
currency: "usd",
|
|
197
|
+
destination_payment_refund: "pyr_one",
|
|
198
|
+
},
|
|
199
|
+
]
|
|
200
|
+
: [],
|
|
201
|
+
has_more: false,
|
|
202
|
+
}) as never,
|
|
203
|
+
);
|
|
204
|
+
Object.assign(s.provider, {
|
|
205
|
+
refunds: {
|
|
206
|
+
retrieve: vi.fn(async () => ({
|
|
207
|
+
id: "pyr_one",
|
|
208
|
+
charge: "py_1",
|
|
209
|
+
amount: 100,
|
|
210
|
+
currency: "usd",
|
|
211
|
+
status: "succeeded",
|
|
212
|
+
balance_transaction: "txn_refund",
|
|
213
|
+
})),
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
s.setTransactions([
|
|
217
|
+
...s.transactions(),
|
|
218
|
+
{
|
|
219
|
+
...s.transactions()[0],
|
|
220
|
+
id: "txn_refund",
|
|
221
|
+
source: "pyr_one",
|
|
222
|
+
amount: -100,
|
|
223
|
+
net: -100,
|
|
224
|
+
type: "payment_refund",
|
|
225
|
+
},
|
|
226
|
+
]);
|
|
227
|
+
expect(await s.run()).toMatchObject({
|
|
228
|
+
claim: {
|
|
229
|
+
status: "paid",
|
|
230
|
+
amount: 950,
|
|
231
|
+
allocations: [
|
|
232
|
+
{ stripeTransferId: "tr_0", amount: 600 },
|
|
233
|
+
{ stripeTransferId: "tr_1", amount: 350 },
|
|
234
|
+
],
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
expect(s.provider.payouts.create).toHaveBeenCalledTimes(1);
|
|
238
|
+
});
|
|
@@ -32,7 +32,7 @@ export async function setup(amounts = [600, 400]) {
|
|
|
32
32
|
operationKey: "enable",
|
|
33
33
|
country: "US",
|
|
34
34
|
thresholds: [{ currency: "usd", amount: 1000 }],
|
|
35
|
-
holdDeadline: Date.now() + 86400000,
|
|
35
|
+
holdDeadline: Date.now() + 7 * 86400000,
|
|
36
36
|
});
|
|
37
37
|
for (let i = 0; i < amounts.length; i++)
|
|
38
38
|
await ctx.db.insert("transfers", {
|