starting to support looking up by yodlee vendor.

This commit is contained in:
Bryce Covert
2019-05-16 16:01:24 -07:00
parent 26fbb89345
commit 9ff0230cc3

View File

@@ -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)))))