added ability to schedule payment on DOM

This commit is contained in:
Bryce Covert
2020-09-24 11:15:46 -07:00
parent c5ed61b2e1
commit 99e09b1181
8 changed files with 104 additions and 11 deletions

View File

@@ -8,7 +8,7 @@
[clojure.set :as set]))
(defn upsert-vendor [context {{:keys [id name hidden terms code print_as primary_contact secondary_contact address default_account_id invoice_reminder_schedule terms_overrides account_overrides] :as in} :vendor} value]
(defn upsert-vendor [context {{:keys [id name hidden terms code print_as primary_contact secondary_contact address default_account_id invoice_reminder_schedule schedule_payment_dom terms_overrides account_overrides] :as in} :vendor} value]
(when id
(assert-admin (:id context)))
#_(Thread/sleep 3000)
@@ -31,6 +31,13 @@
:account (:account_id ao)}
(:id ao) (assoc :db/id (:id ao))))
account_overrides)
schedule-payment-dom (mapv
(fn [ao]
(cond->
#:vendor-schedule-payment-dom {:client (:client_id ao)
:dom (:dom ao)}
(:id ao) (assoc :db/id (:id ao))))
schedule_payment_dom)
transaction (cond->
[(remove-nils #:vendor {:db/id (if id
id
@@ -73,6 +80,7 @@
)})]
(is-admin? (:id context)) (conj [:reset (if id id "vendor") :vendor/account-overrides account-overrides])
(is-admin? (:id context)) (conj [:reset (if id id "vendor") :vendor/terms-overrides terms-overrides])
(is-admin? (:id context)) (conj [:reset (if id id "vendor") :vendor/schedule-payment-dom schedule-payment-dom])
(is-admin? (:id context)) (conj [:reset (if id id "vendor") :vendor/automatically-paid-when-due
(mapv
(fn [apwd]