Fixes bug with client page

This commit is contained in:
2024-04-01 19:46:37 -07:00
parent 3957286624
commit 72a17486cd
4 changed files with 58 additions and 18 deletions

View File

@@ -863,3 +863,47 @@
@(apply upsert-all clients)))
(comment
(defn refunds-raw-cont
([client l cursor so-far]
(de/chain (manifold-api-call {:url (str "https://connect.squareup.com/v2/refunds?location_id=" (:square-location/square-id l)
(when cursor
(str "&cursor=" cursor))
"&begin_time=2024-03-12T19:59:05.342Z")
:method :get
:headers (client-base-headers client)
:as :json})
:body
(fn [rr]
(if (:cursor rr)
(refunds-raw-cont client l (:cursor rr)
(concat so-far (:refunds rr)))
(concat so-far (:refunds rr)))))))
#_(defn refunds-raw
([client l]
(de/chain (manifold-api-call {:url (str "https://connect.squareup.com/v2/refunds?location_id=" (:square-location/square-id l) "&begin_time=2024-03-14&end_time=2024-03-15")
:method :get
:headers (client-base-headers client)
:as :json})
:body)))
(def refs
(->>
@(let [[c [l]] (get-square-client-and-location "NGCL")]
(refunds-raw-cont c l nil []))
(filter (fn [r]
(str/starts-with? (:created_at r) "2024-03-14")))))
(let [[c [l]] (get-square-client-and-location "NGCL")]
#_(get-payment c l )
(map (fn [r] @(get-payment c (:payment_id r))) refs))
)