Sales orders works correctly now.
This commit is contained in:
@@ -120,7 +120,7 @@
|
||||
|
||||
(defn location_id->client-location [location]
|
||||
({"2RVBYER6QSV7W" ["NGAK" "MH"]
|
||||
#_#_"8JT71V8XGYAT3" ["NGKG" "NB"]
|
||||
"8JT71V8XGYAT3" ["NGKG" "NB"]
|
||||
"SCX0Y8CTGM1S0" ["NGE1" "UC"]
|
||||
"FNH5VRT890WK8" ["NGMJ" "SC"]
|
||||
"AMQ0NPA8FGDEF" ["NGPG" "SZ"]
|
||||
@@ -132,6 +132,9 @@
|
||||
(map :id)
|
||||
(filter location_id->client-location)
|
||||
(mapcat #(search % d))
|
||||
(filter (fn [order]
|
||||
(not= #{"FAILED"}
|
||||
(set (map #(:status (:card_details %)) (:tenders order))))))
|
||||
(map (fn [order]
|
||||
(let [[client loc] (location_id->client-location (:location_id order))]
|
||||
(remove-nils
|
||||
@@ -140,13 +143,16 @@
|
||||
:client [:client/code client]
|
||||
:location loc
|
||||
:external-id (str "square/order/" client "-" loc "-" (:id order))
|
||||
:total (- (-> order :total_money amount->money)
|
||||
(or (some-> order :return_amounts :total_money amount->money) 0.0))
|
||||
:tax (- (-> order :total_tax_money amount->money)
|
||||
(or (some-> order :return_amounts :tax_money amount->money) 0.0))
|
||||
:tip (- (-> order :net_amounts :tip_money amount->money)
|
||||
(or (some-> order :return_amounts :tip_money amount->money) 0.0))
|
||||
:discount (-> order :total_discount_money amount->money)
|
||||
:total (-> order :net_amounts :total_money amount->money)
|
||||
:tax (-> order :net_amounts :tax_money amount->money)
|
||||
:tip (-> order :net_amounts :tip_money amount->money)
|
||||
:discount (-> order :net_amounts :discount_money amount->money)
|
||||
:service-charge (-> order :net_amounts :service_charge_money amount->money)
|
||||
:returns (+ (- (-> order :return_amounts :total_money amount->money)
|
||||
(-> order :return_amounts :tax_money amount->money)
|
||||
(-> order :return_amounts :tip_money amount->money)
|
||||
(-> order :return_amounts :service_charge_money amount->money)
|
||||
(-> order :return_amounts :discount_money amount->money)))
|
||||
:charges (->> (:tenders order)
|
||||
(map (fn [t]
|
||||
(remove-nils
|
||||
|
||||
Reference in New Issue
Block a user