added ability to link yodlee directly in.
This commit is contained in:
@@ -14,4 +14,6 @@
|
|||||||
:yodlee-user-login "sbMemda48aa19712a83c3ca4e935dd5e5d46b1a1"
|
:yodlee-user-login "sbMemda48aa19712a83c3ca4e935dd5e5d46b1a1"
|
||||||
:yodlee-user-password "sbMemda48aa19712a83c3ca4e935dd5e5d46b1a1#123"
|
:yodlee-user-password "sbMemda48aa19712a83c3ca4e935dd5e5d46b1a1#123"
|
||||||
:yodlee-base-url "https://developer.api.yodlee.com/ysl"
|
:yodlee-base-url "https://developer.api.yodlee.com/ysl"
|
||||||
|
:yodlee-app "10003600"
|
||||||
|
:yodlee-fastlink "https://node.developer.yodlee.com/authenticate/restserver/?channelAppName=restserver"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,4 +13,6 @@
|
|||||||
:yodlee-user-login "sbMemda48aa19712a83c3ca4e935dd5e5d46b1a1"
|
:yodlee-user-login "sbMemda48aa19712a83c3ca4e935dd5e5d46b1a1"
|
||||||
:yodlee-user-password "sbMemda48aa19712a83c3ca4e935dd5e5d46b1a1#123"
|
:yodlee-user-password "sbMemda48aa19712a83c3ca4e935dd5e5d46b1a1#123"
|
||||||
:yodlee-base-url "https://developer.api.yodlee.com/ysl"
|
:yodlee-base-url "https://developer.api.yodlee.com/ysl"
|
||||||
|
:yodlee-app "10003600"
|
||||||
|
:yodlee-fastlink "https://node.developer.yodlee.com/authenticate/restserver/?channelAppName=restserver"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,6 @@
|
|||||||
:yodlee-user-login "integreat"
|
:yodlee-user-login "integreat"
|
||||||
:yodlee-user-password "Import3transactions!"
|
:yodlee-user-password "Import3transactions!"
|
||||||
:yodlee-base-url "https://quickstart2.api.yodlee.com/ysl"
|
:yodlee-base-url "https://quickstart2.api.yodlee.com/ysl"
|
||||||
|
:yodlee-app "10003600"
|
||||||
|
:yodlee-fastlink "https://quickstartus2node.yodleeinteractive.com/authenticate/qstartus12/?channelAppName=quickstartus2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,6 @@
|
|||||||
:yodlee-user-login "integreat"
|
:yodlee-user-login "integreat"
|
||||||
:yodlee-user-password "Import3transactions!"
|
:yodlee-user-password "Import3transactions!"
|
||||||
:yodlee-base-url "https://quickstart2.api.yodlee.com/ysl"
|
:yodlee-base-url "https://quickstart2.api.yodlee.com/ysl"
|
||||||
|
:yodlee-app "10003600"
|
||||||
|
:yodlee-fastlink "https://quickstartus2node.yodleeinteractive.com/authenticate/qstartus12/?channelAppName=quickstartus2"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,7 +71,7 @@
|
|||||||
:plugins [[lein-figwheel "0.5.13"]
|
:plugins [[lein-figwheel "0.5.13"]
|
||||||
[lein-pdo "0.1.1"]
|
[lein-pdo "0.1.1"]
|
||||||
[cider/cider-nrepl "0.16.0"]]
|
[cider/cider-nrepl "0.16.0"]]
|
||||||
:jvm-opts ["-Dconfig=config/dev.edn" #_#_"--add-modules" "java.xml.bind"]}
|
:jvm-opts ["-Dconfig=config/dev.edn" "--add-modules" "java.xml.bind"]}
|
||||||
:uberjar {:prep-tasks [["cljsbuild" "once" "min"] "compile"]}
|
:uberjar {:prep-tasks [["cljsbuild" "once" "min"] "compile"]}
|
||||||
:provided {:dependencies [[org.clojure/clojurescript "1.10.238"]
|
:provided {:dependencies [[org.clojure/clojurescript "1.10.238"]
|
||||||
[reagent "0.7.0"]
|
[reagent "0.7.0"]
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
[auto-ap.routes.reminders :as reminders]
|
[auto-ap.routes.reminders :as reminders]
|
||||||
[auto-ap.routes.graphql :as graphql]
|
[auto-ap.routes.graphql :as graphql]
|
||||||
[auto-ap.routes.vendors :as vendors]
|
[auto-ap.routes.vendors :as vendors]
|
||||||
|
[auto-ap.routes.yodlee :as yodlee]
|
||||||
[auto-ap.routes.events :as events]
|
[auto-ap.routes.events :as events]
|
||||||
[auto-ap.routes.checks :as checks]
|
[auto-ap.routes.checks :as checks]
|
||||||
[auto-ap.routes.exports :as exports]
|
[auto-ap.routes.exports :as exports]
|
||||||
@@ -33,6 +34,7 @@
|
|||||||
(defroutes api-routes
|
(defroutes api-routes
|
||||||
(context "/api" []
|
(context "/api" []
|
||||||
exports/routes
|
exports/routes
|
||||||
|
yodlee/routes
|
||||||
invoices/routes
|
invoices/routes
|
||||||
companies/routes
|
companies/routes
|
||||||
vendors/routes
|
vendors/routes
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
(defroutes routes
|
(defroutes routes
|
||||||
(context "/events" []
|
(context "/events" []
|
||||||
|
|
||||||
(POST "/yodlee-import" {:keys [query-params headers body] :as x}
|
(POST "/yodlee-import" {:keys [query-params headers body] :as x}
|
||||||
(let [notification-type (get headers "x-amz-sns-message-type")]
|
(let [notification-type (get headers "x-amz-sns-message-type")]
|
||||||
(println "Received notification " notification-type)
|
(println "Received notification " notification-type)
|
||||||
|
|||||||
34
src/clj/auto_ap/routes/yodlee.clj
Normal file
34
src/clj/auto_ap/routes/yodlee.clj
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
(ns auto-ap.routes.yodlee
|
||||||
|
(:require
|
||||||
|
[auto-ap.graphql :as graphql]
|
||||||
|
[clj-http.client :as http]
|
||||||
|
|
||||||
|
[auto-ap.yodlee.core :as yodlee]
|
||||||
|
[auto-ap.graphql.utils :refer [->graphql assert-admin]]
|
||||||
|
[auto-ap.routes.utils :refer [wrap-secure]]
|
||||||
|
[clj-time.coerce :refer [to-date]]
|
||||||
|
[auto-ap.db.invoices-expense-accounts :as expense-accounts]
|
||||||
|
[ring.middleware.json :refer [wrap-json-response]]
|
||||||
|
[compojure.core :refer [GET POST context defroutes wrap-routes]]
|
||||||
|
[clojure.string :as str]
|
||||||
|
[config.core :refer [env]]
|
||||||
|
))
|
||||||
|
|
||||||
|
(defroutes routes
|
||||||
|
(wrap-routes
|
||||||
|
(context "/yodlee" []
|
||||||
|
(GET "/fastlink" {:keys [query-params identity] :as request}
|
||||||
|
(assert-admin identity)
|
||||||
|
(let [[session token] (yodlee/get-access-token)]
|
||||||
|
|
||||||
|
|
||||||
|
{:status 200
|
||||||
|
:headers {"Content-Type" "application/edn"}
|
||||||
|
:body (pr-str {:session session
|
||||||
|
:token token
|
||||||
|
:app (:yodlee-app env)
|
||||||
|
|
||||||
|
:url (:yodlee-fastlink env)
|
||||||
|
|
||||||
|
}) })))
|
||||||
|
wrap-secure))
|
||||||
@@ -75,6 +75,23 @@
|
|||||||
(recur (concat transactions transaction-batch) (+ batch-size skip))
|
(recur (concat transactions transaction-batch) (+ batch-size skip))
|
||||||
transactions)))))
|
transactions)))))
|
||||||
|
|
||||||
|
(defn get-access-token []
|
||||||
|
(let [cob-session (login-cobrand)
|
||||||
|
user-session (login-user cob-session)
|
||||||
|
token (->
|
||||||
|
(str (:yodlee-base-url env) "/user/accessTokens?appIds=" 10003600)
|
||||||
|
|
||||||
|
(client/get
|
||||||
|
{:headers (merge base-headers {"Authorization" (auth-header cob-session user-session)})
|
||||||
|
:as :json})
|
||||||
|
:body
|
||||||
|
:user
|
||||||
|
:accessTokens
|
||||||
|
first
|
||||||
|
:value
|
||||||
|
)]
|
||||||
|
[user-session token]))
|
||||||
|
|
||||||
(defn create-user []
|
(defn create-user []
|
||||||
(let [cob-session (login-cobrand)]
|
(let [cob-session (login-cobrand)]
|
||||||
(-> (str (:yodlee-base-url env) "/user/register")
|
(-> (str (:yodlee-base-url env) "/user/register")
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
"users" :admin-users
|
"users" :admin-users
|
||||||
"reminders" :admin-reminders
|
"reminders" :admin-reminders
|
||||||
"vendors" :admin-vendors
|
"vendors" :admin-vendors
|
||||||
"excel-import" :admin-excel-import}
|
"excel-import" :admin-excel-import
|
||||||
|
"yodlee" :admin-yodlee}
|
||||||
"invoices/" {"" :invoices
|
"invoices/" {"" :invoices
|
||||||
"import" :import-invoices
|
"import" :import-invoices
|
||||||
"unpaid" :unpaid-invoices
|
"unpaid" :unpaid-invoices
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
:admin-users :admin-left-panel
|
:admin-users :admin-left-panel
|
||||||
:admin-excel-import :admin-left-panel
|
:admin-excel-import :admin-left-panel
|
||||||
:admin-vendors :admin-left-panel
|
:admin-vendors :admin-left-panel
|
||||||
|
:admin-yodlee :admin-left-panel
|
||||||
:admin-reminders :admin-left-panel
|
:admin-reminders :admin-left-panel
|
||||||
:new-invoice :blank} page :blank))
|
:new-invoice :blank} page :blank))
|
||||||
|
|
||||||
@@ -96,6 +97,13 @@
|
|||||||
[:span {:class "icon"}
|
[:span {:class "icon"}
|
||||||
[:i {:class "fa fa-envelope-o"}]]
|
[:i {:class "fa fa-envelope-o"}]]
|
||||||
[:span {:class "name"} "Users"]]]
|
[:span {:class "name"} "Users"]]]
|
||||||
|
|
||||||
|
|
||||||
|
[:li.menu-item
|
||||||
|
[:a {:href (bidi/path-for routes/routes :admin-yodlee), :class (str "item" (active-when= ap :admin-yodlee))}
|
||||||
|
[:span {:class "icon"}
|
||||||
|
[:i {:class "fa fa-envelope-o"}]]
|
||||||
|
[:span {:class "name"} "Yodlee Link"]]]
|
||||||
|
|
||||||
[:ul ]]
|
[:ul ]]
|
||||||
[:p.menu-label "History"]
|
[:p.menu-label "History"]
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
[auto-ap.views.pages.needs-activation :refer [needs-activation-page]]
|
[auto-ap.views.pages.needs-activation :refer [needs-activation-page]]
|
||||||
[auto-ap.views.pages.check :refer [check-page]]
|
[auto-ap.views.pages.check :refer [check-page]]
|
||||||
[auto-ap.views.pages.admin.companies :refer [admin-companies-page]]
|
[auto-ap.views.pages.admin.companies :refer [admin-companies-page]]
|
||||||
|
[auto-ap.views.pages.admin.yodlee :refer [admin-yodlee-page]]
|
||||||
[auto-ap.views.pages.admin.users :refer [admin-users-page]]
|
[auto-ap.views.pages.admin.users :refer [admin-users-page]]
|
||||||
[auto-ap.views.pages.admin.vendors :refer [admin-vendors-page]]
|
[auto-ap.views.pages.admin.vendors :refer [admin-vendors-page]]
|
||||||
[auto-ap.views.pages.admin.reminders :refer [admin-reminders-page]]
|
[auto-ap.views.pages.admin.reminders :refer [admin-reminders-page]]
|
||||||
@@ -54,6 +55,9 @@
|
|||||||
(defmethod active-page :admin-reminders []
|
(defmethod active-page :admin-reminders []
|
||||||
[admin-reminders-page])
|
[admin-reminders-page])
|
||||||
|
|
||||||
|
(defmethod active-page :admin-yodlee []
|
||||||
|
[admin-yodlee-page])
|
||||||
|
|
||||||
(defmethod active-page :admin-excel-import []
|
(defmethod active-page :admin-excel-import []
|
||||||
[admin-excel-import-page])
|
[admin-excel-import-page])
|
||||||
|
|
||||||
|
|||||||
74
src/cljs/auto_ap/views/pages/admin/yodlee.cljs
Normal file
74
src/cljs/auto_ap/views/pages/admin/yodlee.cljs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
(ns auto-ap.views.pages.admin.yodlee
|
||||||
|
(:require-macros [cljs.core.async.macros :refer [go]])
|
||||||
|
(:require [re-frame.core :as re-frame]
|
||||||
|
[reagent.core :as reagent]
|
||||||
|
[auto-ap.subs :as subs]
|
||||||
|
[auto-ap.events.admin.companies :as events]
|
||||||
|
[auto-ap.entities.companies :as entity]
|
||||||
|
[auto-ap.views.components.address :refer [address-field]]
|
||||||
|
[auto-ap.views.utils :refer [login-url dispatch-event dispatch-value-change bind-field horizontal-field]]
|
||||||
|
[auto-ap.views.components.modal :refer [action-modal]]
|
||||||
|
[cljs.reader :as edn]
|
||||||
|
[auto-ap.routes :as routes]
|
||||||
|
[bidi.bidi :as bidi]))
|
||||||
|
|
||||||
|
(re-frame/reg-event-fx
|
||||||
|
::authenticate-with-yodlee
|
||||||
|
(fn [{:keys [db]} _]
|
||||||
|
{:db (assoc-in db [::yodlee :loading?] true)
|
||||||
|
:http {:token (:user db)
|
||||||
|
:method :get
|
||||||
|
:headers {"Content-Type" "application/edn"}
|
||||||
|
:uri (str "/api/yodlee/fastlink")
|
||||||
|
:on-success [::authenticated]
|
||||||
|
:on-error [::save-error]}}))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
::authentication
|
||||||
|
(fn [db]
|
||||||
|
(-> db ::yodlee :authentication)))
|
||||||
|
|
||||||
|
(re-frame/reg-sub
|
||||||
|
::loading?
|
||||||
|
(fn [db]
|
||||||
|
(-> db ::yodlee :loading?)))
|
||||||
|
|
||||||
|
|
||||||
|
(re-frame/reg-event-fx
|
||||||
|
::authenticated
|
||||||
|
(fn [{:keys [db]} [_ authentication]]
|
||||||
|
{:db (-> db
|
||||||
|
(assoc-in [::yodlee :authentication] authentication)
|
||||||
|
(assoc-in [::yodlee :loading?] false))}))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(defn admin-yodlee-page []
|
||||||
|
[:div
|
||||||
|
(let [authentication @(re-frame/subscribe [::authentication])
|
||||||
|
loading? @(re-frame/subscribe [::loading?])]
|
||||||
|
|
||||||
|
[:div
|
||||||
|
[:h1.title "Yodlee"]
|
||||||
|
(if authentication
|
||||||
|
[:div
|
||||||
|
"Authentication successful!"
|
||||||
|
[:form {:action (:url authentication) :method "POST"}
|
||||||
|
[:input {:type "hidden"
|
||||||
|
:name "rsession"
|
||||||
|
:value (:session authentication)}]
|
||||||
|
[:input {:type "hidden"
|
||||||
|
:name "token"
|
||||||
|
:value (:token authentication)}]
|
||||||
|
[:input {:type "hidden"
|
||||||
|
:name "app"
|
||||||
|
:value (:app authentication)}]
|
||||||
|
|
||||||
|
[:input {:type "hidden"
|
||||||
|
:name "redirectReq"
|
||||||
|
:value "true"}]
|
||||||
|
[:button.button.is-primary [:span [:span.icon [:i.fa.fa-external-link]] " Go to yodlee"]]]]
|
||||||
|
|
||||||
|
[:button.button.is-primary {:class (if loading? "is-loading" "") :on-click (dispatch-event [::authenticate-with-yodlee])} "Authenticate with Yodlee"])
|
||||||
|
|
||||||
|
])])
|
||||||
Reference in New Issue
Block a user