From 9ff0230cc324bc678fa694fc7816bf6dde9726a4 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Thu, 16 May 2019 16:01:24 -0700 Subject: [PATCH] starting to support looking up by yodlee vendor. --- src/clj/auto_ap/yodlee/import.clj | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/clj/auto_ap/yodlee/import.clj b/src/clj/auto_ap/yodlee/import.clj index 334161e4..a832912a 100644 --- a/src/clj/auto_ap/yodlee/import.clj +++ b/src/clj/auto_ap/yodlee/import.clj @@ -125,7 +125,8 @@ (defn rule-applies? [transaction {:keys [:transaction-rule/description :transaction-rule/dom-gte :transaction-rule/dom-lte :transaction-rule/amount-gte :transaction-rule/amount-lte - :transaction-rule/client :transaction-rule/bank-account]} ] + :transaction-rule/client :transaction-rule/bank-account + :transaction-rule/yodlee-merchant]} ] (println transaction description) (let [transaction-dom (some-> transaction :transaction/date @@ -152,6 +153,10 @@ (= (:transaction/client transaction) (:db/id client)) true) + (if yodlee-merchant + (= (:transaction/yodlee-merchant transaction) + (:db/id yodlee-merchant)) + true) (if bank-account (= (:transaction/bank-account transaction) (:db/id bank-account)) @@ -178,6 +183,8 @@ (more-specific? left right :transaction-rule/dom-gte) (more-specific? left right :transaction-rule/amount-lte) (more-specific? left right :transaction-rule/amount-gte) + (more-specific? left right :transaction-rule/description) + (more-specific? left right :transaction-rule/yodlee-merchant) true]))) @@ -201,8 +208,7 @@ {:transaction-account/account (:db/id (:transaction-rule-account/account tra)) :transaction-account/amount (Math/abs (* (:transaction-rule-account/percentage tra) (:transaction/amount transaction))) - :transaction-account/location (:transaction-rule-account/location tra)} - ) + :transaction-account/location (:transaction-rule-account/location tra)}) (:transaction-rule/accounts top-match)) :transaction/vendor (:db/id (:transaction-rule/vendor top-match))) transaction)))))