no need for transact-with-ledger.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
[config.core :refer [env]]
|
||||
[datomic.client.api :as dc]
|
||||
[digest]
|
||||
[iol-ion.tx :refer [propose-invoice]]
|
||||
[iol-ion.tx :refer [propose-invoice random-tempid]]
|
||||
[ring.middleware.json :refer [wrap-json-response]]
|
||||
[unilog.context :as lc])
|
||||
(:import
|
||||
@@ -150,7 +150,8 @@
|
||||
matching-client)
|
||||
text
|
||||
full-text))]
|
||||
#:invoice {:invoice/client matching-client
|
||||
#:invoice {:db/id (random-tempid)
|
||||
:invoice/client matching-client
|
||||
:invoice/client-identifier (or account-number customer-identifier)
|
||||
:invoice/vendor (:db/id matching-vendor)
|
||||
:invoice/source-url source-url
|
||||
@@ -175,29 +176,6 @@
|
||||
|
||||
invoice)
|
||||
|
||||
(defn extant-invoice? [{:invoice/keys [invoice-number vendor client]}]
|
||||
(try
|
||||
(->> (dc/q
|
||||
(cond-> {:query {:find ['?e '?outstanding-balance '?status '?import-status2]
|
||||
:in ['$ '?invoice-number '?vendor '?client]
|
||||
:where '[[?e :invoice/invoice-number ?invoice-number]
|
||||
[?e :invoice/vendor ?vendor]
|
||||
[?e :invoice/client ?client]
|
||||
[?e :invoice/outstanding-balance ?outstanding-balance]
|
||||
[?e :invoice/status ?status]
|
||||
[?e :invoice/import-status ?import-status]
|
||||
[?import-status :db/ident ?import-status2]]}
|
||||
:args [(dc/db conn) invoice-number vendor client]}))
|
||||
first
|
||||
boolean)
|
||||
(catch Exception e
|
||||
(throw (ex-info (str "Failed to find potential matching invoice with"
|
||||
" invoice " invoice-number
|
||||
" vendor " vendor
|
||||
" client " client
|
||||
". "
|
||||
(.toString e))
|
||||
{:invoice-number invoice-number})))))
|
||||
|
||||
(defn invoice-rows->transaction [rows user]
|
||||
(->> rows
|
||||
|
||||
Reference in New Issue
Block a user