makes plaid really usable, allowing choosing on bank screen, and searchable on vendors page.

This commit is contained in:
Bryce
2023-07-22 21:33:06 -07:00
parent ff2d64fee5
commit dfd1af77c4
15 changed files with 101 additions and 21 deletions

View File

@@ -25,16 +25,18 @@
(defn plaid->transaction [t]
#:transaction {:description-original (:name t)
:raw-id (:transaction_id t)
:db/id (random-tempid)
:id #_{:clj-kondo/ignore [:unresolved-var]}
(di/sha-256 (:transaction_id t))
:amount (if (= "credit" (:type (:account t)))
(- (double (:amount t)))
(double (:amount t)))
:date (coerce/to-date (atime/parse (:authorized_date t) atime/iso-date))
:status "POSTED"})
(cond-> #:transaction {:description-original (:name t)
:raw-id (:transaction_id t)
:db/id (random-tempid)
:id #_{:clj-kondo/ignore [:unresolved-var]}
(di/sha-256 (:transaction_id t))
:amount (if (= "credit" (:type (:account t)))
(- (double (:amount t)))
(double (:amount t)))
:date (coerce/to-date (atime/parse (:authorized_date t) atime/iso-date))
:status "POSTED"}
(:merchant_name t) (assoc :transaction/plaid-merchant {:plaid-merchant/name (:merchant_name t)
:db/id (random-tempid)})))
(defn import-plaid-int []
@@ -53,6 +55,7 @@
:account
(accounts-by-id (:account_id transaction))))
:transaction/bank-account bank-account-id
:transaction/client client-id))))
(t/finish! import-batch)
(catch Exception e