Fixes gift cards
This commit is contained in:
@@ -117,6 +117,19 @@
|
||||
result)))
|
||||
|
||||
|
||||
(defn order
|
||||
|
||||
([o]
|
||||
(log/info "Searching for" o)
|
||||
(let [result (->> (client/get (str "https://connect.squareup.com/v2/orders/" o)
|
||||
{:headers {"Square-Version" "2020-08-12"
|
||||
"Authorization" "Bearer EAAAEO2xSqesDutZz71hz3eulKmrlKTiEqG3uZ4j25x5GYlOluQ2cj2JxNUXqXD7"
|
||||
"Content-Type" "application/json"}
|
||||
:as :json})
|
||||
:body)]
|
||||
|
||||
(log/info "found " (count result))
|
||||
result)))
|
||||
|
||||
(defn amount->money [amt]
|
||||
(* 0.01 (or (:amount amt) 0.0)))
|
||||
@@ -206,7 +219,9 @@
|
||||
(remove-nils
|
||||
#:order-line-item
|
||||
{:item-name (:name li)
|
||||
:category (item-id->category-name (:catalog_object_id li))
|
||||
:category (if (= "GIFT_CARD" (:item_type li))
|
||||
"Gift Card"
|
||||
(item-id->category-name (:catalog_object_id li)))
|
||||
:total (amount->money (:total_money li))
|
||||
:tax (amount->money (:total_tax_money li))
|
||||
:discount (amount->money (:total_discount_money li))}))))}))))))
|
||||
|
||||
Reference in New Issue
Block a user