From 00a7886f639e8a3e523599f75ad286c9c3c4a829 Mon Sep 17 00:00:00 2001 From: Jakob Wennberg <149234542+jakobwennberg@users.noreply.github.com> Date: Wed, 20 May 2026 11:13:24 +0200 Subject: [PATCH] feat(enable-banking): bump default lookback to 120 days (#542) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sync Now and initial-connection backfill now default to 120 days instead of 90. Clamp ranges are unchanged ([1,365] for Sync Now, [30,365] for initial sync). The PSD2 90-day ceiling without fresh SCA still applies at the bank — asking for more is harmless and surfaces any additional history Swedish ASPSPs are willing to return. Co-authored-by: Claude Opus 4.7 (1M context) --- extensions/general/enable-banking/index.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/extensions/general/enable-banking/index.ts b/extensions/general/enable-banking/index.ts index b4d274db..23520f23 100644 --- a/extensions/general/enable-banking/index.ts +++ b/extensions/general/enable-banking/index.ts @@ -256,9 +256,11 @@ export const enableBankingExtension: Extension = { }) if (!rl.ok) return rl.response! - // Default 90 days: most callers (Sync Now button, post-activation gap fill) + // Default 120 days: most callers (Sync Now button, post-activation gap fill) // want a deep refresh, not a 30-day blip. Cron uses 7-day incrementals separately. - const { connection_id, days_back: rawDaysBack = 90 } = await request.json() + // Bank may still cap at ~90 days per PSD2 without fresh SCA — asking for more + // is harmless and surfaces whatever the ASPSP is willing to return. + const { connection_id, days_back: rawDaysBack = 120 } = await request.json() const days_back = Math.min(Math.max(1, rawDaysBack), 365) const { data: connection, error: connectionError } = await supabase @@ -514,9 +516,11 @@ export const enableBankingExtension: Extension = { } // initial_lookback_days only applies on the pending_selection→active transition. - // Default 90 (PSD2 standard); clamp to [30, 365]. Ignored for selection edits. + // Default 120; clamp to [30, 365]. Ignored for selection edits. + // PSD2 obliges ASPSPs to ~90 days without fresh SCA, but many Swedish banks + // return more if asked — request 120 and accept whatever the bank gives back. const initialLookbackDays = (() => { - const n = typeof rawLookback === 'number' && Number.isFinite(rawLookback) ? rawLookback : 90 + const n = typeof rawLookback === 'number' && Number.isFinite(rawLookback) ? rawLookback : 120 return Math.min(365, Math.max(30, Math.round(n))) })()