Added yodlee account balances

This commit is contained in:
2021-02-11 19:43:31 -08:00
parent b6581e64e2
commit a78ad47fda
4 changed files with 21 additions and 3 deletions

View File

@@ -140,6 +140,7 @@
:bank_code {:type 'String}
:bank_name {:type 'String}
:current_balance {:type :money}
:yodlee_balance_old {:type :money}
:yodlee_account_id {:type 'Int}
:yodlee_account {:type :yodlee_account}
:locations {:type '(list String)}}}

View File

@@ -2,6 +2,9 @@
(:require [auto-ap.datomic :refer [audit-transact conn remove-nils]]
[auto-ap.datomic.clients :as d-clients]
[auto-ap.graphql.utils :refer [->graphql assert-admin can-see-client? is-admin?]]
[auto-ap.utils :refer [by]]
[auto-ap.yodlee.core :refer [in-memory-cache]]
[clj-time.coerce :as coerce]
[config.core :refer [env]]
[clojure.string :as str]
@@ -213,4 +216,12 @@
(map (fn [c]
(if (is-admin? (:id context))
c
(dissoc c :client/yodlee-provider-accounts)))))))
(dissoc c :client/yodlee-provider-accounts))))
(map (fn [c]
(update c :client/bank-accounts
(fn [bank-accounts]
(mapv (fn [ba]
;; TODO remove when new yodlee replaces
(assoc ba :bank-account/yodlee-balance-old (get-in (by :id (mapcat :accounts @in-memory-cache) )
[(:bank-account/yodlee-account-id ba) :balance :amount])))
bank-accounts))))))))