maybe makes plaid work, maybe makes yodlee reauthenticate work.

This commit is contained in:
2022-03-30 08:02:23 -07:00
parent 17e6b283df
commit 83501384b7
5 changed files with 49 additions and 6 deletions

View File

@@ -167,4 +167,7 @@
"NGVV"
{:square-location "L4H5856Q326NS"
:location "VV",
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"}}}
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"}}
:plaid {:base-url "https://production.plaid.com"
:client-id "61bfab05f7e762001b323f79"
:secret-key "2be026ca5e7f7e9f23f2fb4d7c914d"}}

View File

@@ -28,4 +28,7 @@
:yodlee2-fastlink "https://fl4.prod.yodlee.com/authenticate/USDevexProd2-319/fastlink/?channelAppName=usdevexprod2"
:yodlee2-proxy-host "172.31.10.83"
:yodlee2-proxy-port 8888
:plaid {:base-url "https://production.plaid.com"
:client-id "61bfab05f7e762001b323f79"
:secret-key "2be026ca5e7f7e9f23f2fb4d7c914d"}
}

View File

@@ -38,6 +38,27 @@
:headers {"Content-Type" "application/edn"}
:body (pr-str {:message (.getMessage e)
:error (.toString e)})})))
(GET "/provider-accounts/:client/:id" {:keys [query-params identity edn-params]
{:keys [client id]} :route-params
:as request}
(assert-admin identity)
(log/info "looking-up " client id)
(try
{:status 200
:headers {"Content-Type" "application/edn"}
:body (pr-str (yodlee/get-provider-account-detail (-> client
Long/parseLong
d-clients/get-by-id
:client/code)
id))}
(catch Exception e
(log/error e)
{:status 400
:headers {"Content-Type" "application/edn"}
:body (pr-str {:message (.getMessage e)
:error (.toString e)})})))
(POST "/provider-accounts/delete/" {:keys [edn-params identity] {:keys [id]} :route-params :as request}
(assert-admin identity)
(try

View File

@@ -53,7 +53,7 @@
:can-submit [::can-submit]
:id ::form}))
(defn form [{:keys [provider-account]}]
(let [{error :error account-data :data } @(re-frame/subscribe [::forms/form [::form (:id provider-account)]])
(let [{error :error account-data :data } @(re-frame/subscribe [::forms/form ::form])
{:keys [form-inline field error-notification submit-button]} reauthenticate-form
]
@@ -83,8 +83,7 @@
(re-frame/reg-event-fx
::reauthenticate-start
(fn [{:keys [db]} [_ provider-account client-id]]
(println provider-account)
(fn [{:keys [db]} [_ client-id provider-account ]]
{:db (-> db
(forms/start-form ::form {:id (:id provider-account)
:client-id client-id

View File

@@ -35,6 +35,20 @@
(fn [{:keys [db]} [_ i result]]
{:dispatch [::modal/modal-closed ]}))
(re-frame/reg-event-fx
::request-login-form
[with-user ]
(fn [{:keys [user]} [_ provider-account client-id]]
{:http {:token user
:method :get
:owns-state {:multi ::request-login-form
:which (:id provider-account)}
:headers {"Content-Type" "application/edn"}
:uri (str "/api/yodlee2/provider-accounts/" client-id "/" (:id provider-account) )
:on-success [::form/reauthenticate-start client-id]}}))
(re-frame/reg-event-fx
::delete-provider-account
[with-user ]
@@ -76,7 +90,8 @@
(defn table [{:keys [status page]}]
(let [params @(re-frame/subscribe [::params])
statuses @(re-frame/subscribe [::status/multi ::refresh])]
statuses @(re-frame/subscribe [::status/multi ::refresh])
login-statuses @(re-frame/subscribe [::status/multi ::request-login-form])]
[grid/grid {:status status
:on-params-change (fn [p]
(re-frame/dispatch [::params-changed p]))
@@ -107,7 +122,9 @@
[:li (:name a) " - " (:number a) [:div.tag (->$ (:available-balance a))]])]]
[grid/cell {}
[:div.buttons
[buttons/fa-icon {:event [::form/reauthenticate-start c (:id (:client c))]
[buttons/fa-icon {:event
[::request-login-form c (:id (:client c))]
:class (status/class-for (get login-statuses (:id c)))
:icon "fa-pencil"}]
[buttons/fa-icon {:event [::request-refresh (:id c) (:id (:client c))]
:class (status/class-for (get statuses (:id c)))