mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-07 14:35:23 +02:00
Lazy load Plaid link tokens, fix link issues on broadcast (#2302)
* Lazy load Plaid link tokens, fix link issues on broadcast * Fix alert styles
This commit is contained in:
parent
c701755b02
commit
d21e385962
19 changed files with 155 additions and 123 deletions
|
@ -5,6 +5,15 @@ module Family::PlaidConnectable
|
|||
has_many :plaid_items, dependent: :destroy
|
||||
end
|
||||
|
||||
def can_connect_plaid_us?
|
||||
plaid(:us).present?
|
||||
end
|
||||
|
||||
# If Plaid provider is configured and user is in the EU region
|
||||
def can_connect_plaid_eu?
|
||||
plaid(:eu).present? && self.eu?
|
||||
end
|
||||
|
||||
def create_plaid_item!(public_token:, item_name:, region:)
|
||||
public_token_response = plaid(region).exchange_public_token(public_token)
|
||||
|
||||
|
@ -34,6 +43,6 @@ module Family::PlaidConnectable
|
|||
|
||||
private
|
||||
def plaid(region)
|
||||
@plaid ||= Provider::Registry.plaid_provider_for_region(region)
|
||||
Provider::Registry.plaid_provider_for_region(region)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue