Adds intuit updater
This commit is contained in:
@@ -200,8 +200,8 @@
|
||||
(not= "POSTED" status)
|
||||
:not-posted
|
||||
|
||||
(and (:start-date bank-account)
|
||||
(not (t/after? date (:start-date bank-account))))
|
||||
(and (:bank-account/start-date bank-account)
|
||||
(not (t/after? date (:bank-account/start-date bank-account))))
|
||||
:not-ready
|
||||
|
||||
:else
|
||||
@@ -356,6 +356,29 @@
|
||||
(log/info "Imported grouped transactions")
|
||||
transactions)))
|
||||
|
||||
(defn grouped-new [manual-transactions]
|
||||
(let [transformed-transactions (->> manual-transactions
|
||||
(filter #(= "posted" (:status %)))
|
||||
(group-by #(select-keys % [:date :description-original :amount :client-id :bank-account-id]))
|
||||
(vals)
|
||||
(mapcat (fn [transaction-group]
|
||||
(map
|
||||
(fn [index {:keys [date description-original high-level-category amount bank-account-id client-id] :as transaction}]
|
||||
{:id (str date "-" bank-account-id "-" description-original "-" amount "-" index "-" client-id)
|
||||
:bank-account-id bank-account-id
|
||||
:date (time/unparse date "YYYY-MM-dd")
|
||||
:amount {:amount amount}
|
||||
:description {:original description-original
|
||||
:simple high-level-category}
|
||||
:status "POSTED"})
|
||||
(range)
|
||||
transaction-group))))
|
||||
all-rules (tr/get-all)
|
||||
all-bank-accounts (by :db/id (get-all-bank-accounts))
|
||||
transaction->bank-account (comp all-bank-accounts :bank-account-id)
|
||||
transactions (transactions->txs transformed-transactions nil transaction->bank-account (rm/rule-applying-fn all-rules) (get-existing))]
|
||||
transactions))
|
||||
|
||||
(defn do-import
|
||||
([]
|
||||
(do-import (client/get-transactions)))
|
||||
@@ -378,13 +401,13 @@
|
||||
|
||||
(defn do-import2
|
||||
([]
|
||||
(do-import2 (client2/get-transactions "AFH")))
|
||||
(do-import2 (client2/get-transactions "NGGL")))
|
||||
([transactions]
|
||||
(lc/with-context {:source "Import yodlee transactions"}
|
||||
|
||||
(do
|
||||
(log/info "importing from yodlee2")
|
||||
(let [import-id (start-import :import-source/yodlee "Automated Yodlee User")
|
||||
(let [import-id (start-import :import-source/yodlee2 "Automated Yodlee User")
|
||||
all-bank-accounts (get-all-bank-accounts)
|
||||
transaction->bank-account (comp (by (comp :yodlee-account/id :bank-account/yodlee-account) all-bank-accounts) :accountId)
|
||||
all-rules (tr/get-all)
|
||||
|
||||
Reference in New Issue
Block a user