diff --git a/src/clj/auto_ap/square/core.clj b/src/clj/auto_ap/square/core.clj index 92f4a170..02c0d9a2 100644 --- a/src/clj/auto_ap/square/core.clj +++ b/src/clj/auto_ap/square/core.clj @@ -1,20 +1,20 @@ (ns auto-ap.square.core (:require [auto-ap.datomic :refer [conn remove-nils]] [auto-ap.time :as atime] + [auto-ap.utils :refer [allow-once]] [clj-http.client :as client] [clj-time.coerce :as coerce] [clj-time.core :as time] - [clj-time.periodic :as periodic] [clj-time.format :as f] - [clojure.string :as str] + [clj-time.periodic :as periodic] + [clojure.core.async :as async] [clojure.data.json :as json] + [clojure.string :as str] [clojure.tools.logging :as log] [datomic.api :as d] [mount.core :as mount] [unilog.context :as lc] - #_{:clj-kondo/ignore [:unused-namespace]} - [yang.scheduler :as scheduler] - [clojure.core.async :as async])) + [yang.scheduler :as scheduler])) (defn client-base-headers [client] {"Square-Version" "2021-08-18" @@ -481,12 +481,9 @@ (log/info "Loading refunds") (upsert-refunds client)))) +(def upsert-all (allow-once upsert-all)) + (mount/defstate square-loader :start (scheduler/every (* 4 59 60 1000) upsert-all) :stop (scheduler/stop square-loader)) - - - - - diff --git a/src/cljs/auto_ap/views/pages/transactions/form.cljs b/src/cljs/auto_ap/views/pages/transactions/form.cljs index a6be06a2..d14174f6 100644 --- a/src/cljs/auto_ap/views/pages/transactions/form.cljs +++ b/src/cljs/auto_ap/views/pages/transactions/form.cljs @@ -432,6 +432,7 @@ :field [:accounts] :max (Math/abs (js/parseFloat (:amount data))) :descriptor "credit account" + :client (:client data) :disabled (or (boolean (:payment data)) should-disable-for-client?) :locations locations}])