feat(connectors): pluggable BankConnector interface, registry, and mock connector for Indian bank sync#286
Open
macan88 wants to merge 3 commits intorohitdash08:mainfrom
Open
feat(connectors): pluggable BankConnector interface, registry, and mock connector for Indian bank sync#286macan88 wants to merge 3 commits intorohitdash08:mainfrom
macan88 wants to merge 3 commits intorohitdash08:mainfrom
Conversation
…ck connector for Indian bank sync
…ck connector for Indian bank sync
…ck connector for Indian bank sync
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The codebase has no abstraction for bank integrations — every potential connector would need to be hardcoded into the sync logic with no shared contract, making it impossible to add AA/API-provider connections without rewriting core sync code each time.
Solution
Adds three files that together form a minimal, extensible connector layer:
app/src/lib/connectors/base.tsBankConnectorinterface +Transaction/ImportResulttypes + typed error classesapp/src/lib/connectors/registry.tsConnectorRegistrysingleton —register(),getConnector(),listConnectors()app/src/lib/connectors/mock.tsMockBankConnector— deterministic INR transaction data, cursor pagination, forced-failure auth pathKey design decisions:
importTransactions(cursor?)prevents duplicate transactions on retry and supports incremental sync without refetching full history.refreshSync()separate fromimportTransactions()so AA connectors can re-validate consent on background polls without affecting user-triggered imports.base.ts)._resetForTesting()on registry keeps unit tests isolated without module re-imports.A real AA-provider connector (e.g., Finvu / Setu AA) can be added by implementing
BankConnectorand callingConnectorRegistry.register('aa-finvu', FinvuConnector)— zero changes to existing files required.Testing
mock.ts(runnable via vitest) covering:MockBankConnectorinstance for id"mock"importTransactions()returns transactions withid,amount,date,currency: 'INR'hasMorecorrect at endauthenticate({ fail_auth: 'true' })throwsConnectorAuthErrorCloses #75