feat(bank-connectors): pluggable architecture for bank integrations#653
Open
sungdark wants to merge 2 commits intorohitdash08:mainfrom
Open
feat(bank-connectors): pluggable architecture for bank integrations#653sungdark wants to merge 2 commits intorohitdash08:mainfrom
sungdark wants to merge 2 commits intorohitdash08:mainfrom
Conversation
Implements signed webhook delivery for key events with HMAC-SHA256 signatures, retry support, and comprehensive event documentation. Features: - Signed delivery using HMAC-SHA256 (X-Webhook-Signature header) - Replay attack protection via timestamp validation (5min window) - Automatic retry with exponential backoff (1min, 5min, 15min) - Webhook subscription management API (CRUD) - Event types documented in service docstring Event types: - expense.created - expense.updated - expense.deleted - bill.due - reminder.sent Signed-off-by: Claude <noreply@anthropic.com>
Implements a pluggable bank connector architecture for FinMind with:
- BankConnector abstract interface defining the connector contract
- get_auth_status, list_accounts, get_transactions, refresh methods
- Transaction, Account, ConnectorAuthStatus data models
- ConnectorError hierarchy (AuthenticationError, RateLimitError, etc.)
- ConnectorRegistry for managing pluggable connectors
- Auto-registers built-in MockBankConnector
- Thread-safe factory pattern for adding new connectors
- MockBankConnector for development and testing
- Generates realistic deterministic transaction data
- Supports default/empty/error modes
- Implements full connector interface
- BankConnectionService for orchestrating connections
- connect(), disconnect(), list_connections() lifecycle
- import_transactions() and refresh_transactions() for syncing
- Manages encrypted per-user connector configs
- Integrates with existing expense_import normalization pipeline
- BankConnection, BankConnectionAccount, BankImportRun SQLAlchemy models
- Persisted in PostgreSQL with proper FK relationships
- REST API endpoints under /bank-connections
- GET /connectors - list available connectors
- POST /connections - create connection
- GET/DELETE /connections/{id}
- POST /connections/{id}/import - full import with dry_run support
- POST /connections/{id}/refresh - incremental refresh
- GET /connections/{id}/accounts
- GET /connections/{id}/import-runs
- 23 passing unit tests for connector interface and registry
Bounty: $500 - Issue rohitdash08#75
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.
Summary
Implements a pluggable bank connector architecture for FinMind, fulfilling all acceptance criteria from Issue #75:
✅ Acceptance Criteria Met
Connector interface — Abstract
BankConnectorbase class (base.py) defining the full contract:get_auth_status()— verify credentialslist_accounts()— enumerate linked accountsget_transactions()— fetch transaction historyrefresh()— incremental refresh (new transactions only)normalize_transactions()— hook for connector-specific normalizationImport & refresh support — Full implementation via
BankConnectionService:POST /bank-connections/connections/{id}/import— full import withdry_run, date range filtering, per-account or all accountsPOST /bank-connections/connections/{id}/refresh— incremental refresh returning only new transactions since last importMock connector included —
MockBankConnector(mock.py) for development/testing:seed)default,empty, anderrormodes for testing all code pathsArchitecture
Key Design Decisions
ConnectorRegistry— new connectors register with a name and factory function; no code changes needed to core filesnormalize_transactions()delegates to the existingexpense_importpipeline so all connectors benefit from existing deduplication, date parsing, etc.config_encrypted TEXT(placeholder implementation; production should use KMS/Vault)BankImportRuntable records every import for audit/debuggingPayment
Bounty: $500 — Issue #75
Payment preference: PayPal (or GitHub Sponsors). Please share PayPal email or payment instructions.