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:
parent
03e0230e99
commit
43a403e431
2 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue