feat: pluggable bank sync connector architecture (closes #75)#588
Open
pabloDarkmoon24 wants to merge 1 commit intorohitdash08:mainfrom
Open
feat: pluggable bank sync connector architecture (closes #75)#588pabloDarkmoon24 wants to merge 1 commit intorohitdash08:mainfrom
pabloDarkmoon24 wants to merge 1 commit intorohitdash08:mainfrom
Conversation
- Add BankConnector ABC with full consent lifecycle: initiate_consent -> confirm_consent -> fetch_accounts -> import_transactions -> refresh - Add MockConnector: fully in-memory, deterministic, no external calls - Add SetuAAConnector: real Indian AA integration via ReBIT spec, HMAC-SHA256 signing, exponential-backoff FI polling, full normalisation - Add connector registry with get_connector() factory and register_connector() for extensibility - Add BankAccount and BankTransaction SQLAlchemy models with unique constraints and indexed date queries - Add schema.sql DDL for bank_accounts and bank_transactions tables - Add /bank blueprint with 7 REST endpoints: POST /bank/connect, GET /bank/callback, GET|DELETE /bank/accounts, POST /bank/accounts/:id/import, POST /bank/accounts/:id/refresh, GET /bank/accounts/:id/transactions - Add 11 pytest tests covering full MockConnector lifecycle
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.
Bank Sync Connector Architecture — Closes #75
Summary
Implements a fully pluggable bank integration system via the Indian Account Aggregator (AA) framework, meeting all acceptance criteria and designed to scale to any AA provider.
What's included
1.
BankConnector— Abstract Base Class (services/bank_connector.py)initiate_consent → confirm_consent → fetch_accounts → import_transactions → refreshBankTransaction,BankAccount,ConsentHandleget_connector(provider)factory andregister_connector()for extension2.
MockConnector— Full in-memory implementation3.
SetuAAConnector— Real Indian AA integrationREADYBankTransactiondomain objectsSETU_CLIENT_ID,SETU_CLIENT_SECRET,SETU_BASE_URL4. Database models (
models.py+schema.sql)BankAccount— stores linked accounts with consent metadataBankTransaction— stores normalised transactions, linkable to existingExpenserows5. REST API (
routes/bank.py)/api/bank/connect/api/bank/callback/api/bank/accounts/api/bank/accounts/:id/api/bank/accounts/:id/import/api/bank/accounts/:id/refresh/api/bank/accounts/:id/transactions6. Tests (
tests/test_bank_connector.py)How to add a new provider
Environment variables required (Setu)
Testing locally with Mock
Closes #75