Files
sure/app/models/wise_item/sync_complete_event.rb
xBlaz3kx 237146a914 feat(wise): add Wise integration with JAR savings account and activity support
- Add WiseItem/WiseAccount models with full sync pipeline (importer, syncer, processor)
- Detect income vs expense using targetAccount == recipientId from borderless accounts API
- Support JAR (SAVINGS) accounts with totalWorth balance and savings subtype
- Fetch JAR activity via profile activities API (INTERBALANCE, BALANCE_CASHBACK, BALANCE_ASSET_FEE)
- Route INTERBALANCE activities to both JAR and STANDARD accounts and link as Transfer records
- Add provider connection status registration, routes, views, and i18n
- Add migration for wise_items and wise_accounts tables
- Add tests for WiseAccount, WiseEntry::Processor, WiseActivity::Processor, WiseItem::Importer, and WiseItem#link_jar_transfers!
2026-07-09 22:58:15 +02:00

31 lines
586 B
Ruby

# frozen_string_literal: true
class WiseItem::SyncCompleteEvent
attr_reader :wise_item
def initialize(wise_item)
@wise_item = wise_item
end
def broadcast
wise_item.accounts.each do |account|
account.broadcast_sync_complete
end
wise_item.broadcast_replace_to(
wise_item.family,
target: dom_id(wise_item),
partial: "wise_items/wise_item",
locals: { wise_item: wise_item }
)
wise_item.family.broadcast_sync_complete
end
private
def dom_id(record)
"#{record.class.name.underscore}_#{record.id}"
end
end