mirror of
https://github.com/we-promise/sure.git
synced 2026-04-13 00:57:22 +00:00
- Add SimpleFin account creation methods to Account model - Implement intelligent account type mapping from names - Add SimpleFin linkable functionality to Account - Include SimpleFin items in Family model associations - Support account creation with user-selected types
21 lines
581 B
Ruby
21 lines
581 B
Ruby
module Account::Linkable
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
belongs_to :plaid_account, optional: true
|
|
belongs_to :simplefin_account, optional: true
|
|
end
|
|
|
|
# A "linked" account gets transaction and balance data from a third party like Plaid or SimpleFin
|
|
def linked?
|
|
plaid_account_id.present? || simplefin_account_id.present?
|
|
end
|
|
|
|
# An "offline" or "unlinked" account is one where the user tracks values and
|
|
# adds transactions manually, without the help of a data provider
|
|
def unlinked?
|
|
!linked?
|
|
end
|
|
alias_method :manual?, :unlinked?
|
|
end
|