Import the longest bank-permitted history and surface real provider errors
Manual history imports failed opaquely once a bank capped lookback on an established consent (N26 rejects date_from beyond ~90 days with WRONG_TRANSACTIONS_PERIOD). Backfill now requests the documented longest fetching strategy, reports the coverage the bank actually provided, and non-2xx responses surface allowlisted documented error codes instead of a generic fallback. Dead-session codes map to reconnection. Failed syncs retry hourly so a stale sync banner no longer persists for a day.
This commit is contained in:
@@ -40,7 +40,7 @@ func (b *bankScenario) Status(context.Context, string) (banking.SessionStatus, e
|
||||
func (b *bankScenario) Balances(context.Context, string) ([]banking.Balance, error) {
|
||||
return []banking.Balance{{Amount: "100.00", Currency: "EUR", Type: "CLBD"}}, nil
|
||||
}
|
||||
func (b *bankScenario) Transactions(_ context.Context, a domain.Account, from, to string) ([]domain.Facts, error) {
|
||||
func (b *bankScenario) Transactions(_ context.Context, a domain.Account, from, to string, _ bool) ([]domain.Facts, error) {
|
||||
if b.fail {
|
||||
return nil, errors.New("offline")
|
||||
}
|
||||
@@ -153,9 +153,9 @@ func (b *sessionBank) Status(_ context.Context, id string) (banking.SessionStatu
|
||||
return b.statuses[id], b.failures[id]
|
||||
}
|
||||
|
||||
func (b *sessionBank) Transactions(ctx context.Context, account domain.Account, from, to string) ([]domain.Facts, error) {
|
||||
func (b *sessionBank) Transactions(ctx context.Context, account domain.Account, from, to string, longest bool) ([]domain.Facts, error) {
|
||||
b.fetched = append(b.fetched, account.ID)
|
||||
return b.bankScenario.Transactions(ctx, account, from, to)
|
||||
return b.bankScenario.Transactions(ctx, account, from, to, longest)
|
||||
}
|
||||
|
||||
func TestSyncSessionRateLimitPreservesBindingsAndRecovers(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user