adds alternative ezcater solution.
This commit is contained in:
59
test/clj/auto_ap/integration/routes/ezcater_xls.clj
Normal file
59
test/clj/auto_ap/integration/routes/ezcater_xls.clj
Normal file
@@ -0,0 +1,59 @@
|
||||
(ns auto-ap.integration.routes.ezcater-xls
|
||||
(:require
|
||||
[auto-ap.integration.util
|
||||
:refer [setup-test-data test-client wrap-setup]]
|
||||
[auto-ap.routes.ezcater-xls :as sut]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.test :refer [deftest is testing use-fixtures]]))
|
||||
|
||||
(use-fixtures :each wrap-setup)
|
||||
|
||||
(deftest stream->sales-ordersx
|
||||
(testing "Should import nothing when there are no clients"
|
||||
(with-open [s (io/input-stream (io/resource "sample-ezcater.xlsx"))]
|
||||
(is (= [:missing "Nick The Greek (Santa Cruz)"] (first (sut/stream->sales-orders s))))))
|
||||
(testing "should import for a single client"
|
||||
(let [{:strs [test-client]} (setup-test-data [(test-client
|
||||
:db/id "test-client"
|
||||
:client/code "NGOP"
|
||||
:client/locations ["DT"]
|
||||
:client/name "The client"
|
||||
:client/matches ["Nick the Greek (Elk Grove)"])])]
|
||||
(with-open [s (io/input-stream (io/resource "sample-ezcater.xlsx"))]
|
||||
(is (seq (sut/stream->sales-orders s)))
|
||||
)
|
||||
(with-open [s (io/input-stream (io/resource "sample-ezcater.xlsx"))]
|
||||
(is (= #:sales-order
|
||||
{:vendor :vendor/ccp-ezcater
|
||||
:service-charge -95.9
|
||||
:date #inst "2023-04-03T18:30:00"
|
||||
:reference-link "ZA2-320"
|
||||
:charges
|
||||
[#:charge{:type-name "CARD"
|
||||
:date #inst "2023-04-03T18:30:00"
|
||||
:client test-client
|
||||
:location "DT"
|
||||
:external-id
|
||||
"ezcater/charge/17592186045501-DT-ZA2-320-0"
|
||||
:processor :ccp-processor/ezcater
|
||||
:total 516.12
|
||||
:tip 0.0}]
|
||||
:client test-client
|
||||
:tip 0.0
|
||||
:tax 37.12
|
||||
:external-id "ezcater/order/17592186045501-DT-ZA2-320"
|
||||
:total 516.12
|
||||
:line-items
|
||||
[#:order-line-item{:external-id
|
||||
"ezcater/order/17592186045501-DT-ZA2-320-0"
|
||||
:item-name "EZCater Catering"
|
||||
:category "EZCater Catering"
|
||||
:discount 0.0
|
||||
:tax 37.12
|
||||
:total 516.12}]
|
||||
:discount 0.0
|
||||
:location "DT"
|
||||
:returns 0.0}
|
||||
(last (first (filter (comp #{:order} first)
|
||||
(sut/stream->sales-orders s))))))))))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
(ns auto-ap.routes.invoice-test
|
||||
(ns auto-ap.integration.routes.invoice-test
|
||||
(:require
|
||||
[auto-ap.datomic :refer [conn]]
|
||||
[auto-ap.datomic.clients :refer [rebuild-search-index]]
|
||||
Reference in New Issue
Block a user