makes signature show up and adds logging for why invoice might be imported wrong.

This commit is contained in:
2024-05-30 20:36:03 -07:00
parent e43f313ac0
commit bd3432f540
4 changed files with 30 additions and 7 deletions

View File

@@ -54,6 +54,12 @@
account-number (:db/id (d-clients/exact-match account-number))
customer-identifier (:db/id (d-clients/best-match customer-identifier))
client-override (Long/parseLong client-override))
_ (alog/info ::client-matched
:account-number account-number
:customer-identifier customer-identifier
:client-override client-override
:matching (when matching-client
(dc/pull (dc/db conn) [:client/name :client/code] matching-client)))
matching-vendor (match-vendor vendor-code vendor-override)
matching-location (or (when-not (str/blank? location-override)

View File

@@ -969,9 +969,17 @@
:headers (client-base-headers client)
:as :json})
:body)))
(->>
@(let [[c [l]] (get-square-client-and-location "NGGG")]
(search c l (time/plus (time/now))))
(filter (fn [r]
(str/starts-with? (:created_at r) "2024-03-14"))))
(def refs
(->>
@(let [[c [l]] (get-square-client-and-location "NGCL")]
@(let [[c [l]] (get-square-client-and-location "NGGG")]
(refunds-raw-cont c l nil []))
@@ -984,6 +992,8 @@
(map (fn [r] @(get-payment c (:payment_id r))) refs))
(get-square-client-and-location "NGGB")
(def my-results
(let [[c [l]] (get-square-client-and-location "NGFA")]))

View File

@@ -579,13 +579,19 @@
(defn import->invoice [{:keys [invoice-number source-url customer-identifier account-number total date vendor-code text full-text client-override vendor-override location-override import-status]}]
(let [matching-client (cond
client-override client-override
account-number (:db/id (d-clients/exact-match account-number))
customer-identifier (:db/id (d-clients/best-match customer-identifier)))
client-override client-override
account-number (:db/id (d-clients/exact-match account-number))
customer-identifier (:db/id (d-clients/best-match customer-identifier)))
_ (alog/info ::client-matched
:account-number account-number
:customer-identifier customer-identifier
:client-override client-override
:matching (when matching-client
(dc/pull (dc/db conn) [:client/name :client/code] matching-client)))
matching-vendor (match-vendor vendor-code vendor-override)
matching-location (or (when-not (str/blank? location-override)
location-override)
location-override)
(parse/best-location-match (dc/pull (dc/db conn)
[{:client/location-matches [:location-match/location :location-match/matches]}
:client/default-location

View File

@@ -19,7 +19,8 @@
(cond (#{:user-role/admin "admin"} role)
true
(and client-id (not (get (into #{} (map :db/id (:clients user))) client-id)))
(and client-id (not (get (into #{} (map :db/id (or (:clients user)
(:user/clients user)))) client-id)))
false
(#{:user-role/power-user "power-user"} role)