no need for ledger automation.

This commit is contained in:
2022-09-27 17:04:47 -07:00
parent 90743ab3a3
commit 63254ba401
9 changed files with 163 additions and 201 deletions

View File

@@ -1,7 +1,7 @@
(ns auto-ap.graphql.checks
(:require
[amazonica.aws.s3 :as s3]
[auto-ap.datomic :refer [audit-transact remove-nils conn]]
[auto-ap.datomic :refer [conn remove-nils]]
[auto-ap.datomic.accounts :as a]
[auto-ap.datomic.bank-accounts :as d-bank-accounts]
[auto-ap.datomic.checks :as d-checks]
@@ -10,7 +10,14 @@
[auto-ap.datomic.transactions :as d-transactions]
[auto-ap.datomic.vendors :as d-vendors]
[auto-ap.graphql.utils
:refer [->graphql <-graphql assert-admin assert-failure assert-can-see-client enum->keyword assert-not-locked]]
:refer [->graphql
<-graphql
assert-admin
assert-can-see-client
assert-failure
assert-not-locked
enum->keyword]]
[auto-ap.ledger :refer [transact-with-ledger]]
[auto-ap.numeric :refer [num->words]]
[auto-ap.time :refer [iso-date local-now parse]]
[auto-ap.utils :refer [by dollars-0?]]
@@ -405,7 +412,7 @@
(make-pdfs (filter #(and (= :payment-type/check (:payment/type %))
(> (:payment/amount %) 0.0))
checks)))
(audit-transact checks id)
(transact-with-ledger checks id)
{:invoices (d-invoices/get-multi (map :invoice-id invoice-payments))
@@ -461,7 +468,7 @@
0
invoice-payment-lookup)]
(audit-transact
(transact-with-ledger
(into [(assoc base-payment
:payment/type :payment-type/check
:payment/status :payment-status/pending
@@ -494,7 +501,7 @@
updated-payment {:db/id id
:payment/amount 0.0
:payment/status :payment-status/voided}]
(audit-transact (conj removing-payments updated-payment)
(transact-with-ledger (conj removing-payments updated-payment)
(:id context)))
(-> (d-checks/get-by-id id)
(->graphql))))
@@ -514,7 +521,7 @@
specific-ids (d-checks/filter-ids (:ids args))
all-ids (into (set ids) specific-ids)]
(log/info "Voiding " (count all-ids) args)
(audit-transact (->> all-ids
(transact-with-ledger (->> all-ids
(d/q '[:find [(pull ?p [:db/id
{:invoice-payment/_payment [:invoice-payment/amount
:db/id
@@ -630,7 +637,7 @@
(audit-transact (-> []
(transact-with-ledger (-> []
(conj payment)
(into (invoice-payments invoices invoice-amounts))) (:id context))
(->graphql {:invoices (d-invoices/get-multi (map :db/id invoices))})))