Files
sure/app/models/family/sophtron_connectable.rb
Juan José Mata 81cdccb768 [codex] Complete Sophtron account mapping (#1698)
* Complete Sophtron account mapping

* Clarify Sophtron login challenge flow

* Add Sophtron connection UI timeout

* Treat Sophtron timeout jobs as failed

* Reset failed Sophtron connection state

* Handle stale Sophtron connection jobs

* Advance Sophtron polling timeout

* Shorten Sophtron connection timeout

* Fix Sophtron modal polling updates

* Stabilize Sophtron MFA polling

* Give Sophtron OTP challenges more time

* Clarify Sophtron institution login failures

* Extend Sophtron polling during login progress

* Probe Sophtron accounts after completed MFA step

* Align Sophtron dialogs with design system

* Start Sophtron initial load after linking accounts

* Fix Sophtron initial transaction load

* Fail Sophtron sync without institution connection

* Fix tests

* Wrap Sophtron account linking in transaction

* Wrap Sophtron provider responses

* Fix Sophtron MFA security tests

* Guard Sophtron MFA challenge arrays

* Respect Sophtron initial load window

* Use unique Sophtron MFA answer field ids

* Address Sophtron review follow-ups

* Fix Sophtron transaction sync refresh

* Avoid blocking Sophtron refresh polling

* Move Sophtron account helpers to model

* Keep Sophtron grouping provider-level

* Start new Sophtron institution links

* Isolate Sophtron institution connections

---------

Signed-off-by: Juan José Mata <juanjo.mata@gmail.com>
2026-05-08 15:15:23 +02:00

32 lines
786 B
Ruby

module Family::SophtronConnectable
extend ActiveSupport::Concern
included do
has_many :sophtron_items, dependent: :destroy
end
def can_connect_sophtron?
# Families can now configure their own Sophtron credentials
true
end
def create_sophtron_item!(user_id:, access_key:, base_url: nil, item_name: nil)
sophtron_item = sophtron_items.create!(
name: item_name || "Sophtron Connection",
user_id: user_id,
access_key: access_key,
base_url: base_url
)
sophtron_item
end
def has_sophtron_credentials?
sophtron_items.where.not(user_id: [ nil, "" ], access_key: [ nil, "" ]).exists?
end
def configured_sophtron_item
sophtron_items.where.not(user_id: [ nil, "" ], access_key: [ nil, "" ]).ordered.first
end
end