mirror of
https://github.com/we-promise/sure.git
synced 2026-04-11 00:04:47 +00:00
Increase specificity of filter when fetching Plaid liabilities
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user