Adds ezcater fikes.
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
[clojure.string :as str]
|
||||
[clojure.data.json :as json]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clojure.tools.logging :as log]
|
||||
[clj-time.core :as time]
|
||||
[clojure.set :as set]
|
||||
[auto-ap.time :as atime]
|
||||
@@ -95,6 +94,7 @@
|
||||
:eventKey 'cancelled}}
|
||||
[[:subscription [:parentId :parentEntity :eventEntity :eventKey]]]]]})))))
|
||||
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(defn upsert-ezcater
|
||||
([] (upsert-ezcater (get-integrations)))
|
||||
@@ -108,7 +108,8 @@
|
||||
:integration-status/last-updated (coerce/to-date (time/now))})
|
||||
|
||||
(catch Exception e
|
||||
(log/warn e)
|
||||
(alog/warn ::cant-upsert-ezcater
|
||||
:exception e)
|
||||
(mark-integration-status integration {:integration-status/state :integration-state/failed
|
||||
:integration-status/message (.getMessage e)}))))))
|
||||
|
||||
@@ -277,6 +278,7 @@
|
||||
(update-in [:sales-order/charges 0 :charge/date] coerce/to-date))])))
|
||||
|
||||
(defn upsert-recent []
|
||||
(upsert-ezcater)
|
||||
(let [last-sunday (coerce/to-date (time/plus (second (->> (time/today)
|
||||
(iterate #(time/plus % (time/days -1)))
|
||||
(filter #(= 7 (time/day-of-week %)))))
|
||||
@@ -293,7 +295,8 @@
|
||||
[?c2 :ezcater-caterer/uuid ?uuid]]
|
||||
(d/db conn)
|
||||
last-sunday)
|
||||
:let [_ (log/info "Considering updating " order)
|
||||
:let [_ (alog/info ::considering
|
||||
:order order)
|
||||
id (last (str/split order #"/"))
|
||||
id (str/join "-" (drop 2 (str/split order #"-")))
|
||||
lookup-map {"id" "bf3dcf5c-a68f-42d9-9084-049133e03d3d",
|
||||
@@ -341,7 +344,8 @@
|
||||
:when (not= updated-order extant-order)]
|
||||
|
||||
updated-order))]
|
||||
(log/info "Found these orders to update:" orders-to-update)
|
||||
(alog/info :found-orders-to-update
|
||||
:orders orders-to-update)
|
||||
@(d/transact conn orders-to-update)))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user