diff --git a/src/clj/auto_ap/routes/invoices.clj b/src/clj/auto_ap/routes/invoices.clj index 79612bb5..a68ae3e7 100644 --- a/src/clj/auto_ap/routes/invoices.clj +++ b/src/clj/auto_ap/routes/invoices.clj @@ -199,6 +199,7 @@ '[?account-override :vendor-account-override/account ?account-override-account]]} :args [(d/db (d/connect uri)) matching-vendor (:db/id matching-client)]}) first) + _ (when-not matching-vendor (throw (ex-info (str "No vendor with the name " vendor-code " was found.") {:invoice-number invoice-number @@ -301,13 +302,18 @@ (context "/invoices" [] (POST "/upload" - {{ files :file + {{files :file + files-2 "file" client :client - location :location} :params :as params} - (let [{:keys [filename tempfile]} files] - (clojure.pprint/pprint params) + client-2 "client" + location :location + location-2 "location"} :params :as params} + (let [files (or files files-2) + client (or client client-2) + location (or location location-2) + {:keys [filename tempfile]} files] #_(println params (.getPath tempfile) filename) - (try + (try (import-uploaded-invoice client location (parse/parse-file (.getPath tempfile) filename)) {:status 200 :body (pr-str {})