80 lines
3.2 KiB
Plaintext
80 lines
3.2 KiB
Plaintext
;; This buffer is for Clojure experiments and evaluation.
|
|
|
|
;; Press C-j to evaluate the last expression.
|
|
|
|
;; You can also press C-u C-j to evaluate the expression and pretty-print its result.
|
|
|
|
(def c
|
|
(first (get-square-clients "NGOP")))
|
|
|
|
(def l {:db/id 17592186051554,
|
|
:square-location/name "Almaden",
|
|
:square-location/square-id "68MJ8J2RX7KE1"})
|
|
|
|
@(cash-drawer-shifts c l )
|
|
|
|
@(get-cash-shift c "ac34dc1e-5d2e-4a83-929c-c33e24ba2882")
|
|
@(get-cash-shift-events c "ac34dc1e-5d2e-4a83-929c-c33e24ba2882")
|
|
|
|
@(cash-drawer-shifts c l)
|
|
|
|
@(upsert-cash-shifts c)
|
|
|
|
@(d/transact auto-ap.datomic/conn [{:db/ident :cash-drawer-shift/external-id
|
|
:db/doc "The client for the sale"
|
|
:db/valueType :db.type/string
|
|
:db/cardinality :db.cardinality/one
|
|
:db/unique :db.unique/identity}
|
|
|
|
{:db/ident :cash-drawer-shift/client
|
|
:db/doc "The client for the sale"
|
|
:db/valueType :db.type/ref
|
|
:db/cardinality :db.cardinality/one}
|
|
|
|
{:db/ident :cash-drawer-shift/vendor
|
|
:db/doc "The client for the sale"
|
|
:db/valueType :db.type/ref
|
|
:db/cardinality :db.cardinality/one}
|
|
|
|
{:db/ident :cash-drawer-shift/location
|
|
:db/doc "The location of the sale"
|
|
:db/valueType :db.type/string
|
|
:db/cardinality :db.cardinality/one}
|
|
|
|
{:db/ident :cash-drawer-shift/date
|
|
:db/doc "The date the order was placed"
|
|
:db/valueType :db.type/instant
|
|
:db/cardinality :db.cardinality/one}
|
|
|
|
{:db/ident :cash-drawer-shift/paid-in
|
|
:db/doc "The amount of money added to the cash drawer for reasons other than cash payments. "
|
|
:db/valueType :db.type/double
|
|
:db/cardinality :db.cardinality/one}
|
|
|
|
{:db/ident :cash-drawer-shift/paid-out
|
|
:db/doc "The amount of money removed from the cash drawer for reasons other than cash refunds."
|
|
:db/valueType :db.type/double
|
|
:db/cardinality :db.cardinality/one}
|
|
|
|
{:db/ident :cash-drawer-shift/expected-cash
|
|
:db/doc "The amount of money that should be in the cash drawer at the end of the shift, based on the shift's other money amounts."
|
|
:db/valueType :db.type/double
|
|
:db/cardinality :db.cardinality/one}
|
|
|
|
{:db/ident :cash-drawer-shift/opened-cash
|
|
:db/doc "The amount of money in the cash drawer at the start of the shift."
|
|
:db/valueType :db.type/double
|
|
:db/cardinality :db.cardinality/one}
|
|
|
|
])
|
|
|
|
(defn get-cash-shift-events [client id]
|
|
(de/chain (manifold-api-call {:url (str (url/url "https://connect.squareup.com/v2/cash-drawers/shifts" id "events"
|
|
|
|
))
|
|
:method :get
|
|
|
|
:headers (client-base-headers client "2023-04-19")
|
|
:as :json})
|
|
:body))
|