   [transaction]
   (with-transacted-storage (env :db)
     (let [validated (validate transaction ::existing-transaction)]
-      (if (validation/has-error? validated)
+      (if (v/has-error? validated)
         validated
         (let [existing (find-existing-transaction transaction)
               dereferenced-items (->> (:items existing)


(s/def ::account-id integer?)
(s/def ::action #{:debit :credit})
(s/def ::quantity validation/big-dec-not-less-than-zero?)
; Balance is the running total of quantities for the account to which
; the item belongs
(s/def ::balance (partial instance? BigDecimal))

                    (filter #(= action (:action %)))
                    (map :value))))

(defn- ^{::v/message "The total debits does not match the total credits"
         ::v/path [:items]}
  sum-of-credits-must-equal-sum-of-debits
  [transaction]
  (->> [:debit :credit]
       (map #(item-value-sum transaction %))
       (apply =)))

(defn- ^{::v/message "Each item must have the same transaction-date as the transaction"
         ::v/path [:items]}
  transaction-dates-must-match
  [{:keys [transaction-date items]}]
  (->> items
