better way of keeping transactions up to date

This commit is contained in:
Bryce Covert
2020-09-25 06:07:19 -07:00
parent efb6b76670
commit 77786c084e
4 changed files with 14 additions and 28 deletions

View File

@@ -13,24 +13,3 @@
[clojure.tools.logging :as log]
[unilog.context :as lc])
(:import (org.joda.time DateTime)))
(defroutes routes
(context "/events" []
(POST "/yodlee-import" {:keys [query-params headers body] :as x}
(lc/with-context {:source "Import yodlee transactions"}
(let [notification-type (get headers "x-amz-sns-message-type")]
(log/info "Received notification " notification-type)
(if (= "SubscriptionConfirmation" notification-type)
(do
(log/info "Responding to confirmation" )
(let [json (json/read-str (slurp body))]
(log/info json)
(http/get (get json "SubscribeURL"))))
(do
(log/info "importing from yodlee")
(yodlee-import/do-import)))))
{:status 200
:body "{}"
:headers {"Content-Type" "application/edn"}})))