now we can send emails.
This commit is contained in:
@@ -24,4 +24,4 @@ services:
|
|||||||
database:
|
database:
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
- /opt/integreat/var/lib/postgresql/data:/var/lib/postgresql/data
|
- /opt/integreat/var/lib/postgresql/data:/var/lib/postgresql/data
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
[kibu/pushy "0.3.8"]
|
[kibu/pushy "0.3.8"]
|
||||||
[bidi "2.1.2"]
|
[bidi "2.1.2"]
|
||||||
[ring/ring-defaults "0.2.1"]
|
[ring/ring-defaults "0.2.1"]
|
||||||
[ring/ring-json "0.4.0"]
|
|
||||||
[ring "1.4.0"]
|
[ring "1.4.0"]
|
||||||
[yogthos/config "0.8"]
|
[yogthos/config "0.8"]
|
||||||
[dk.ative/docjure "1.12.0"]
|
[dk.ative/docjure "1.12.0"]
|
||||||
@@ -25,7 +24,8 @@
|
|||||||
[fogus/ring-edn "0.3.0"]
|
[fogus/ring-edn "0.3.0"]
|
||||||
[buddy/buddy-auth "2.1.0"]
|
[buddy/buddy-auth "2.1.0"]
|
||||||
[buddy/buddy-sign "2.1.0"]
|
[buddy/buddy-sign "2.1.0"]
|
||||||
[clj-time "0.14.2"]]
|
[clj-time "0.14.2"]
|
||||||
|
[amazonica "0.3.121"]]
|
||||||
:plugins [[lein-ring "0.9.7"]
|
:plugins [[lein-ring "0.9.7"]
|
||||||
[lein-cljsbuild "1.1.5"]]
|
[lein-cljsbuild "1.1.5"]]
|
||||||
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
|
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]
|
[ring.middleware.defaults :refer [wrap-defaults site-defaults]]
|
||||||
[ring.middleware.params :refer [wrap-params]]
|
[ring.middleware.params :refer [wrap-params]]
|
||||||
[ring.middleware.reload :refer [wrap-reload]]
|
[ring.middleware.reload :refer [wrap-reload]]
|
||||||
[ring.middleware.json :refer [wrap-json-response]]
|
|
||||||
[ring.middleware.edn :refer [wrap-edn-params]]
|
[ring.middleware.edn :refer [wrap-edn-params]]
|
||||||
[clojure.java.jdbc :as j]
|
[clojure.java.jdbc :as j]
|
||||||
[clj-fuzzy.metrics :as m]
|
[clj-fuzzy.metrics :as m]
|
||||||
@@ -24,7 +23,9 @@
|
|||||||
[buddy.sign.jwt :as jwt]
|
[buddy.sign.jwt :as jwt]
|
||||||
[buddy.auth.backends.token :refer [jws-backend]]
|
[buddy.auth.backends.token :refer [jws-backend]]
|
||||||
[buddy.auth.middleware :refer [wrap-authorization wrap-authentication]]
|
[buddy.auth.middleware :refer [wrap-authorization wrap-authentication]]
|
||||||
[auto-ap.db.companies :as companies]))
|
[auto-ap.db.companies :as companies]
|
||||||
|
[amazonica.core :refer [defcredential]]
|
||||||
|
[amazonica.aws.simpleemail :as ses]))
|
||||||
(defn best-match [companies company-identifier]
|
(defn best-match [companies company-identifier]
|
||||||
(->> companies
|
(->> companies
|
||||||
(map (fn [company]
|
(map (fn [company]
|
||||||
@@ -38,6 +39,7 @@
|
|||||||
(def google-client-secret "OC-WemHurPXYpuIw5cT-B90g")
|
(def google-client-secret "OC-WemHurPXYpuIw5cT-B90g")
|
||||||
|
|
||||||
(def jwt-secret "auto ap invoices are awesome")
|
(def jwt-secret "auto ap invoices are awesome")
|
||||||
|
(defcredential "AKIAIRKDGLBX7J7VJZ6Q" "OtRw2t/xktJBDjP8Jnx1Yf6G+uzBfIkrQEc6nmgo" "us-east-1")
|
||||||
|
|
||||||
(defroutes unauthenticated-routes
|
(defroutes unauthenticated-routes
|
||||||
(GET "/" []
|
(GET "/" []
|
||||||
@@ -102,6 +104,19 @@
|
|||||||
:body (pr-str (invoices/get-pending (query-params "company")))
|
:body (pr-str (invoices/get-pending (query-params "company")))
|
||||||
:headers {"Content-Type" "application/edn"}})
|
:headers {"Content-Type" "application/edn"}})
|
||||||
|
|
||||||
|
(POST "/api/reminders/send" {:keys [query-params]}
|
||||||
|
(doseq [{:keys [name email invoice-reminder-schedule]} (companies/get-all)]
|
||||||
|
(when (= "Weekly" invoice-reminder-schedule)
|
||||||
|
(println "Sending email to" email)
|
||||||
|
(ses/send-email :destination {:to-addresses [email]}
|
||||||
|
:source "invoices@mail.integreat.aws.brycecovertoperations.com"
|
||||||
|
:message {:subject "Reminder to send invoices"
|
||||||
|
:body {:html (str "<h1>Hello " name ",</h1><p>This is a reminder to send this week's invoices to us. You can just reply to this email.</p> <p> - Integreat. </p>")
|
||||||
|
:text (str "Hello " name ",\r\nThis is a reminder to send this week's invoices to us. You can just reply to this email.\r\n - Integreat.")}})))
|
||||||
|
{:status 200
|
||||||
|
:body "{}"
|
||||||
|
:headers {"Content-Type" "application/edn"}})
|
||||||
|
|
||||||
(PUT "/api/companies/:id" {:keys [edn-params] {:keys [id]} :route-params :as r}
|
(PUT "/api/companies/:id" {:keys [edn-params] {:keys [id]} :route-params :as r}
|
||||||
{:status 200
|
{:status 200
|
||||||
:body (pr-str (companies/upsert id edn-params))
|
:body (pr-str (companies/upsert id edn-params))
|
||||||
@@ -122,7 +137,8 @@
|
|||||||
{:status 200
|
{:status 200
|
||||||
:body (pr-str (invoices/get-pending (query-params "company")))
|
:body (pr-str (invoices/get-pending (query-params "company")))
|
||||||
:headers {"Content-Type" "application/edn"}})
|
:headers {"Content-Type" "application/edn"}})
|
||||||
(wrap-json-response (GET "/api/export" {:keys [query-params]}
|
;; Removing the export view for now...
|
||||||
|
#_(wrap-json-response (GET "/api/export" {:keys [query-params]}
|
||||||
(println query-params)
|
(println query-params)
|
||||||
(doto (invoices/get-unpaid (query-params "company"))
|
(doto (invoices/get-unpaid (query-params "company"))
|
||||||
println)))
|
println)))
|
||||||
|
|||||||
Reference in New Issue
Block a user