switched from auto pay to scheduled payment

This commit is contained in:
Bryce Covert
2020-09-24 08:06:17 -07:00
parent 4ab492d759
commit c5ed61b2e1
16 changed files with 918 additions and 39 deletions

View File

@@ -15,12 +15,11 @@
(let [invoices-to-close (d/query {:query {:find ['?e]
:in ['$ '?today]
:where ['[?e :invoice/automatically-paid-when-due true]
:where ['[?e :invoice/scheduled-payment ?d]
'[?e :invoice/status :invoice-status/unpaid]
'[?e :invoice/due ?d]
'[(<= ?d ?today)]]}
:args [(d/db conn) (coerce/to-date (time/local-now))]})]
(log/info "Closing " (count invoices-to-close) "automatic invoices")
(log/info "Closing " (count invoices-to-close) "scheduled invoices")
(some->> invoices-to-close
seq
@@ -29,7 +28,7 @@
:invoice/status :invoice-status/paid}))
(d/transact conn)
deref)
(log/info "Closed " (count invoices-to-close) "automatic invoices"))
(log/info "Closed " (count invoices-to-close) "scheduled invoices"))
(catch Exception e
(log/error e)))))