updates to prevent in-progress orders

This commit is contained in:
2021-09-14 07:18:39 -07:00
parent a007b04685
commit e9c752fb3c
3 changed files with 143 additions and 5 deletions

View File

@@ -100,8 +100,7 @@
}
"state_filter" {"states" ["COMPLETED"]}}
}}
"sort" {
"sort_field" "CREATED_AT"
@@ -235,7 +234,9 @@
(filter location_id->client-location)
(mapcat #(search % d))
(filter (fn [order]
(and (= "COMPLETED" (:state order))
;; sometimes orders stay open in square. At least one payment
;; is needed to import, in order to avoid importing orders in-progress.
(and (> (count (:tenders order)) 0)
(not= #{"FAILED"}
(set (map #(:status (:card_details %)) (:tenders order)))))))
(map order->sales-order)))
@@ -488,7 +489,9 @@
(comment
(daily-results)
(mount/stop (mount/only #{'auto-ap.square.core/square-settlement-loader}))
(mount/stop (mount/only #{'auto-ap.square.core/square-refund-loader}))
(mount/stop (mount/only #{'auto-ap.square.core/square-loader}))
(mount/start (mount/only #{'auto-ap.square.core/square-settlement-loader}))