Imports custom amounts

This commit is contained in:
2024-04-24 11:59:36 -07:00
parent ad29a19ff3
commit 53b7da9512
2 changed files with 8 additions and 2 deletions

View File

@@ -313,7 +313,8 @@
(capture-context->lc (capture-context->lc
(let [is-order-only-for-charge? (= ["CUSTOM_AMOUNT"] (let [is-order-only-for-charge? (= ["CUSTOM_AMOUNT"]
(mapv :item_type (:line_items order)))] (mapv :item_type (:line_items order)))]
(if is-order-only-for-charge? (if (and is-order-only-for-charge?
(not ((set (:client/feature-flags client)) "import-custom-amount")))
(de/success-deferred (de/success-deferred
(->> (:tenders order) (->> (:tenders order)
(map #(tender->charge order client location %)))) (map #(tender->charge order client location %))))
@@ -371,6 +372,7 @@
(fn [e] (fn [e]
(log/error ::failed-to-transform-order (log/error ::failed-to-transform-order
:exception e))))))) :exception e)))))))
(defn should-import-order? [order] (defn should-import-order? [order]
;; sometimes orders stay open in square. At least one payment ;; sometimes orders stay open in square. At least one payment
;; is needed to import, in order to avoid importing orders in-progress. ;; is needed to import, in order to avoid importing orders in-progress.
@@ -731,6 +733,7 @@
(def square-read [:db/id (def square-read [:db/id
:client/code :client/code
:client/square-auth-token :client/square-auth-token
:client/feature-flags
{:client/square-locations [:db/id :square-location/name :square-location/square-id :square-location/client-location]}]) {:client/square-locations [:db/id :square-location/name :square-location/square-id :square-location/client-location]}])
(defn get-square-clients (defn get-square-clients
@@ -739,6 +742,7 @@
:client/square-integration-status :client/square-integration-status
:client/code :client/code
:client/square-auth-token :client/square-auth-token
:client/feature-flags
{:client/square-locations [:db/id :square-location/name :square-location/square-id :square-location/client-location]}]) {:client/square-locations [:db/id :square-location/name :square-location/square-id :square-location/client-location]}])
:in $ :in $
:where [?c :client/square-auth-token]] :where [?c :client/square-auth-token]]
@@ -747,6 +751,7 @@
(map first (dc/q '[:find (pull ?c [:db/id (map first (dc/q '[:find (pull ?c [:db/id
:client/code :client/code
:client/square-auth-token :client/square-auth-token
:client/feature-flags
{:client/square-locations [:db/id :square-location/name :square-location/square-id :square-location/client-location]}]) {:client/square-locations [:db/id :square-location/name :square-location/square-id :square-location/client-location]}])
:in $ [?code ...] :in $ [?code ...]
:where [?c :client/square-auth-token] :where [?c :client/square-auth-token]

View File

@@ -497,7 +497,8 @@
:value (fc/field-value) :value (fc/field-value)
:options [["new-square" "New Square+Ezcater (no effect)"] :options [["new-square" "New Square+Ezcater (no effect)"]
["manually-pay-cintas" "Manually Pay Cintas"] ["manually-pay-cintas" "Manually Pay Cintas"]
["include-in-ntg-corp-reports" "Include in NTG Corporate reports"]]}))) ["include-in-ntg-corp-reports" "Include in NTG Corporate reports"]
["import-custom-amount" "Import Custom Amount Line Items from Square"]]})))
(com/data-grid-cell {:class "align-top"} (com/data-grid-cell {:class "align-top"}
(com/a-icon-button {"@click.prevent.stop" "$refs.p.remove()"} svg/x)))) (com/a-icon-button {"@click.prevent.stop" "$refs.p.remove()"} svg/x))))