diff --git a/src/clj/auto_ap/square/core3.clj b/src/clj/auto_ap/square/core3.clj index 56286276..eca44ec6 100644 --- a/src/clj/auto_ap/square/core3.clj +++ b/src/clj/auto_ap/square/core3.clj @@ -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] diff --git a/src/clj/auto_ap/ssr/admin/clients.clj b/src/clj/auto_ap/ssr/admin/clients.clj index 6054c981..244ad184 100644 --- a/src/clj/auto_ap/ssr/admin/clients.clj +++ b/src/clj/auto_ap/ssr/admin/clients.clj @@ -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))))