Allows undoing autopayments
This commit is contained in:
@@ -73,6 +73,12 @@
|
||||
(throw (ex-info message
|
||||
{:validation-error message}))))
|
||||
|
||||
(defn assert-failure-ssr
|
||||
([message]
|
||||
(throw (ex-info message
|
||||
{:validation-error message
|
||||
:type :warning}))))
|
||||
|
||||
(defn assert-power-user [id]
|
||||
(when-not (#{"power-user" "admin"} (:user/role id))
|
||||
(alog/warn ::unauthorized :user id :role "power-user")
|
||||
@@ -126,6 +132,12 @@
|
||||
(>= (compare locked-until (coerce/to-date date)) 0))
|
||||
(assert-failure (str "Integreat has locked finances prior to " (-> locked-until coerce/to-date-time (atime/unparse-local atime/normal-date)) ".")))))
|
||||
|
||||
(defn assert-not-locked-ssr [client-id date]
|
||||
(let [locked-until (get-locked-until client-id)]
|
||||
(when (and locked-until
|
||||
(>= (compare locked-until (coerce/to-date date)) 0))
|
||||
(assert-failure-ssr (str "Integreat has locked finances prior to " (-> locked-until coerce/to-date-time (atime/unparse-local atime/normal-date)) ".")))))
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(defn assert-none-locked [client-id dates]
|
||||
(doseq [d dates]
|
||||
|
||||
Reference in New Issue
Block a user