switched to graphql to create a payment.

This commit is contained in:
Bryce Covert
2018-05-14 09:30:01 -07:00
parent fd2164e8ba
commit bbd9f00f30
5 changed files with 85 additions and 14 deletions

View File

@@ -185,6 +185,34 @@
:invoices (map :id invoices)}))
(defn print-checks [invoice-ids]
(let [invoices (invoices/get-multi invoice-ids)
companies (into {}
(map (fn [c] [(:id c) c])
(companies/get-all)))
vendors (into {}
(map (fn [v] [(:id v) v])
(vendors/get-all)))
invoices-grouped-by-vendor (group-by :vendor-id invoices)
checks (-> (for [[vendor-id invoices] invoices-grouped-by-vendor]
[invoices (checks/insert! (check-for-invoices invoices vendor-id vendors companies))])
doall)
invoice-checks (invoices-checks/insert-multi!
(mapcat
(fn [[invoices check]]
(map
(fn [i]
{:invoice-id (:id i)
:check-id (:id check)
:amount (:total i)})
invoices))
checks)) ]
(make-pdfs (map second checks))
{:invoices (mapcat first checks)
:pdf-url (merge-pdfs (map (comp :s3-key second) checks))}))
(defroutes routes
(wrap-routes
(context "/checks" []