1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-02 20:15:22 +02:00

Fix EU plaid flow (#1761)

* Fix EU plaid flow

* Fix failing tests
This commit is contained in:
Zach Gollwitzer 2025-01-31 17:04:26 -05:00 committed by GitHub
parent 4bf72506d5
commit 53f4b32c33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 91 additions and 86 deletions

View file

@ -1,4 +1,3 @@
# rubocop:disable Layout/ElseAlignment, Layout/IndentationWidth
class Family < ApplicationRecord
include Plaidable, Syncable
@ -48,22 +47,22 @@ class Family < ApplicationRecord
super || accounts.manual.any?(&:syncing?) || plaid_items.any?(&:syncing?)
end
def get_link_token(webhooks_url:, redirect_url:, accountable_type: nil, region: :us)
provider = case region
when :eu
self.class.plaid_eu_provider
else
self.class.plaid_provider
end
def eu?
country != "US" && country != "CA"
end
return nil unless provider
def get_link_token(webhooks_url:, redirect_url:, accountable_type: nil, region: :us)
provider = if region.to_sym == :eu
self.class.plaid_eu_provider
else
self.class.plaid_us_provider
end
provider.get_link_token(
user_id: id,
webhooks_url: webhooks_url,
redirect_url: redirect_url,
accountable_type: accountable_type,
eu: region == :eu
).link_token
end
@ -238,4 +237,3 @@ class Family < ApplicationRecord
)
end
end
# rubocop:enable Layout/ElseAlignment, Layout/IndentationWidth