revamped logging!
This commit is contained in:
@@ -9,24 +9,27 @@
|
||||
[clj-time.predicates :as pred]
|
||||
[clojure.data.json :as json]
|
||||
[compojure.core :refer [GET PUT POST context defroutes
|
||||
wrap-routes]])
|
||||
wrap-routes]]
|
||||
[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}
|
||||
(let [notification-type (get headers "x-amz-sns-message-type")]
|
||||
(println "Received notification " notification-type)
|
||||
(if (= "SubscriptionConfirmation" notification-type)
|
||||
(do
|
||||
(println "Responding to confirmation" )
|
||||
(let [json (json/read-str (slurp body))]
|
||||
(println json)
|
||||
(http/get (get json "SubscribeURL"))))
|
||||
(do
|
||||
(println "importing from yodlee")
|
||||
(yodlee-import/do-import))))
|
||||
(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 "{}"
|
||||
|
||||
Reference in New Issue
Block a user