makes it slightly more reusable
This commit is contained in:
@@ -200,17 +200,13 @@
|
|||||||
:returns 0.0
|
:returns 0.0
|
||||||
:vendor :vendor/ccp-ezcater}))
|
:vendor :vendor/ccp-ezcater}))
|
||||||
|
|
||||||
(defn lookup-order [json]
|
|
||||||
(let [caterer (get-caterer (get json "parent_id"))
|
(defn get-by-id [integration id]
|
||||||
integration (:ezcater-integration/_caterers caterer)
|
(query
|
||||||
client (-> caterer :ezcater-location/_caterer first :client/_ezcater-locations :client/code)
|
|
||||||
location (-> caterer :ezcater-location/_caterer first :ezcater-location/location)]
|
|
||||||
(if (and client location)
|
|
||||||
(doto
|
|
||||||
(-> (query
|
|
||||||
integration
|
integration
|
||||||
{:venia/queries [[:order {:id (get json "entity_id")}
|
{:venia/queries [[:order {:id id}
|
||||||
[:uuid
|
[:uuid
|
||||||
|
:orderNumber
|
||||||
:orderSourceType
|
:orderSourceType
|
||||||
[:caterer
|
[:caterer
|
||||||
[:name
|
[:name
|
||||||
@@ -258,7 +254,16 @@
|
|||||||
]]
|
]]
|
||||||
[:subTotal
|
[:subTotal
|
||||||
[:currency
|
[:currency
|
||||||
:subunits]]]]]]]})
|
:subunits]]]]]]]}))
|
||||||
|
|
||||||
|
(defn lookup-order [json]
|
||||||
|
(let [caterer (get-caterer (get json "parent_id"))
|
||||||
|
integration (:ezcater-integration/_caterers caterer)
|
||||||
|
client (-> caterer :ezcater-location/_caterer first :client/_ezcater-locations :client/code)
|
||||||
|
location (-> caterer :ezcater-location/_caterer first :ezcater-location/location)]
|
||||||
|
(if (and client location)
|
||||||
|
(doto
|
||||||
|
(-> (get-by-id integration (get json "entity_id"))
|
||||||
(:order)
|
(:order)
|
||||||
(assoc :client-code client
|
(assoc :client-code client
|
||||||
:client-location location))
|
:client-location location))
|
||||||
|
|||||||
Reference in New Issue
Block a user