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

View File

@@ -497,7 +497,8 @@
:value (fc/field-value)
:options [["new-square" "New Square+Ezcater (no effect)"]
["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/a-icon-button {"@click.prevent.stop" "$refs.p.remove()"} svg/x))))