From d0b5772d947574685b9ed60e3fb3252f4ce48c26 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Thu, 16 May 2019 23:02:28 -0700 Subject: [PATCH] supports testing with yodlee merchant. --- src/clj/auto_ap/graphql/transaction_rules.clj | 7 ++++++- src/cljs/auto_ap/views/pages/admin/rules/form.cljs | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/clj/auto_ap/graphql/transaction_rules.clj b/src/clj/auto_ap/graphql/transaction_rules.clj index 344eec45..ee06b70a 100644 --- a/src/clj/auto_ap/graphql/transaction_rules.clj +++ b/src/clj/auto_ap/graphql/transaction_rules.clj @@ -93,7 +93,7 @@ (defn tr [z x] (re-find (re-pattern z) x)) -(defn test-transaction-rule [{:keys [id]} {{:keys [description note client_id bank_account_id amount_lte amount_gte dom_lte dom_gte]} :transaction_rule :as z} value] +(defn test-transaction-rule [{:keys [id]} {{:keys [description note client_id bank_account_id amount_lte amount_gte dom_lte dom_gte yodlee_merchant_id]} :transaction_rule :as z} value] (->> (d/query (cond-> {:query {:find ['(pull ?e [* {:transaction/client [:client/name] @@ -119,6 +119,11 @@ '[(re-find ?description-regex ?do)]]} :args [(re-pattern description)]}) + yodlee_merchant_id + (merge-query {:query {:in ['?yodlee-merchant-id] + :where ['[?e :transaction/yodlee-merchant ?yodlee-merchant-id]]} + :args [yodlee_merchant_id]}) + amount_gte (merge-query {:query {:in ['?amount-gte] :where ['[?e :transaction/amount ?ta] diff --git a/src/cljs/auto_ap/views/pages/admin/rules/form.cljs b/src/cljs/auto_ap/views/pages/admin/rules/form.cljs index 7cbc1e54..f1c4ed03 100644 --- a/src/cljs/auto_ap/views/pages/admin/rules/form.cljs +++ b/src/cljs/auto_ap/views/pages/admin/rules/form.cljs @@ -72,6 +72,7 @@ :dom-lte :dom-gte :note]) + (assoc :yodlee-merchant-id (:id (:yodlee-merchant data))) (assoc :client-id (:id (:client data))) (assoc :bank-account-id (:id (:bank-account data))))} [:id