Files
sure/app/models/family/enable_banking_connectable.rb
soky srm 4a29d030af Initial enable banking implementation (#382)
* Initial enable banking implementation

* Handle multiple connections

* Amount fixes

* Account type mapping

* Add option to skip accounts

* Update schema.rb

* Transaction fixes

* Provider fixes

* FIX account identifier

* FIX support unlinking

* UI style fixes

* FIX safe redirect and brakeman issue

* FIX

- pagination max fix
- wrap crud in transaction logic

* FIX api uid access

- The Enable Banking API expects the UUID (uid from the API response) to fetch balances/transactions, not the identification_hash

* FIX add new connection

* FIX erb code

* Alert/notice box overflow protection

* Give alert/notification boxes room to grow (3 lines max)

* Add "Enable Banking (beta)" to `/settings/bank_sync`

* Make Enable Banking section collapsible like all others

* Add callback hint to error message

---------

Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
2025-11-29 13:31:08 +01:00

32 lines
851 B
Ruby

module Family::EnableBankingConnectable
extend ActiveSupport::Concern
included do
has_many :enable_banking_items, dependent: :destroy
end
def can_connect_enable_banking?
# Families can configure their own Enable Banking credentials
true
end
def create_enable_banking_item!(country_code:, application_id:, client_certificate:, item_name: nil)
enable_banking_item = enable_banking_items.create!(
name: item_name || "Enable Banking Connection",
country_code: country_code,
application_id: application_id,
client_certificate: client_certificate
)
enable_banking_item
end
def has_enable_banking_credentials?
enable_banking_items.where.not(client_certificate: nil).exists?
end
def has_enable_banking_session?
enable_banking_items.where.not(session_id: nil).exists?
end
end