Add vendor pre-population for bulk code and individual edit forms
- Add vendor-changed HTMX handlers for both bulk code and individual edit - Pre-populate default account at 100% when vendor is selected and no accounts exist - Fix render-accounts-section to render from step-params correctly - Change bulk code vendor-changed from hx-get to hx-post to include form data - Add routes for vendor-changed endpoints - Update e2e tests to cover vendor pre-population - Run lein cljfmt fix across codebase
This commit is contained in:
@@ -9,21 +9,21 @@
|
||||
(random-tempid)))
|
||||
|
||||
(defn wrap-integration [f bank-account]
|
||||
(try
|
||||
(try
|
||||
(let [result (f)]
|
||||
@(dc/transact-async conn [{:db/id bank-account
|
||||
:bank-account/integration-status
|
||||
{:db/id (bank-account->integration-id bank-account)
|
||||
:integration-status/state :integration-state/success
|
||||
:integration-status/last-attempt (java.util.Date.)
|
||||
:integration-status/last-updated (java.util.Date.)}}])
|
||||
:bank-account/integration-status
|
||||
{:db/id (bank-account->integration-id bank-account)
|
||||
:integration-status/state :integration-state/success
|
||||
:integration-status/last-attempt (java.util.Date.)
|
||||
:integration-status/last-updated (java.util.Date.)}}])
|
||||
result)
|
||||
(catch Exception e
|
||||
@(dc/transact-async conn [{:db/id bank-account
|
||||
:bank-account/integration-status
|
||||
{:db/id (bank-account->integration-id bank-account)
|
||||
:integration-status/state :integration-state/failed
|
||||
:integration-status/last-attempt (java.util.Date.)
|
||||
:integration-status/message (.getMessage e)}}])
|
||||
:bank-account/integration-status
|
||||
{:db/id (bank-account->integration-id bank-account)
|
||||
:integration-status/state :integration-state/failed
|
||||
:integration-status/last-attempt (java.util.Date.)
|
||||
:integration-status/message (.getMessage e)}}])
|
||||
(alog/warn ::integration-failed :error e)
|
||||
nil)))
|
||||
|
||||
@@ -12,15 +12,15 @@
|
||||
[datomic.api :as dc]
|
||||
[iol-ion.utils :refer [remove-nils]]))
|
||||
|
||||
(defn get-intuit-bank-accounts
|
||||
( [db]
|
||||
(dc/q '[:find ?external-id ?ba ?c
|
||||
:in $
|
||||
:where
|
||||
[?c :client/bank-accounts ?ba]
|
||||
[?ba :bank-account/intuit-bank-account ?iab]
|
||||
[?iab :intuit-bank-account/external-id ?external-id]]
|
||||
db))
|
||||
(defn get-intuit-bank-accounts
|
||||
([db]
|
||||
(dc/q '[:find ?external-id ?ba ?c
|
||||
:in $
|
||||
:where
|
||||
[?c :client/bank-accounts ?ba]
|
||||
[?ba :bank-account/intuit-bank-account ?iab]
|
||||
[?iab :intuit-bank-account/external-id ?external-id]]
|
||||
db))
|
||||
([db & client-codes]
|
||||
(dc/q '[:find ?external-id ?ba ?c
|
||||
:in $ [?cc ...]
|
||||
@@ -32,7 +32,6 @@
|
||||
db
|
||||
client-codes)))
|
||||
|
||||
|
||||
(defn intuit->transaction [transaction]
|
||||
(let [check-number (when (not (str/blank? (:Num transaction)))
|
||||
(try
|
||||
@@ -46,7 +45,6 @@
|
||||
:transaction/status "POSTED"}
|
||||
check-number (assoc :transaction/check-number check-number))))
|
||||
|
||||
|
||||
(defn intuits->transactions [transactions bank-account-id client-id]
|
||||
(->> transactions
|
||||
(map intuit->transaction)
|
||||
|
||||
@@ -11,10 +11,9 @@
|
||||
(t/is (= #inst "2021-01-01T00:00:00-08:00" (:transaction/date (sut/intuit->transaction (assoc base-transaction :Date "2021-01-01")))))
|
||||
(t/is (= #inst "2021-06-01T00:00:00-07:00" (:transaction/date (sut/intuit->transaction (assoc base-transaction :Date "2021-06-01")))))))
|
||||
|
||||
|
||||
(t/deftest intuits->transactions
|
||||
(t/testing "should give unique ids to duplicates"
|
||||
(t/is (= ["2021-10-11T00:00:00.000-07:00-123-this is a description-45.23-0-345"
|
||||
"2021-10-11T00:00:00.000-07:00-123-this is a description-45.23-1-345"] (map :transaction/raw-id (sut/intuits->transactions [base-transaction base-transaction]
|
||||
123
|
||||
345))))))
|
||||
123
|
||||
345))))))
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
[clojure.data.csv :as csv]
|
||||
[datomic.api :as dc]))
|
||||
|
||||
|
||||
|
||||
(def columns [:status :raw-date :description-original :high-level-category nil nil :amount nil nil nil nil nil :bank-account-code :client-code])
|
||||
|
||||
(defn tabulate-data [data]
|
||||
@@ -33,12 +31,12 @@
|
||||
|
||||
(defn import-batch [transactions user]
|
||||
(let [bank-account-code->client (into {}
|
||||
(dc/q '[:find ?bac ?c
|
||||
:in $
|
||||
:where
|
||||
[?c :client/bank-accounts ?ba]
|
||||
[?ba :bank-account/code ?bac]]
|
||||
(dc/db conn)))
|
||||
(dc/q '[:find ?bac ?c
|
||||
:in $
|
||||
:where
|
||||
[?c :client/bank-accounts ?ba]
|
||||
[?ba :bank-account/code ?bac]]
|
||||
(dc/db conn)))
|
||||
bank-account-code->bank-account (into {}
|
||||
(dc/q '[:find ?bac ?ba
|
||||
:in $
|
||||
@@ -46,9 +44,9 @@
|
||||
(dc/db conn)))
|
||||
import-batch (t/start-import-batch :import-source/manual user)
|
||||
transactions (->> transactions
|
||||
(map (fn [t]
|
||||
(manual->transaction t bank-account-code->bank-account bank-account-code->client)))
|
||||
(t/apply-synthetic-ids ))]
|
||||
(map (fn [t]
|
||||
(manual->transaction t bank-account-code->bank-account bank-account-code->client)))
|
||||
(t/apply-synthetic-ids))]
|
||||
(try
|
||||
(doseq [transaction transactions]
|
||||
(when-not (seq (:errors transaction))
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
|
||||
(defn parse-date [{:keys [raw-date]}]
|
||||
(when-not
|
||||
(re-find #"\d{1,2}/\d{1,2}/\d{4}" raw-date)
|
||||
(re-find #"\d{1,2}/\d{1,2}/\d{4}" raw-date)
|
||||
(throw (Exception. (str "Date " raw-date " must match MM/dd/yyyy"))))
|
||||
(try
|
||||
(try
|
||||
|
||||
(parse-u/parse-value :clj-time "MM/dd/yyyy" raw-date)
|
||||
(catch Exception e
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
[manifold.deferred :as de]
|
||||
[manifold.executor :as ex]))
|
||||
|
||||
(defn get-plaid-accounts
|
||||
(defn get-plaid-accounts
|
||||
([db]
|
||||
(-> (dc/q '[:find ?ba ?c ?external-id ?t
|
||||
:in $
|
||||
@@ -40,7 +40,6 @@
|
||||
db
|
||||
client-codes))))
|
||||
|
||||
|
||||
(defn plaid->transaction [t plaid-merchant->vendor-id]
|
||||
(alog/info ::trying-transaction :transaction t)
|
||||
(cond-> #:transaction {:description-original (:name t)
|
||||
@@ -57,7 +56,7 @@
|
||||
:db/id (random-tempid)})
|
||||
(not (str/blank? (:check_number t))) (assoc :transaction/check-number (Long/parseLong (:check_number t)))
|
||||
#_#_(plaid-merchant->vendor-id (:merchant_name t)) (assoc :transaction/default-vendor
|
||||
(plaid-merchant->vendor-id (:merchant_name t)))))
|
||||
(plaid-merchant->vendor-id (:merchant_name t)))))
|
||||
|
||||
(defn build-plaid-merchant->vendor-id []
|
||||
(into {}
|
||||
@@ -66,23 +65,22 @@
|
||||
:where
|
||||
[?v :vendor/plaid-merchant ?pm]
|
||||
[?pm :plaid-merchant/name ?pmn]]
|
||||
(dc/db conn ))))
|
||||
|
||||
(dc/db conn))))
|
||||
|
||||
(def single-thread (ex/fixed-thread-executor 1))
|
||||
|
||||
(defn rebuild-search-index []
|
||||
(de/future-with
|
||||
single-thread
|
||||
(auto-ap.solr/index-documents-raw
|
||||
auto-ap.solr/impl
|
||||
"plaid_merchants"
|
||||
(for [[result] (dc/qseq {:query '[:find (pull ?v [:plaid-merchant/name :db/id])
|
||||
:in $
|
||||
:where [?v :plaid-merchant/name]]
|
||||
:args [(dc/db conn)]})]
|
||||
{"id" (:db/id result)
|
||||
"name" (:plaid-merchant/name result)}))))
|
||||
single-thread
|
||||
(auto-ap.solr/index-documents-raw
|
||||
auto-ap.solr/impl
|
||||
"plaid_merchants"
|
||||
(for [[result] (dc/qseq {:query '[:find (pull ?v [:plaid-merchant/name :db/id])
|
||||
:in $
|
||||
:where [?v :plaid-merchant/name]]
|
||||
:args [(dc/db conn)]})]
|
||||
{"id" (:db/id result)
|
||||
"name" (:plaid-merchant/name result)}))))
|
||||
|
||||
(defn upsert-accounts []
|
||||
(try
|
||||
@@ -96,20 +94,16 @@
|
||||
(remove-nils
|
||||
{:plaid-account/external-id (:account_id a)
|
||||
:plaid-account/last-synced (coerce/to-date (coerce/to-date-time (-> item :status :transactions :last_successful_update))) :plaid-account/balance (or (some-> a
|
||||
:balances
|
||||
:current
|
||||
double)
|
||||
0.0)}))))
|
||||
:balances
|
||||
:current
|
||||
double)
|
||||
0.0)}))))
|
||||
(catch Exception e
|
||||
(alog/warn ::couldnt-upsert-account :error e))))
|
||||
|
||||
|
||||
(catch Exception e
|
||||
(alog/warn ::couldnt-upsert-accounts :error e))))
|
||||
|
||||
|
||||
|
||||
|
||||
(defn import-plaid-int []
|
||||
(let [_ (upsert-accounts)
|
||||
import-batch (t/start-import-batch :import-source/plaid "Automated plaid user")
|
||||
@@ -119,8 +113,8 @@
|
||||
(try
|
||||
(doseq [[bank-account-id client-id external-id access-token] (get-plaid-accounts (dc/db conn))
|
||||
:let [transaction-result (wrap-integration #(p/get-transactions access-token external-id start end)
|
||||
bank-account-id)
|
||||
accounts-by-id (by :account_id (:accounts transaction-result))]
|
||||
bank-account-id)
|
||||
accounts-by-id (by :account_id (:accounts transaction-result))]
|
||||
transaction (:transactions transaction-result)]
|
||||
(when (not (:pending transaction))
|
||||
(t/import-transaction! import-batch (assoc (plaid->transaction (assoc transaction
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
(if (and client-id bank-account-id amount)
|
||||
(let [[matching-checks] (d-checks/get-graphql {:client-id client-id
|
||||
:clients [client-id]
|
||||
:bank-account-id bank-account-id
|
||||
:bank-account-id bank-account-id
|
||||
:amount (- amount)
|
||||
:status :payment-status/pending})]
|
||||
(if (= 1 (count matching-checks))
|
||||
@@ -29,7 +29,6 @@
|
||||
nil))
|
||||
nil))
|
||||
|
||||
|
||||
(defn transaction->existing-payment [_ check-number client-id bank-account-id amount id]
|
||||
(alog/info ::searching
|
||||
:client-id client-id
|
||||
@@ -46,7 +45,7 @@
|
||||
check-number
|
||||
(-> (d-checks/get-graphql {:client-id client-id
|
||||
:clients [client-id]
|
||||
:bank-account-id bank-account-id
|
||||
:bank-account-id bank-account-id
|
||||
:check-number check-number
|
||||
:amount (- amount)
|
||||
:status :payment-status/pending})
|
||||
@@ -70,12 +69,12 @@
|
||||
(group-by first) ;; group by vendors
|
||||
vals)
|
||||
considerations (for [candidate-invoices candidate-invoices-vendor-groups
|
||||
invoice-count (range 1 32)
|
||||
consideration (partition invoice-count 1 candidate-invoices)
|
||||
:when (dollars= (reduce (fn [acc [_ _ amount]]
|
||||
(+ acc amount)) 0.0 consideration)
|
||||
(- amount))]
|
||||
consideration)]
|
||||
invoice-count (range 1 32)
|
||||
consideration (partition invoice-count 1 candidate-invoices)
|
||||
:when (dollars= (reduce (fn [acc [_ _ amount]]
|
||||
(+ acc amount)) 0.0 consideration)
|
||||
(- amount))]
|
||||
consideration)]
|
||||
(alog/info ::unfulfilled-autoapayment-considerations
|
||||
:count (count considerations)
|
||||
:amount amount)
|
||||
@@ -85,13 +84,13 @@
|
||||
(alog/info ::searching-unpaid-invoice
|
||||
:client-id client-id
|
||||
:amount amount)
|
||||
(try
|
||||
(try
|
||||
(let [candidate-invoices-vendor-groups (->> (dc/q {:find ['?vendor-id '?e '?outstanding-balance '?d]
|
||||
:in ['$ '?client-id]
|
||||
:where ['[?e :invoice/client ?client-id]
|
||||
'[?e :invoice/status :invoice-status/unpaid]
|
||||
'(not [_ :invoice-payment/invoice ?e])
|
||||
'[?e :invoice/vendor ?vendor-id]
|
||||
'[?e :invoice/vendor ?vendor-id]
|
||||
'[?e :invoice/outstanding-balance ?outstanding-balance]
|
||||
'[?e :invoice/date ?d]]}
|
||||
(dc/db conn) client-id)
|
||||
@@ -110,10 +109,10 @@
|
||||
:amount amount
|
||||
:count (count considerations))
|
||||
considerations)
|
||||
(catch Exception e
|
||||
(alog/error ::cant-get-considerations
|
||||
:error e)
|
||||
[])))
|
||||
(catch Exception e
|
||||
(alog/error ::cant-get-considerations
|
||||
:error e)
|
||||
[])))
|
||||
|
||||
(defn match-transaction-to-single-unfulfilled-autopayments [amount client-id]
|
||||
(let [considerations (match-transaction-to-unfulfilled-autopayments amount client-id)]
|
||||
@@ -134,10 +133,10 @@
|
||||
:transaction/location "A"
|
||||
:transaction/accounts
|
||||
[#:transaction-account
|
||||
{:db/id (random-tempid)
|
||||
:account (:db/id (a/get-account-by-numeric-code-and-sets 21000 ["default"]))
|
||||
:location "A"
|
||||
:amount (Math/abs (:transaction/amount transaction))}])]]
|
||||
{:db/id (random-tempid)
|
||||
:account (:db/id (a/get-account-by-numeric-code-and-sets 21000 ["default"]))
|
||||
:location "A"
|
||||
:amount (Math/abs (:transaction/amount transaction))}])]]
|
||||
|
||||
(conj {:payment/bank-account bank-account-id
|
||||
:payment/client client-id
|
||||
@@ -169,30 +168,26 @@
|
||||
|
||||
(= 1234 (extract-check-number {:transaction/description-original "Check abc 1234"}))
|
||||
|
||||
(= 1234 (extract-check-number {:transaction/description-original "Check abc 4/10 1234"}))
|
||||
(= 1234 (extract-check-number {:transaction/description-original "Check abc 4/10 1234 12/3"}))
|
||||
(= 1234 (extract-check-number {:transaction/description-original "Check abc 4/10 1234"}))
|
||||
(= 1234 (extract-check-number {:transaction/description-original "Check abc 4/10 1234 12/3"}))
|
||||
|
||||
(not= 1234 (extract-check-number {:transaction/description-original "Checkcard 4/10 1234"}))
|
||||
|
||||
)
|
||||
(not= 1234 (extract-check-number {:transaction/description-original "Checkcard 4/10 1234"})))
|
||||
|
||||
(defn find-expected-deposit [client-id amount date]
|
||||
(when date
|
||||
(when date
|
||||
(-> (dc/q
|
||||
'[:find (pull ?ed [:db/id {:expected-deposit/vendor [:db/id]}])
|
||||
:in $ ?c ?a ?d-start
|
||||
'[:find (pull ?ed [:db/id {:expected-deposit/vendor [:db/id]}])
|
||||
:in $ ?c ?a ?d-start
|
||||
:where
|
||||
[?ed :expected-deposit/client ?c]
|
||||
(not [?ed :expected-deposit/status :expected-deposit-status/cleared])
|
||||
[?ed :expected-deposit/date ?d]
|
||||
[(>= ?d ?d-start)]
|
||||
[?ed :expected-deposit/total ?a2]
|
||||
[(auto-ap.utils/dollars= ?a2 ?a)]
|
||||
]
|
||||
[(auto-ap.utils/dollars= ?a2 ?a)]]
|
||||
(dc/db conn) client-id amount (coerce/to-date (t/plus date (t/days -10))))
|
||||
ffirst)))
|
||||
|
||||
|
||||
(defn categorize-transaction [transaction bank-account existing]
|
||||
(cond (= :transaction-approval-status/suppressed (existing (:transaction/id transaction)))
|
||||
:suppressed
|
||||
@@ -235,7 +230,6 @@
|
||||
(assoc transaction :transaction/check-number check-number)
|
||||
transaction))
|
||||
|
||||
|
||||
(defn maybe-clear-payment [{:transaction/keys [check-number client bank-account amount id] :as transaction}]
|
||||
(when-let [existing-payment (transaction->existing-payment transaction check-number client bank-account amount id)]
|
||||
(assoc transaction
|
||||
@@ -245,10 +239,10 @@
|
||||
:transaction/vendor (:db/id (:payment/vendor existing-payment))
|
||||
:transaction/location "A"
|
||||
:transaction/accounts [#:transaction-account
|
||||
{:db/id (random-tempid)
|
||||
:account (:db/id (a/get-account-by-numeric-code-and-sets 21000 ["default"]))
|
||||
:location "A"
|
||||
:amount (Math/abs (double amount))}])))
|
||||
{:db/id (random-tempid)
|
||||
:account (:db/id (a/get-account-by-numeric-code-and-sets 21000 ["default"]))
|
||||
:location "A"
|
||||
:amount (Math/abs (double amount))}])))
|
||||
|
||||
#_{:clj-kondo/ignore [:clojure-lsp/unused-public-var]}
|
||||
(defn maybe-autopay-invoices [{:transaction/keys [amount client bank-account] :as transaction}]
|
||||
@@ -266,8 +260,7 @@
|
||||
:transaction-account/amount amount
|
||||
:transaction-account/location "A"}]
|
||||
:transaction/approval-status :transaction-approval-status/approved
|
||||
:transaction/vendor (:db/id (:expected-deposit/vendor expected-deposit))
|
||||
))))
|
||||
:transaction/vendor (:db/id (:expected-deposit/vendor expected-deposit))))))
|
||||
|
||||
(defn maybe-code [{:transaction/keys [client amount] :as transaction} apply-rules valid-locations]
|
||||
(mu/trace
|
||||
@@ -304,7 +297,6 @@
|
||||
(maybe-apply-default-vendor)
|
||||
remove-nils)))
|
||||
|
||||
|
||||
(defn get-existing [bank-account]
|
||||
(into {}
|
||||
(dc/q '[:find ?tid ?as2
|
||||
@@ -317,7 +309,7 @@
|
||||
|
||||
(defprotocol ImportBatch
|
||||
(import-transaction! [this transaction])
|
||||
(get-stats [this ])
|
||||
(get-stats [this])
|
||||
(get-pending-balance [this bank-account])
|
||||
(finish! [this])
|
||||
(fail! [this error]))
|
||||
@@ -326,21 +318,21 @@
|
||||
:db/id
|
||||
:bank-account/locations
|
||||
:bank-account/start-date
|
||||
{:client/_bank-accounts [:client/code :client/locked-until :client/locations :db/id]} ])
|
||||
{:client/_bank-accounts [:client/code :client/locked-until :client/locations :db/id]}])
|
||||
|
||||
(defn start-import-batch [source user]
|
||||
(let [stats (atom {:import-batch/imported 0
|
||||
:import-batch/suppressed 0
|
||||
:import-batch/error 0
|
||||
:import-batch/not-ready 0
|
||||
:import-batch/extant 0})
|
||||
:import-batch/suppressed 0
|
||||
:import-batch/error 0
|
||||
:import-batch/not-ready 0
|
||||
:import-batch/extant 0})
|
||||
pending-balance (atom {})
|
||||
extant-cache (atom (cache/ttl-cache-factory {} :ttl 60000 ))
|
||||
extant-cache (atom (cache/ttl-cache-factory {} :ttl 60000))
|
||||
import-id (get (:tempids @(dc/transact-async conn [{:db/id "import-batch"
|
||||
:import-batch/date (coerce/to-date (t/now))
|
||||
:import-batch/source source
|
||||
:import-batch/status :import-status/started
|
||||
:import-batch/user-name user}])) "import-batch")
|
||||
:import-batch/date (coerce/to-date (t/now))
|
||||
:import-batch/source source
|
||||
:import-batch/status :import-status/started
|
||||
:import-batch/user-name user}])) "import-batch")
|
||||
rule-applying-function (rm/rule-applying-fn (tr/get-all))]
|
||||
(alog/info ::starting-transaction-import
|
||||
:source source)
|
||||
@@ -349,17 +341,17 @@
|
||||
(import-transaction! [_ transaction]
|
||||
(let [bank-account (dc/pull (dc/db conn)
|
||||
bank-account-pull
|
||||
(:transaction/bank-account transaction))
|
||||
(:transaction/bank-account transaction))
|
||||
extant (get (swap! extant-cache cache/through-cache (:transaction/bank-account transaction) get-existing)
|
||||
(:transaction/bank-account transaction))
|
||||
action (categorize-transaction transaction bank-account extant)]
|
||||
(try
|
||||
(try
|
||||
(when (not= "POSTED" (:transaction/status transaction))
|
||||
|
||||
(swap! pending-balance (fn [pb]
|
||||
(update pb
|
||||
(update pb
|
||||
(:transaction/bank-account transaction)
|
||||
(fnil + 0.0)
|
||||
(fnil + 0.0)
|
||||
(:transaction/amount transaction)))))
|
||||
(catch Exception e
|
||||
(alog/warn ::cant-capture-pending
|
||||
@@ -372,7 +364,7 @@
|
||||
:error :import-batch/error
|
||||
:not-ready :import-batch/not-ready) inc))
|
||||
(when (= :import action)
|
||||
(try
|
||||
(try
|
||||
(let [result (audit-transact [[:upsert-transaction (transaction->txs transaction bank-account rule-applying-function)]
|
||||
{:db/id import-id
|
||||
:import-batch/entry (:db/id transaction)}]
|
||||
@@ -390,14 +382,14 @@
|
||||
(get-stats [_]
|
||||
@stats)
|
||||
(get-pending-balance [_ bank-account]
|
||||
(or (get @pending-balance bank-account)
|
||||
0.0))
|
||||
(or (get @pending-balance bank-account)
|
||||
0.0))
|
||||
|
||||
(fail! [_ error]
|
||||
(alog/error ::cant-complete-import
|
||||
:import-id import-id
|
||||
:error error)
|
||||
|
||||
|
||||
@(dc/transact-async conn [(merge {:db/id import-id
|
||||
:import-batch/status :import-status/completed
|
||||
:import-batch/error-message (str error)}
|
||||
@@ -407,12 +399,10 @@
|
||||
(alog/info ::finished :import-id import-id :source source :stats (pr-str @stats))
|
||||
@(dc/transact conn [(merge {:db/id import-id
|
||||
|
||||
:import-batch/status :import-status/completed}
|
||||
@stats)])))))
|
||||
:import-batch/status :import-status/completed}
|
||||
@stats)])))))
|
||||
|
||||
|
||||
|
||||
(defn synthetic-key [{:transaction/keys [date bank-account description-original amount client] } index]
|
||||
(defn synthetic-key [{:transaction/keys [date bank-account description-original amount client]} index]
|
||||
(str (str (some-> date coerce/to-date-time atime/localize)) "-" bank-account "-" description-original "-" amount "-" index "-" client))
|
||||
|
||||
(defn apply-synthetic-ids [transactions]
|
||||
@@ -424,7 +414,7 @@
|
||||
(let [raw-id (synthetic-key transaction index)]
|
||||
(assoc transaction
|
||||
:transaction/id #_{:clj-kondo/ignore [:unresolved-var]}
|
||||
(di/sha-256 raw-id)
|
||||
(di/sha-256 raw-id)
|
||||
:transaction/raw-id raw-id
|
||||
:db/id (random-tempid))))
|
||||
(range)
|
||||
|
||||
@@ -73,10 +73,10 @@
|
||||
(alog/info ::finished-import)
|
||||
(t/finish! import-batch)
|
||||
(doseq [[_ bank-account _ _ ya] account-lookup]
|
||||
(try
|
||||
(try
|
||||
@(dc/transact auto-ap.datomic/conn
|
||||
[{:db/id ya
|
||||
:yodlee-account/pending-balance (t/get-pending-balance import-batch bank-account)}])
|
||||
[{:db/id ya
|
||||
:yodlee-account/pending-balance (t/get-pending-balance import-batch bank-account)}])
|
||||
(catch Exception e
|
||||
(alog/error ::cant-persist-yodlee-account-pending-balance
|
||||
:error e)))))
|
||||
@@ -95,5 +95,4 @@
|
||||
nil)
|
||||
(Thread/sleep 10000)))))
|
||||
|
||||
|
||||
(def import-yodlee2 (allow-once import-yodlee2-int))
|
||||
|
||||
Reference in New Issue
Block a user