make orders upsertable.
This commit is contained in:
@@ -251,6 +251,11 @@
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/unique :db.unique/identity}]]}
|
||||
:add-line-item-id2 {:txes [[{:db/ident :order-line-item/external-id
|
||||
:db/doc "An Id that links to square etc"
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/unique :db.unique/identity}]]}
|
||||
:add-expected-depsoit-link {:txes [[{:db/ident :expected-deposit/charges
|
||||
:db/doc "charges for the deposit"
|
||||
:db/valueType :db.type/ref
|
||||
|
||||
@@ -178,8 +178,8 @@
|
||||
(remove-nils
|
||||
#:charge
|
||||
{:type-name (:type t)
|
||||
:external-id (when (:payment_id t)
|
||||
(str "square/charge/" (:payment_id t)))
|
||||
:external-id (when (:id t)
|
||||
(str "square/charge/" (:id t)))
|
||||
:processor (condp = (some-> (:note t) str/lower-case)
|
||||
"doordash" :ccp-processor/doordash
|
||||
"dd" :ccp-processor/doordash
|
||||
@@ -196,16 +196,17 @@
|
||||
:total (amount->money (:amount_money t))
|
||||
:tip (amount->money (:tip_money t))}))))
|
||||
:line-items (->> (:line_items order)
|
||||
(map (fn [li]
|
||||
(remove-nils
|
||||
#:order-line-item
|
||||
{:item-name (:name li)
|
||||
:category (if (= "GIFT_CARD" (:item_type li))
|
||||
"Gift Card"
|
||||
(item-id->category-name client (:catalog_object_id li)))
|
||||
:total (amount->money (:total_money li))
|
||||
:tax (amount->money (:total_tax_money li))
|
||||
:discount (amount->money (:total_discount_money li))}))))}))
|
||||
(map-indexed (fn [i li]
|
||||
(remove-nils
|
||||
#:order-line-item
|
||||
{:external-id (str "square/order/" (:client/code client) "-" (:square-location/client-location location) "-" (:id order) "-" i)
|
||||
:item-name (:name li)
|
||||
:category (if (= "GIFT_CARD" (:item_type li))
|
||||
"Gift Card"
|
||||
(item-id->category-name client (:catalog_object_id li)))
|
||||
:total (amount->money (:total_money li))
|
||||
:tax (amount->money (:total_tax_money li))
|
||||
:discount (amount->money (:total_discount_money li))}))))}))
|
||||
|
||||
(defn daily-results
|
||||
([client location]
|
||||
|
||||
Reference in New Issue
Block a user