1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-05 13:35:21 +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

@ -21,8 +21,8 @@ class PlaidItem < ApplicationRecord
scope :ordered, -> { order(created_at: :desc) }
class << self
def create_from_public_token(token, item_name:, region: "us")
response = plaid_provider.exchange_public_token(token)
def create_from_public_token(token, item_name:, region:)
response = plaid_provider_for_region(region).exchange_public_token(token)
new_plaid_item = create!(
name: item_name,
@ -59,11 +59,10 @@ class PlaidItem < ApplicationRecord
private
def fetch_and_load_plaid_data
data = {}
provider = plaid_provider_for(self)
item = provider.get_item(access_token).item
item = plaid_provider.get_item(access_token).item
update!(available_products: item.available_products, billed_products: item.billed_products)
fetched_accounts = provider.get_item_accounts(self).accounts
fetched_accounts = plaid_provider.get_item_accounts(self).accounts
data[:accounts] = fetched_accounts || []
internal_plaid_accounts = fetched_accounts.map do |account|