The personal finance app for everyone
Increase specificity of filter when fetching Plaid liabilities
Zach Gollwitzer43a403e43121
diff --git a/app/models/plaid_item/accounts_snapshot.rb b/app/models/plaid_item/accounts_snapshot.rbindex dcf5957a..dc62d8ff 100644--- a/app/models/plaid_item/accounts_snapshot.rb+++ b/app/models/plaid_item/accounts_snapshot.rb@@ -92,7 +92,10 @@ class PlaidItem::AccountsSnapshotdef can_fetch_liabilities?plaid_item.supports_product?("liabilities") &&- accounts.any? { |a| [ "credit", "loan" ].include?(a.type) }+ accounts.any? do |a|+ a.type == "credit" && a.subtype == "credit card" ||+ a.type == "loan" && (a.subtype == "mortgage" || a.subtype == "student")+ endenddef liabilities_datadiff --git a/test/models/plaid_item/accounts_snapshot_test.rb b/test/models/plaid_item/accounts_snapshot_test.rbindex 467497f7..433b3fe3 100644--- a/test/models/plaid_item/accounts_snapshot_test.rb+++ b/test/models/plaid_item/accounts_snapshot_test.rb@@ -112,7 +112,8 @@ class PlaidItem::AccountsSnapshotTest < ActiveSupport::TestCase@snapshot.expects(:accounts).returns([OpenStruct.new(account_id: "123",- type: "credit"+ type: "loan",+ subtype: "student")]).at_least_once