From 205c132b7cd01e70ef1d076627b4a8f95153c79f Mon Sep 17 00:00:00 2001 From: Bryce Date: Mon, 31 Jul 2023 16:17:19 -0700 Subject: [PATCH] inverting plaid account settings, adding check numbers --- src/clj/auto_ap/import/plaid.clj | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/clj/auto_ap/import/plaid.clj b/src/clj/auto_ap/import/plaid.clj index c07ec23a..8b92acf0 100644 --- a/src/clj/auto_ap/import/plaid.clj +++ b/src/clj/auto_ap/import/plaid.clj @@ -14,7 +14,8 @@ [digest :as di] [manifold.deferred :as de] [manifold.executor :as ex] - [unilog.context :as lc])) + [unilog.context :as lc] + [clojure.string :as str])) (defn get-plaid-accounts [db] (-> (dc/q '[:find ?ba ?c ?external-id ?t @@ -36,12 +37,13 @@ :id #_{:clj-kondo/ignore [:unresolved-var]} (di/sha-256 (:transaction_id t)) :amount (if (= "credit" (:type (:account t))) - (- (double (:amount t))) - (double (:amount t))) + (double (:amount t)) + (- (double (:amount t)))) :date (coerce/to-date (atime/parse (or (:authorized_date t) (:date t)) atime/iso-date)) :status "POSTED"} (:merchant_name t) (assoc :transaction/plaid-merchant {:plaid-merchant/name (:merchant_name t) :db/id (random-tempid)}) + (not (str/blank? (:check_number t))) (assoc :transaction/check-number (Integer/parseInt (:check_number t))) (plaid-merchant->vendor-id (:merchant_name t)) (assoc :transaction/default-vendor (plaid-merchant->vendor-id (:merchant_name t)))))