1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-07-19 05:09:38 +02:00

Increase specificity of filter when fetching Plaid liabilities

This commit is contained in:
Zach Gollwitzer 2025-05-24 19:16:55 -04:00
parent 03e0230e99
commit 43a403e431
2 changed files with 6 additions and 2 deletions

View file

@ -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

View file

@ -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