Fixes issue with JFC import, fixes issue where overriden account ids did not take effect.

This commit is contained in:
Bryce
2023-07-11 09:36:40 -07:00
parent 265eebe084
commit 7b0799e7ad
3 changed files with 57 additions and 50 deletions

View File

@@ -22,7 +22,8 @@
[digest]
[iol-ion.tx :refer [random-tempid]]
[ring.middleware.json :refer [wrap-json-response]]
[unilog.context :as lc])
[unilog.context :as lc]
[auto-ap.logging :as alog])
(:import
(java.util UUID)))
@@ -105,6 +106,8 @@
(map (c/parse-or-error :invoice-number parse-invoice-number))
(map (c/parse-or-error :total c/parse-amount))
(map (c/parse-or-error :date c/parse-date)))]
(alog/info ::parsed
:rows (take 10 rows))
rows))
@@ -179,7 +182,7 @@
(defn invoice-rows->transaction [rows user]
(->> rows
(mapcat (fn [{:keys [vendor-id total client-id date invoice-number default-location check automatically-paid-when-due]}]
(mapcat (fn [{:keys [vendor-id total client-id date invoice-number default-location check automatically-paid-when-due account-id]}]
(let [payment-id (.toString (java.util.UUID/randomUUID))
transaction-id (.toString (java.util.UUID/randomUUID))
invoice #:invoice {:db/id (.toString (java.util.UUID/randomUUID))
@@ -234,7 +237,8 @@
:transaction-account/amount (Math/abs (:invoice/total invoice))}]}]))
]
[[:propose-invoice (d-invoices/code-invoice (validate-invoice (remove-nils invoice)
user))]
user)
account-id)]
(some-> payment remove-nils)
transaction])))
(filter identity)))