When plaid merchant is linked to vendor, automatically code to that vendor.

This commit is contained in:
Bryce
2023-07-24 09:10:28 -07:00
parent dfd1af77c4
commit 445375d15e
54 changed files with 9155 additions and 68 deletions

View File

@@ -247,6 +247,15 @@
(when-not (seq (match-transaction-to-unpaid-invoices amount client))
(apply-rules transaction valid-locations)))
(defn maybe-apply-default-vendor [t]
(cond-> t
(and (not (:transaction/vendor t))
(:transaction/default-vendor t))
(assoc :transaction/vendor (:transaction/default-vendor t))
true
(dissoc :transaction/default-vendor)))
(defn transaction->txs [transaction bank-account apply-rules]
(let [bank-account-id (:db/id bank-account)
client (:client/_bank-accounts bank-account)
@@ -263,6 +272,7 @@
(assoc :transaction/approval-status :transaction-approval-status/unapproved)
maybe-assoc-check-number
code-fn
(maybe-apply-default-vendor)
remove-nils)))