This commit is contained in:
Bryce Covert
2021-10-05 16:23:15 -07:00
parent c97b160583
commit 6dd801d710
2 changed files with 29 additions and 0 deletions

View File

@@ -83,6 +83,10 @@
{:square-location "LSWNP14T0YKD9",
:location "WL",
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
"NGWH"
{:square-location "L8XFVAYYK6QGM",
:location "WH",
:token "EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"},
"NGMJ"
{:square-location "FNH5VRT890WK8",
:location "SC",

View File

@@ -4,6 +4,7 @@
[auto-ap.utils :refer [by]]
[clojure.core.async :as async]
#_[auto-ap.ledger :as l]
[unilog.context :as lc]
[mount.core :as mount]
[auto-ap.server ]
[datomic.api :as d]
@@ -593,3 +594,27 @@
)])))
(defn historical-load-sales [client-code days]
(println "orders")
(lc/with-context {:source "Historical loading data"}
(doseq [d (clj-time.periodic/periodic-seq (t/plus (t/now) (t/days (- days)))
(t/now)
(t/days 1))]
(println d)
(auto-ap.square.core/upsert client-code d)))
(println "refunds")
(auto-ap.square.core/upsert-refunds client-code)
(with-redefs [auto-ap.square.core/lookup-dates (fn lookup-dates []
(->> (clj-time.periodic/periodic-seq (t/plus (t/now) (t/days (- days)))
(t/now)
(t/days 2))
(map (fn [d]
[(auto-ap.time/unparse (t/plus d (t/days 1)) auto-ap.time/iso-date)
(auto-ap.time/unparse (t/plus d (t/days 2)) auto-ap.time/iso-date)]))))]
(auto-ap.square.core/upsert-settlements client-code)))