diff --git a/app/models/plaid_item/accounts_snapshot.rb b/app/models/plaid_item/accounts_snapshot.rb index 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::AccountsSnapshot def 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") + end end def liabilities_data diff --git a/test/models/plaid_item/accounts_snapshot_test.rb b/test/models/plaid_item/accounts_snapshot_test.rb index 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