you can now delete yodlee accounts again.
This commit is contained in:
@@ -72,15 +72,19 @@
|
|||||||
:headers {"Content-Type" "application/edn"}
|
:headers {"Content-Type" "application/edn"}
|
||||||
:body (pr-str {:message (.getMessage e)
|
:body (pr-str {:message (.getMessage e)
|
||||||
:error (.toString e)})})))
|
:error (.toString e)})})))
|
||||||
(POST "/provider-accounts/delete/:id" {:keys [query-params identity] {:keys [id]} :route-params :as request}
|
(POST "/provider-accounts/delete/" {:keys [query-params edn-params identity] {:keys [id]} :route-params :as request}
|
||||||
(assert-admin identity)
|
(assert-admin identity)
|
||||||
(try
|
(try
|
||||||
(let [[session token] (yodlee/get-access-token)]
|
(yodlee/delete-provider-account (-> (:client-id edn-params)
|
||||||
(yodlee/delete-provider-account (Long/parseLong id))
|
Long/parseLong
|
||||||
{:status 200
|
d-clients/get-by-id
|
||||||
:headers {"Content-Type" "application/edn"}
|
:client/code)
|
||||||
:body (pr-str @yodlee/in-memory-cache) })
|
(:provider-account-id edn-params))
|
||||||
|
{:status 200
|
||||||
|
:headers {"Content-Type" "application/edn"}
|
||||||
|
:body (pr-str {}) }
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
|
(log/error e)
|
||||||
{:status 400
|
{:status 400
|
||||||
:headers {"Content-Type" "application/edn"}
|
:headers {"Content-Type" "application/edn"}
|
||||||
:body (pr-str {:message (.getMessage e)
|
:body (pr-str {:message (.getMessage e)
|
||||||
|
|||||||
@@ -260,7 +260,7 @@
|
|||||||
|
|
||||||
|
|
||||||
(defn delete-provider-account [client-code id]
|
(defn delete-provider-account [client-code id]
|
||||||
(let [cob-session (login-user client-code)]
|
(let [cob-session (login-user (client-code->login client-code))]
|
||||||
|
|
||||||
(-> (str (:yodlee2-base-url env) "/providerAccounts/" id )
|
(-> (str (:yodlee2-base-url env) "/providerAccounts/" id )
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@
|
|||||||
:body
|
:body
|
||||||
:providerAccount
|
:providerAccount
|
||||||
first))
|
first))
|
||||||
@(d/transact conn [:db/retractEntity [:yodlee-provider-account/id id]]))
|
@(d/transact conn [[:db/retractEntity (:db/id (d/entity (d/db conn) [:yodlee-provider-account/id id]))]]))
|
||||||
|
|
||||||
(defn upsert-accounts-tx
|
(defn upsert-accounts-tx
|
||||||
([client-code]
|
([client-code]
|
||||||
|
|||||||
@@ -203,56 +203,7 @@
|
|||||||
:on-success [::authenticated-mfa provider-account-id]
|
:on-success [::authenticated-mfa provider-account-id]
|
||||||
:on-error [::forms/save-error [::mfa-form provider-account-id] ]}}))
|
:on-error [::forms/save-error [::mfa-form provider-account-id] ]}}))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
::provider-account-refreshed
|
|
||||||
(fn [{:keys [db]} [_ i result]]
|
|
||||||
|
|
||||||
{:db (assoc-in db [::provider-accounts] result)
|
|
||||||
:dispatch [::forms/form-closing [::refresh-provider-account i]]}))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
::provider-account-deleted
|
|
||||||
(fn [{:keys [db]} [_ i result]]
|
|
||||||
{:db (assoc-in db [::provider-accounts] result)
|
|
||||||
:dispatch-n [[::forms/form-closing [::refresh-provider-account i]]
|
|
||||||
[::modal/modal-closed ]]}))
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
::delete-provider-account
|
|
||||||
[with-user ]
|
|
||||||
(fn [{:keys [user db]} [_ provider-account-id ]]
|
|
||||||
{:http {:token user
|
|
||||||
:method :post
|
|
||||||
:owns-state {:single ::delete-provider-account}
|
|
||||||
:headers {"Content-Type" "application/edn"}
|
|
||||||
:uri (str "/api/yodlee2/provider-accounts/delete/" provider-account-id )
|
|
||||||
:body {}
|
|
||||||
:on-success [::provider-account-deleted provider-account-id]
|
|
||||||
:on-error [::forms/save-error [::delete-provider-account provider-account-id] ]}}))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
|
||||||
::delete-requested
|
|
||||||
[with-user]
|
|
||||||
(fn [{:keys [user db]} [_ account-id]]
|
|
||||||
{:dispatch
|
|
||||||
[::modal/modal-requested {:title "Delete Provider account "
|
|
||||||
:body [:div "Are you sure you want to delete provider account " account-id "?"]
|
|
||||||
:confirm {:value "Delete provider account"
|
|
||||||
:status-from [::status/single ::delete-provider-account]
|
|
||||||
:class "is-danger"
|
|
||||||
:on-click (dispatch-event [::delete-provider-account account-id])
|
|
||||||
:close-event [::status/completed ::delete-provider-account]}
|
|
||||||
:cancel? true}]}))
|
|
||||||
|
|
||||||
|
|
||||||
(defn delete-button [account-id]
|
|
||||||
[:button.button
|
|
||||||
{:on-click (dispatch-event [::delete-requested account-id])}
|
|
||||||
[:span.icon [:i.fa.fa-times]]])
|
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
::bank-accounts-by-yodlee-account-id
|
::bank-accounts-by-yodlee-account-id
|
||||||
@@ -414,7 +365,7 @@
|
|||||||
(fn [{:keys [db]} _]
|
(fn [{:keys [db]} _]
|
||||||
{:dispatch [::data-requested]
|
{:dispatch [::data-requested]
|
||||||
::forward/register {:id ::yodlee-account-refreshed
|
::forward/register {:id ::yodlee-account-refreshed
|
||||||
:events #{::table/refreshed}
|
:events #{::table/refreshed ::table/provider-account-deleted}
|
||||||
:event-fn (fn [[_ query-result]]
|
:event-fn (fn [[_ query-result]]
|
||||||
[::data-requested])}
|
[::data-requested])}
|
||||||
:db (dissoc db ::authentication)}))
|
:db (dissoc db ::authentication)}))
|
||||||
|
|||||||
@@ -3,9 +3,11 @@
|
|||||||
[auto-ap.subs :as subs]
|
[auto-ap.subs :as subs]
|
||||||
[auto-ap.views.components.buttons :as buttons]
|
[auto-ap.views.components.buttons :as buttons]
|
||||||
[auto-ap.views.components.grid :as grid]
|
[auto-ap.views.components.grid :as grid]
|
||||||
|
[auto-ap.views.components.modal :as modal]
|
||||||
[auto-ap.views.pages.admin.users.form :as form]
|
[auto-ap.views.pages.admin.users.form :as form]
|
||||||
[auto-ap.views.utils :refer [action-cell-width date->str with-user ->$]]
|
[auto-ap.views.utils :refer [->$ action-cell-width date->str with-user dispatch-event]]
|
||||||
[re-frame.core :as re-frame]))
|
[re-frame.core :as re-frame]
|
||||||
|
[auto-ap.forms :as forms]))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::refreshed
|
::refreshed
|
||||||
@@ -28,6 +30,40 @@
|
|||||||
:provider-account-id provider-account}
|
:provider-account-id provider-account}
|
||||||
:on-success [::refreshed provider-account]}}))
|
:on-success [::refreshed provider-account]}}))
|
||||||
|
|
||||||
|
(re-frame/reg-event-fx
|
||||||
|
::provider-account-deleted
|
||||||
|
(fn [{:keys [db]} [_ i result]]
|
||||||
|
{:dispatch [::modal/modal-closed ]}))
|
||||||
|
|
||||||
|
(re-frame/reg-event-fx
|
||||||
|
::delete-provider-account
|
||||||
|
[with-user ]
|
||||||
|
(fn [{:keys [user db]} [_ provider-account-id ]]
|
||||||
|
(comment :on-error [::forms/save-error [::delete-provider-account provider-account-id] ])
|
||||||
|
{:http {:token user
|
||||||
|
:method :post
|
||||||
|
:owns-state {:single ::delete-provider-account}
|
||||||
|
:headers {"Content-Type" "application/edn"}
|
||||||
|
:uri (str "/api/yodlee2/provider-accounts/delete/" )
|
||||||
|
:body {:client-id (:id @(re-frame/subscribe [::subs/client]))
|
||||||
|
:provider-account-id provider-account-id}
|
||||||
|
:on-success [::provider-account-deleted provider-account-id]
|
||||||
|
}}))
|
||||||
|
|
||||||
|
(re-frame/reg-event-fx
|
||||||
|
::delete-requested
|
||||||
|
[with-user]
|
||||||
|
(fn [{:keys [user db]} [_ account-id]]
|
||||||
|
{:dispatch
|
||||||
|
[::modal/modal-requested {:title "Delete Provider account "
|
||||||
|
:body [:div "Are you sure you want to delete provider account " account-id "?"]
|
||||||
|
:confirm {:value "Delete provider account"
|
||||||
|
:status-from [::status/single ::delete-provider-account]
|
||||||
|
:class "is-danger"
|
||||||
|
:on-click (dispatch-event [::delete-provider-account account-id])
|
||||||
|
:close-event [::status/completed ::delete-provider-account]}
|
||||||
|
:cancel? true}]}))
|
||||||
|
|
||||||
(re-frame/reg-event-fx
|
(re-frame/reg-event-fx
|
||||||
::params-changed
|
::params-changed
|
||||||
(fn [{:keys [db]} [_ p]]
|
(fn [{:keys [db]} [_ p]]
|
||||||
@@ -75,4 +111,6 @@
|
|||||||
:icon "fa-pencil"}]
|
:icon "fa-pencil"}]
|
||||||
[buttons/fa-icon {:event [::request-refresh (:id c)]
|
[buttons/fa-icon {:event [::request-refresh (:id c)]
|
||||||
:class (status/class-for (get statuses (:id c)))
|
:class (status/class-for (get statuses (:id c)))
|
||||||
:icon "fa-refresh"}]]]])]]]))
|
:icon "fa-refresh"}]
|
||||||
|
[buttons/fa-icon {:event [::delete-requested (:id c)]
|
||||||
|
:icon "fa-times"}]]]])]]]))
|
||||||
|
|||||||
Reference in New Issue
Block a user