added start date.

This commit is contained in:
Bryce Covert
2020-08-26 06:31:49 -07:00
parent 4ac3e31e91
commit 1832aad335
8 changed files with 293 additions and 242 deletions

View File

@@ -14,7 +14,8 @@
[auto-ap.rule-matching :as rm]
[clojure.string :as str]
[unilog.context :as lc]
[clojure.tools.logging :as log]))
[clojure.tools.logging :as log]
[clj-time.core :as t]))
(defn rough-match [client-id bank-account-id amount]
@@ -89,17 +90,21 @@
client (:client/_bank-accounts bank-account)
client-id (:db/id client)
valid-locations (or (:bank-account/locations bank-account) (:client/locations client))
check (transaction->payment transaction check-number client-id bank-account-id amount id)]
check (transaction->payment transaction check-number client-id bank-account-id amount id)
date (time/parse date "YYYY-MM-dd")]
:when (and client-id
(not (existing (sha-256 (str id))))
(= "POSTED" status)
(or (not (:start-date bank-account))
(t/after? date (:start-date bank-account)))
)]
(->
#:transaction
{:post-date (coerce/to-date (time/parse post-date "YYYY-MM-dd"))
:id (sha-256 (str id))
:account-id account-id
:date (coerce/to-date (time/parse date "YYYY-MM-dd"))
:date (coerce/to-date date)
:amount (double amount)
:description-original (some-> description-original (str/replace #"\s+" " "))
:description-simple (some-> description-simple (str/replace #"\s+" " "))