You can now kind of choose a yodlee merchant

This commit is contained in:
Bryce Covert
2019-05-16 09:19:22 -07:00
parent b488ad6302
commit 6d85c2d67c
8 changed files with 72 additions and 1 deletions

View File

@@ -242,3 +242,17 @@
(println "Page failure" result)
(assoc db :page-failure result
:status nil)))
(re-frame/reg-event-db
::yodlee-merchants-received
(fn [db [_ data]]
(assoc db :yodlee-merchants (:yodlee-merchants data))))
(re-frame/reg-event-fx
::yodlee-merchants-needed
(fn [{:keys [db]} _]
{:graphql {:token (:user db)
:query-obj {:venia/queries [[:yodlee-merchants
[:name :yodlee-id]]]}
:on-success [::yodlee-merchants-received]}}))

View File

@@ -202,3 +202,8 @@
(if (= 500 (:status error))
"System error occured. If you are stuck, please notify ben@integreatconsult.com."
(:message error)))))
(re-frame/reg-sub
::yodlee-merchants
(fn [db]
(:yodlee-merchants db)))

View File

@@ -7,6 +7,7 @@
[auto-ap.views.pages.admin.rules.form :as form]
[auto-ap.views.pages.admin.rules.common :refer [default-read]]
[auto-ap.views.utils :refer [dispatch-event with-user]]
[auto-ap.events :as events]
[auto-ap.utils :refer [replace-by]]
[re-frame.core :as re-frame]))
@@ -99,7 +100,8 @@
:on-params-change (fn [params]
(re-frame/dispatch [::params-change params]))}]
]))
{:component-will-mount #(re-frame/dispatch-sync [::params-change {}]) }))
{:component-will-mount #(do (re-frame/dispatch-sync [::params-change {}])
(re-frame/dispatch [::events/yodlee-merchants-needed])) }))
(defn admin-rules-page []
(let [{:keys [active?]} @(re-frame/subscribe [::forms/form ::form/form])]

View File

@@ -217,6 +217,12 @@
:field [:bank-account]
:spec ::entity/bank-account}]]
[field "Yodlee Merchant"
[typeahead-entity {:matches @(re-frame/subscribe [::subs/yodlee-merchants])
:match->text #(str (:name %) " - " (:yodlee-id %))
:type "typeahead-entity"
:field [:yodlee-merchant]}]]
[field [:span "Description (" [:a {:href "https://regex101.com" :target "_new"} "regex tester"] ")" ]
[:input.input {:type "text"
:field [:description]