mirror of
https://github.com/we-promise/sure.git
synced 2026-07-18 15:55:22 +00:00
- 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!
31 lines
586 B
Ruby
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
|