2024-11-15 13:49:37 -05:00
|
|
|
module Plaidable
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
class_methods do
|
|
|
|
def plaid_provider
|
|
|
|
Provider::Plaid.new if Rails.application.config.plaid
|
|
|
|
end
|
2025-01-31 12:13:58 -06:00
|
|
|
|
|
|
|
def plaid_eu_provider
|
|
|
|
Provider::Plaid.new if Rails.application.config.plaid_eu
|
|
|
|
end
|
|
|
|
|
|
|
|
def plaid_provider_for(plaid_item)
|
|
|
|
return nil unless plaid_item
|
|
|
|
plaid_item.eu? ? plaid_eu_provider : plaid_provider
|
|
|
|
end
|
2024-11-15 13:49:37 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
2025-01-31 12:13:58 -06:00
|
|
|
def plaid_provider_for(plaid_item)
|
|
|
|
self.class.plaid_provider_for(plaid_item)
|
2024-11-15 13:49:37 -05:00
|
|
|
end
|
|
|
|
end
|