make it possible to revert yodlee account id.
This commit is contained in:
@@ -26,7 +26,11 @@
|
|||||||
(mapv (fn [lm] [:db/retractEntity (:db/id lm)]) (:client/location-matches client))
|
(mapv (fn [lm] [:db/retractEntity (:db/id lm)]) (:client/location-matches client))
|
||||||
(mapv (fn [m] [:db/retract (:db/id client) :client/matches m]) (:client/matches client)))
|
(mapv (fn [m] [:db/retract (:db/id client) :client/matches m]) (:client/matches client)))
|
||||||
(:id context)))
|
(:id context)))
|
||||||
transactions [(remove-nils {:db/id id
|
reverts (->> (:bank_accounts edit_client)
|
||||||
|
(filter #(nil? (:yodlee_account_id %)))
|
||||||
|
(filter #(:bank-account/yodlee-account-id (d/entity (d/db conn) (:id %))))
|
||||||
|
(map (fn [ba] [:db/retract (:id ba) :bank-account/yodlee-account-id (:bank-account/yodlee-account-id (d/entity (d/db conn) (:id ba)))])))
|
||||||
|
transactions (into [(remove-nils {:db/id id
|
||||||
:client/code (if (str/blank? (:client/code client))
|
:client/code (if (str/blank? (:client/code client))
|
||||||
(:code edit_client)
|
(:code edit_client)
|
||||||
(:client/code client))
|
(:client/code client))
|
||||||
@@ -79,6 +83,7 @@
|
|||||||
:forecasted-transaction/amount (:amount %)}
|
:forecasted-transaction/amount (:amount %)}
|
||||||
)
|
)
|
||||||
(:forecasted_transactions edit_client))]]
|
(:forecasted_transactions edit_client))]]
|
||||||
|
reverts)
|
||||||
_ (log/info "upserting client" transactions)
|
_ (log/info "upserting client" transactions)
|
||||||
result (audit-transact transactions (:id context))]
|
result (audit-transact transactions (:id context))]
|
||||||
(-> result :tempids (get id) (or id) d-clients/get-by-id
|
(-> result :tempids (get id) (or id) d-clients/get-by-id
|
||||||
|
|||||||
@@ -103,7 +103,7 @@
|
|||||||
{:headers {"Square-Version" "2020-08-12"
|
{:headers {"Square-Version" "2020-08-12"
|
||||||
"Authorization" "Bearer EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"
|
"Authorization" "Bearer EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"
|
||||||
"Content-Type" "application/json"}
|
"Content-Type" "application/json"}
|
||||||
:body (json/write-str (cond-> {"location_ids" [l] "limit" 4000}
|
:body (json/write-str (cond-> {"location_ids" [l] "limit" 10000}
|
||||||
d (merge (pc d))))
|
d (merge (pc d))))
|
||||||
:as :json})
|
:as :json})
|
||||||
:body
|
:body
|
||||||
@@ -127,6 +127,20 @@
|
|||||||
"4X8T65741AEPS" ["NGVZ" "NP"]
|
"4X8T65741AEPS" ["NGVZ" "NP"]
|
||||||
"KMVFQ9CRCXJ10" ["NGZO" "VT"]} location))
|
"KMVFQ9CRCXJ10" ["NGZO" "VT"]} location))
|
||||||
|
|
||||||
|
;; to get totals:
|
||||||
|
(comment
|
||||||
|
(reduce
|
||||||
|
(fn [total i]
|
||||||
|
(+ total (+ (- (:sales-order/total i)
|
||||||
|
(:sales-order/tax i)
|
||||||
|
(:sales-order/tip i)
|
||||||
|
(:sales-order/service-charge i))
|
||||||
|
(:sales-order/returns i)
|
||||||
|
|
||||||
|
(:sales-order/discount i)
|
||||||
|
)))
|
||||||
|
0.0))
|
||||||
|
|
||||||
(defn daily-results [d]
|
(defn daily-results [d]
|
||||||
(->> (locations)
|
(->> (locations)
|
||||||
(map :id)
|
(map :id)
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
[cljs-time.coerce :as coerce]
|
[cljs-time.coerce :as coerce]
|
||||||
[cljs-time.core :as t]
|
[cljs-time.core :as t]
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[re-frame.core :as re-frame]))
|
[re-frame.core :as re-frame]
|
||||||
|
[clojure.string :as str]))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
::can-submit
|
::can-submit
|
||||||
@@ -63,7 +64,7 @@
|
|||||||
:sort-order sort-order
|
:sort-order sort-order
|
||||||
:visible visible
|
:visible visible
|
||||||
:locations (mapv :location locations)
|
:locations (mapv :location locations)
|
||||||
:yodlee-account-id (when yodlee-account-id
|
:yodlee-account-id (when-not (str/blank? yodlee-account-id)
|
||||||
(js/parseInt yodlee-account-id))
|
(js/parseInt yodlee-account-id))
|
||||||
:code (if new?
|
:code (if new?
|
||||||
(str (:code new-client-data) "-" code)
|
(str (:code new-client-data) "-" code)
|
||||||
|
|||||||
Reference in New Issue
Block a user