added new types.

This commit is contained in:
Bryce Covert
2021-04-05 14:14:23 -07:00
parent 05663e65a7
commit 4645cbddec
3 changed files with 44 additions and 1 deletions

View File

@@ -7,6 +7,7 @@
(defn determine
[[header :as z]]
(log/info "Importing with header" header)
(let [csv-type (cond (str/includes? (second header) "Customer's PO No.")
:mama-lus
@@ -22,6 +23,10 @@
(str/includes? (str header) "Document Number")
:philz
(str/includes? (str header) "DISCOUNT_MESSAGE")
:wismettac
:else
nil)]
(log/info "csv type was determined to be" csv-type)
@@ -140,6 +145,22 @@
[]
(drop 1 rows)))
(defmethod parse-csv :wismettac
[rows]
(transduce
(comp
(map (fn [[inv_number inv_dt total :as row]]
{:vendor-code "Wismettac"
:invoice-number inv_number
:date (some-> inv_dt not-empty (parse-date-fallover ["MM/dd/yyyy"]))
:total (str/replace total #"," "")
:text (str/join " " row)
:full-text (str/join " " row)}))
)
conj
[]
(drop 1 rows)))
(defmethod parse-csv nil
[rows]
nil)