yodlee merchant or description

This commit is contained in:
Bryce Covert
2019-05-16 16:37:45 -07:00
parent 9ff0230cc3
commit 21f7ac32b9
5 changed files with 45 additions and 13 deletions

View File

@@ -1,5 +1,6 @@
(ns auto-ap.entities.transaction-rule
(:require [clojure.spec.alpha :as s]))
(:require [clojure.spec.alpha :as s]
[clojure.string :as str]))
(s/def ::client (s/nilable map?))
(s/def ::description (s/nilable string?))
@@ -7,8 +8,22 @@
(s/def ::amount-lte (s/nilable double?))
(s/def ::dom-gte (s/nilable int?))
(s/def ::dom-lte (s/nilable int?))
(s/def ::note (s/nilable string?))
(s/def ::note (s/and string?
#(not (str/blank? %))))
(s/def ::bank-account (s/nilable map?))
(s/def ::vendor (s/nilable map?))
(s/def ::yodlee-merchant (s/nilable map?))
(s/def ::transaction-rule (s/keys :req-un [::client ::description ::amount-gte ::amount-lte ::dom-gte ::dom-lte ::note ::bank-account ::vendor]))
(s/def ::transaction-rule (s/and (s/keys :req-un [::client
::description
::amount-gte
::amount-lte
::dom-gte
::dom-lte
::note
::bank-account
::vendor
::yodlee-merchant])
(s/or :description-required #(not (str/blank? (:description %)))
:description-required #(not (nil? (:yodlee-merchant %))))))