Yodlee is manually refreshable

This commit is contained in:
Bryce Covert
2020-12-22 13:59:50 -08:00
parent 6930a8c7c2
commit bbdb9602aa
6 changed files with 114 additions and 92 deletions

View File

@@ -12,7 +12,8 @@
[clojure.string :as str]
[config.core :refer [env]]
[clojure.tools.logging :as log]))
[clojure.tools.logging :as log]
[auto-ap.datomic.clients :as d-clients]))
(defroutes routes
(wrap-routes
@@ -52,15 +53,21 @@
:headers {"Content-Type" "application/edn"}
:body (pr-str {:message (.getMessage e)
:error (.toString e)})})))
(POST "/provider-accounts/refresh/:id" {:keys [query-params identity] {:keys [id]} :route-params :as request}
(POST "/provider-accounts/refresh/" {:keys [query-params identity edn-params]
{:keys [id]} :route-params
:as request}
(assert-admin identity)
(try
(let [[session token] (yodlee/get-access-token)]
(yodlee/refresh-provider-account (Long/parseLong id))
{:status 200
:headers {"Content-Type" "application/edn"}
:body (pr-str @yodlee/in-memory-cache) })
(yodlee/refresh-provider-account (-> (:client-id edn-params)
Long/parseLong
d-clients/get-by-id
:client/code)
(:provider-account-id edn-params))
{:status 200
:headers {"Content-Type" "application/edn"}
:body "{}" }
(catch Exception e
(log/error e)
{:status 400
:headers {"Content-Type" "application/edn"}
:body (pr-str {:message (.getMessage e)