Skip to content

ONB-2261-feat(bank-connections): add bank-connections commands for customer API feeds - #31

Open
andremanuelbarbosa wants to merge 1 commit into
mainfrom
andrem/onb-2261-cli-no-commands-for-bank-connections-7-ops
Open

andremanuelbarbosa wants to merge 1 commit into
mainfrom
andrem/onb-2261-cli-no-commands-for-bank-connections-7-ops

Conversation

@andremanuelbarbosa

@andremanuelbarbosa andremanuelbarbosa commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add bank-connections commands covering all 7 public API operations
  • Add JSON templates and unit tests mirroring bank-match

Changes

  • Add dualentry bank-connections commands for all 7 public API operations: list, get, create, delete, accounts list/create, and transactions push
  • Add bank-connections template for connection, accounts, and transactions JSON samples
  • Add run_delete helper in commands/actions.py for DELETE actions
  • Register the command group in main.py and document Bank Connections in the README
  • Add unit tests covering each command path and templates

Test plan

  • Unit tests pass (uv run pytest)
  • Linter passes (uv run ruff check .)
  • Manually tested with dualentry <command>

Examples

Bank Connections Help

% dualentry bank-connections --help
                                                                                                                                                                                                                                        
 Usage: dualentry bank-connections [OPTIONS] COMMAND [ARGS]...                                                                                                                                                                          
                                                                                                                                                                                                                                        
 Manage bank connections                                                                                                                                                                                                                
                                                                                                                                                                                                                                        
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --help          Show this message and exit.                                                                                                                                                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ list           List bank connections.                                                                                                                                                                                                │
│ get            Get one bank connection by ID.                                                                                                                                                                                        │
│ create         Register a bank connection (and optional accounts).                                                                                                                                                                   │
│ delete         Unregister a customer API bank connection.                                                                                                                                                                            │
│ template       Output a sample bank-connections JSON template.                                                                                                                                                                       │
│ accounts       Manage accounts under a bank connection                                                                                                                                                                               │
│ transactions   Push bank transactions for a registered account                                                                                                                                                                       │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Create a Bank Connection

% dualentry bank-connections create -f ~/Downloads/bank_connection_1.json
┌────────────────────────────┬────────────────────────────────────┐
│ created_at                 │ 2026-09-24T14:46:51Z               │
│ updated_at                 │ 2026-09-24T14:46:51Z               │
│ id                         │ 7639                               │
│ connection_source_id       │ conn-1                             │
│ institution_name           │ Customer Bank                      │
│ status                     │ active                             │
│ successfully_aggregated_at │ 2026-09-24T14:46:51.736Z           │
│ last_sync_at               │ 2026-09-24T14:46:51.736Z           │
│ accounts                   │ [                                  │
│                            │   {                                │
│                            │     "id": 3705,                    │
│                            │     "account_id": "acct-checking", │
│                            │     "account_name": "Checking",    │
│                            │     "trunca                        │
└────────────────────────────┴────────────────────────────────────┘

Get Bank Connections

% dualentry bank-connections list --format json                          
{
  "items": [
    {
      "created_at": "2026-09-24T14:46:51Z",
      "updated_at": "2026-09-24T14:46:51Z",
      "id": 7639,
      "connection_source_id": "conn-1",
      "institution_name": "Customer Bank",
      "status": "active",
      "successfully_aggregated_at": "2026-09-24T14:46:51.736Z",
      "last_sync_at": "2026-09-24T14:46:51.736Z",
      "accounts": [
        {
          "id": 3705,
          "account_id": "acct-checking",
          "account_name": "Checking",
          "truncated_account_number": "1234",
          "currency_iso_4217_code": "USD",
          "status": "active"
        },
        {
          "id": 3706,
          "account_id": "acct-savings",
          "account_name": "Savings",
          "truncated_account_number": null,
          "currency_iso_4217_code": "USD",
          "status": "active"
        }
      ]
    }
  ],
  "count": 1
}

Get a Bank Connection

% dualentry bank-connections get 7639          
┌────────────────────────────┬────────────────────────────────────┐
│ created_at                 │ 2026-09-24T14:46:51Z               │
│ updated_at                 │ 2026-09-24T14:46:51Z               │
│ id                         │ 7639                               │
│ connection_source_id       │ conn-1                             │
│ institution_name           │ Customer Bank                      │
│ status                     │ active                             │
│ successfully_aggregated_at │ 2026-09-24T14:46:51.736Z           │
│ last_sync_at               │ 2026-09-24T14:46:51.736Z           │
│ accounts                   │ [                                  │
│                            │   {                                │
│                            │     "id": 3705,                    │
│                            │     "account_id": "acct-checking", │
│                            │     "account_name": "Checking",    │
│                            │     "trunca                        │
└────────────────────────────┴────────────────────────────────────┘

Get the Accounts for a Bank Connection

% dualentry bank-connections accounts list 7639                
┏━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓
┃ id   ┃ account_id    ┃ account_name ┃ truncated_account_number ┃ currency_iso_4217_code ┃ status ┃
┡━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩
│ 3705 │ acct-checking │ Checking     │ 1234                     │ USD                    │ active │
│ 3706 │ acct-savings  │ Savings      │ None                     │ USD                    │ active │
└──────┴───────────────┴──────────────┴──────────────────────────┴────────────────────────┴────────┘

Create an Account for a Bank Connection

% dualentry bank-connections accounts create -f ~/Downloads/bank_connection_account_1.json 7639
┌────────────────────────────┬────────────────────────────────────┐
│ created_at                 │ 2026-09-24T14:46:51Z               │
│ updated_at                 │ 2026-09-24T14:46:51Z               │
│ id                         │ 7639                               │
│ connection_source_id       │ conn-1                             │
│ institution_name           │ Customer Bank                      │
│ status                     │ active                             │
│ successfully_aggregated_at │ 2026-09-24T14:46:51.736Z           │
│ last_sync_at               │ 2026-09-24T14:49:59.228Z           │
│ accounts                   │ [                                  │
│                            │   {                                │
│                            │     "id": 3705,                    │
│                            │     "account_id": "acct-checking", │
│                            │     "account_name": "Checking",    │
│                            │     "trunca                        │
└────────────────────────────┴────────────────────────────────────┘

Create Transactions for an Account

% dualentry bank-connections transactions push -f ~/Downloads/bank_connection_transactions_1.json 3705
┌─────────┬────────────────────────────────┐
│ success │ True                           │
│ results │ [                              │
│         │   {                            │
│         │     "external_trx_id": "tx-1", │
│         │     "status": "created",       │
│         │     "id": 113451,              │
│         │     "error": null              │
│         │                                │
└─────────┴────────────────────────────────┘

Delete a Bank Connection

% dualentry bank-connections delete 7639
┌─────────┬──────┐
│ success │ True │
│ errors  │ {}   │
└─────────┴──────┘

@andremanuelbarbosa
andremanuelbarbosa marked this pull request as ready for review September 25, 2026 09:54
Comment thread src/dualentry_cli/commands/bank_connections.py Outdated
Comment thread src/dualentry_cli/commands/bank_connections.py
Comment thread README.md
@andremanuelbarbosa
andremanuelbarbosa marked this pull request as draft September 25, 2026 10:33
Comment thread src/dualentry_cli/commands/bank_connections.py
@andremanuelbarbosa
andremanuelbarbosa force-pushed the andrem/onb-2261-cli-no-commands-for-bank-connections-7-ops branch from e0c41de to c31c0d2 Compare September 25, 2026 11:18
@andremanuelbarbosa
andremanuelbarbosa marked this pull request as ready for review September 25, 2026 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants