Turns on invoice importation

This commit is contained in:
2023-04-27 08:53:49 -07:00
parent 19d83f655f
commit 066d82e0e4

View File

@@ -65,6 +65,7 @@
(defmethod extract-invoice-details :general-produce (defmethod extract-invoice-details :general-produce
[k input-stream clients] [k input-stream clients]
(log/info ::parsing-general-produce :key k) (log/info ::parsing-general-produce :key k)
(try
(->> (read-csv input-stream) (->> (read-csv input-stream)
(drop 1) (drop 1)
(filter (fn [[_ _ _ _ _ _ _ _ _ _ _ break-flag]] (filter (fn [[_ _ _ _ _ _ _ _ _ _ _ break-flag]]
@@ -86,7 +87,12 @@
:invoice/status :invoice-status/unpaid :invoice/status :invoice-status/unpaid
:invoice/client-identifier location-hint :invoice/client-identifier location-hint
}))) })))
(filter :invoice/client))) (filter :invoice/client)
(into []))
(catch Exception e
(log/error ::cant-import-general-produce
:error e)
[])))
(defmethod extract-invoice-details :unknown (defmethod extract-invoice-details :unknown
[k input-stream clients] [k input-stream clients]
@@ -230,7 +236,6 @@
(with-open [is (-> (s3/get-object {:bucket-name bucket-name (with-open [is (-> (s3/get-object {:bucket-name bucket-name
:key k}) :key k})
:input-stream)] :input-stream)]
(doto
(->> (extract-invoice-details k (->> (extract-invoice-details k
is is
clients) clients)
@@ -239,8 +244,7 @@
:invoice i) :invoice i)
i)) i))
(mapv (fn [i] (mapv (fn [i]
[:propose-invoice (assoc i :invoice/source-url invoice-url)]))) [:propose-invoice (assoc i :invoice/source-url invoice-url)])))))
println)))
(catch Exception e (catch Exception e
(log/error ::cant-load-file (log/error ::cant-load-file
:key k :key k