mirror of
https://github.com/we-promise/sure.git
synced 2026-04-19 12:04:08 +00:00
Add SnapTrade brokerage integration with full trade history support (#737)
* Introduce SnapTrade integration with models, migrations, views, and activity processing logic. * Refactor SnapTrade activities processing: improve activity fetching flow, handle pending states, and update UI elements for enhanced user feedback. * Update Brakeman ignore file to include intentional redirect for SnapTrade OAuth portal. * Refactor SnapTrade models, views, and processing logic: add currency extraction helper, improve pending state handling, optimize migration checks, and enhance user feedback in UI. * Remove encryption for SnapTrade `snaptrade_user_id`, as it is an identifier, not a secret. * Introduce `SnaptradeConnectionCleanupJob` to asynchronously handle SnapTrade connection cleanup and improve i18n for SnapTrade item status messages. * Update SnapTrade encryption: make `snaptrade_user_secret` non-deterministic to enhance security. --------- Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> Co-authored-by: luckyPipewrench <luckypipewrench@proton.me> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
This commit is contained in:
36
test/fixtures/snaptrade_accounts.yml
vendored
Normal file
36
test/fixtures/snaptrade_accounts.yml
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
# Minimal fixtures for SnapTrade accounts
|
||||
# Per CLAUDE.md: Keep fixtures minimal (2-3 per model for base cases)
|
||||
|
||||
fidelity_401k:
|
||||
snaptrade_item: configured_item
|
||||
name: "Fidelity 401(k)"
|
||||
snaptrade_account_id: "acc_123"
|
||||
snaptrade_authorization_id: "auth_456"
|
||||
account_number: "1234567890"
|
||||
brokerage_name: "Fidelity"
|
||||
currency: "USD"
|
||||
current_balance: 50000.00
|
||||
cash_balance: 1500.00
|
||||
account_status: "active"
|
||||
account_type: "401k"
|
||||
provider: "fidelity"
|
||||
raw_payload: {}
|
||||
raw_holdings_payload: []
|
||||
raw_activities_payload: []
|
||||
|
||||
vanguard_ira:
|
||||
snaptrade_item: configured_item
|
||||
name: "Vanguard IRA"
|
||||
snaptrade_account_id: "acc_456"
|
||||
snaptrade_authorization_id: "auth_789"
|
||||
account_number: "0987654321"
|
||||
brokerage_name: "Vanguard"
|
||||
currency: "USD"
|
||||
current_balance: 75000.00
|
||||
cash_balance: 500.00
|
||||
account_status: "active"
|
||||
account_type: "ira"
|
||||
provider: "vanguard"
|
||||
raw_payload: {}
|
||||
raw_holdings_payload: []
|
||||
raw_activities_payload: []
|
||||
20
test/fixtures/snaptrade_items.yml
vendored
Normal file
20
test/fixtures/snaptrade_items.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
# Minimal fixtures for SnapTrade items
|
||||
# Per CLAUDE.md: Keep fixtures minimal (2-3 per model for base cases)
|
||||
|
||||
configured_item:
|
||||
family: dylan_family
|
||||
name: "SnapTrade Connection"
|
||||
client_id: "test_client_id"
|
||||
consumer_key: "test_consumer_key"
|
||||
snaptrade_user_id: "user_123"
|
||||
snaptrade_user_secret: "secret_abc"
|
||||
status: good
|
||||
scheduled_for_deletion: false
|
||||
pending_account_setup: false
|
||||
|
||||
unconfigured_item:
|
||||
family: empty
|
||||
name: "Pending Setup"
|
||||
status: good
|
||||
scheduled_for_deletion: false
|
||||
pending_account_setup: true
|
||||
Reference in New Issue
Block a user