makes it slightly more reusable
This commit is contained in:
@@ -200,6 +200,62 @@
|
|||||||
:returns 0.0
|
:returns 0.0
|
||||||
:vendor :vendor/ccp-ezcater}))
|
:vendor :vendor/ccp-ezcater}))
|
||||||
|
|
||||||
|
|
||||||
|
(defn get-by-id [integration id]
|
||||||
|
(query
|
||||||
|
integration
|
||||||
|
{:venia/queries [[:order {:id id}
|
||||||
|
[:uuid
|
||||||
|
:orderNumber
|
||||||
|
:orderSourceType
|
||||||
|
[:caterer
|
||||||
|
[:name
|
||||||
|
:uuid
|
||||||
|
[:address [:street]]]]
|
||||||
|
[:event
|
||||||
|
[:timestamp
|
||||||
|
:catererHandoffFoodTime
|
||||||
|
:orderType]]
|
||||||
|
[:catererCart [[:orderItems
|
||||||
|
[:name
|
||||||
|
:quantity
|
||||||
|
:posItemId
|
||||||
|
[:totalInSubunits
|
||||||
|
[:currency
|
||||||
|
:subunits]]]]
|
||||||
|
[:totals
|
||||||
|
[:catererTotalDue]]
|
||||||
|
[:feesAndDiscounts
|
||||||
|
{:type 'DELIVERY_FEE}
|
||||||
|
[[:cost
|
||||||
|
[:currency
|
||||||
|
:subunits]]]]]]
|
||||||
|
[:totals [[:customerTotalDue
|
||||||
|
[
|
||||||
|
:currency
|
||||||
|
:subunits
|
||||||
|
]]
|
||||||
|
[:pointOfSaleIntegrationFee
|
||||||
|
[
|
||||||
|
:currency
|
||||||
|
:subunits
|
||||||
|
]]
|
||||||
|
[:tip
|
||||||
|
[:currency
|
||||||
|
:subunits]]
|
||||||
|
[:salesTax
|
||||||
|
[
|
||||||
|
:currency
|
||||||
|
:subunits
|
||||||
|
]]
|
||||||
|
[:salesTaxRemittance
|
||||||
|
[:currency
|
||||||
|
:subunits
|
||||||
|
]]
|
||||||
|
[:subTotal
|
||||||
|
[:currency
|
||||||
|
:subunits]]]]]]]}))
|
||||||
|
|
||||||
(defn lookup-order [json]
|
(defn lookup-order [json]
|
||||||
(let [caterer (get-caterer (get json "parent_id"))
|
(let [caterer (get-caterer (get json "parent_id"))
|
||||||
integration (:ezcater-integration/_caterers caterer)
|
integration (:ezcater-integration/_caterers caterer)
|
||||||
@@ -207,58 +263,7 @@
|
|||||||
location (-> caterer :ezcater-location/_caterer first :ezcater-location/location)]
|
location (-> caterer :ezcater-location/_caterer first :ezcater-location/location)]
|
||||||
(if (and client location)
|
(if (and client location)
|
||||||
(doto
|
(doto
|
||||||
(-> (query
|
(-> (get-by-id integration (get json "entity_id"))
|
||||||
integration
|
|
||||||
{:venia/queries [[:order {:id (get json "entity_id")}
|
|
||||||
[:uuid
|
|
||||||
:orderSourceType
|
|
||||||
[:caterer
|
|
||||||
[:name
|
|
||||||
:uuid
|
|
||||||
[:address [:street]]]]
|
|
||||||
[:event
|
|
||||||
[:timestamp
|
|
||||||
:catererHandoffFoodTime
|
|
||||||
:orderType]]
|
|
||||||
[:catererCart [[:orderItems
|
|
||||||
[:name
|
|
||||||
:quantity
|
|
||||||
:posItemId
|
|
||||||
[:totalInSubunits
|
|
||||||
[:currency
|
|
||||||
:subunits]]]]
|
|
||||||
[:totals
|
|
||||||
[:catererTotalDue]]
|
|
||||||
[:feesAndDiscounts
|
|
||||||
{:type 'DELIVERY_FEE}
|
|
||||||
[[:cost
|
|
||||||
[:currency
|
|
||||||
:subunits]]]]]]
|
|
||||||
[:totals [[:customerTotalDue
|
|
||||||
[
|
|
||||||
:currency
|
|
||||||
:subunits
|
|
||||||
]]
|
|
||||||
[:pointOfSaleIntegrationFee
|
|
||||||
[
|
|
||||||
:currency
|
|
||||||
:subunits
|
|
||||||
]]
|
|
||||||
[:tip
|
|
||||||
[:currency
|
|
||||||
:subunits]]
|
|
||||||
[:salesTax
|
|
||||||
[
|
|
||||||
:currency
|
|
||||||
:subunits
|
|
||||||
]]
|
|
||||||
[:salesTaxRemittance
|
|
||||||
[:currency
|
|
||||||
:subunits
|
|
||||||
]]
|
|
||||||
[:subTotal
|
|
||||||
[:currency
|
|
||||||
:subunits]]]]]]]})
|
|
||||||
(:order)
|
(:order)
|
||||||
(assoc :client-code client
|
(assoc :client-code client
|
||||||
:client-location location))
|
:client-location location))
|
||||||
|
|||||||
Reference in New Issue
Block a user