Yodlee is manually refreshable
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user