This commit is contained in:
2023-03-25 15:30:46 -07:00
3 changed files with 317 additions and 3 deletions

View File

@@ -4,12 +4,18 @@
[clojure.tools.logging :as log]
[clojure.edn :as edn]
[config.core :refer [env]]
<<<<<<< HEAD
[datomic.client.api :as dc]
[com.brunobonacci.mulog :as mu]
[mount.core :as mount]
[clojure.java.io :as io])
(:import
(java.util UUID)))
=======
[datomic.api :as d]
[mount.core :as mount]
[com.brunobonacci.mulog :as mu]))
>>>>>>> master
(def uri (:datomic-url env))
@@ -639,8 +645,16 @@
(partition-all 200 txes))))
(defn audit-transact [txes id]
(dc/transact conn {:tx-data (conj txes {:db/id "datomic.tx"
:audit/user (str (:user/role id) "-" (:user/name id))})}))
(try
(dc/transact conn {:tx-data (conj txes {:db/id "datomic.tx"
:audit/user (str (:user/role id) "-" (:user/name id))})})
(catch Exception e
(mu/log ::transaction-error
:exception e
:level :error
:tx txes)
(throw e)
)))
(defn pull-many [db read ids ]
(->> (dc/q '[:find (pull ?e r)

View File

@@ -492,7 +492,8 @@
(defn void-payment [context {id :payment_id} _]
(let [check (d-checks/get-by-id id)]
(assert (or (= :payment-status/pending (:payment/status check))
(#{:payment-type/cash :payment-type/debit :payment-type/balance-credit} (:payment/type check))))
(#{:payment-type/cash :payment-type/debit :payment-type/balance-credit} (:payment/type check)))
(pr-str check))
(assert-can-see-client (:id context) (:db/id (:payment/client check)))
(assert-not-locked (:db/id (:payment/client check)) (:payment/date check))
(let [removing-payments (mapcat (fn [x]