Skip to content

feat(bank-connector): add connector abstraction, mock implementation, and factory for #266#287

Open
macan88 wants to merge 2 commits intorohitdash08:mainfrom
macan88:felix/fix-266
Open

feat(bank-connector): add connector abstraction, mock implementation, and factory for #266#287
macan88 wants to merge 2 commits intorohitdash08:mainfrom
macan88:felix/fix-266

Conversation

@macan88
Copy link

@macan88 macan88 commented Mar 2, 2026

Problem

There is no abstraction layer for bank integrations, making it impossible to add or swap connectors (import/refresh flows) without touching calling code. Issue #266 requests a connector interface, support for both import and refresh flows, and a mock connector to validate the design.

Solution

Added app/src/lib/bank-connector.ts which exports a BankConnector interface with importTransactions and refreshTransactions methods, a MockBankConnector that satisfies the interface with deterministic in-memory data, and a createConnector factory that decouples consumers from concrete implementations. Real connectors (Plaid, Open Banking, etc.) can be added by extending the ConnectorName union and adding a single case to the factory switch—zero changes required at call sites.

Testing

  • Added bank-connector.test.ts with three focused cases:
    • Import flow returns only transactions within the requested date range
    • Refresh flow returns only transactions strictly after the since cursor
    • Factory correctly instantiates a working connector without importing the concrete class

Closes #266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hi, I’d like to work on this bounty.

1 participant