square fixes
This commit is contained in:
@@ -66,8 +66,7 @@
|
|||||||
(map #(assoc %
|
(map #(assoc %
|
||||||
:source-url (str "https://" (:data-bucket env)
|
:source-url (str "https://" (:data-bucket env)
|
||||||
"/"
|
"/"
|
||||||
s3-location)
|
s3-location) :import-status :import-status/imported)))]
|
||||||
:import-status :import-status/imported)))]
|
|
||||||
(alog/info ::found-imports :imports imports)
|
(alog/info ::found-imports :imports imports)
|
||||||
(invoices/import-uploaded-invoice {:user/role "admin" :user/name "Email Invoice Importer"} imports))))
|
(invoices/import-uploaded-invoice {:user/role "admin" :user/name "Email Invoice Importer"} imports))))
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
@@ -79,3 +78,28 @@
|
|||||||
|
|
||||||
(defn -main [& _]
|
(defn -main [& _]
|
||||||
(execute "import-uploaded-invoices" process-sqs))
|
(execute "import-uploaded-invoices" process-sqs))
|
||||||
|
|
||||||
|
|
||||||
|
(comment
|
||||||
|
(with-open [i (io/output-stream "/tmp/bryce.pdf")]
|
||||||
|
(clojure.java.io/copy
|
||||||
|
(-> (s3/get-object :bucket-name (:data-bucket env)
|
||||||
|
:key "invoice-files/f0e73dcb-e5e5-4c81-b82b-319b7caedacf.pdf"
|
||||||
|
|
||||||
|
)
|
||||||
|
:input-stream)
|
||||||
|
i))
|
||||||
|
|
||||||
|
(parse/parse-file "/tmp/bryce.pdf" "/tmp/bryce.pdf")
|
||||||
|
|
||||||
|
|
||||||
|
(-> (clojure.java.shell/sh "pdftotext" "-layout" "/tmp/bryce.pdf" "-")
|
||||||
|
:out
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
1
|
||||||
|
|
||||||
|
(user/init-repl)
|
||||||
|
|
||||||
|
)
|
||||||
@@ -280,8 +280,8 @@
|
|||||||
:reference-link (str (url/url "https://squareup.com/receipt/preview" (:id t)))
|
:reference-link (str (url/url "https://squareup.com/receipt/preview" (:id t)))
|
||||||
:external-id (when (:id t)
|
:external-id (when (:id t)
|
||||||
(str "square/charge/" (:id t)))
|
(str "square/charge/" (:id t)))
|
||||||
:processor (condp = (:type t)
|
:processor (cond
|
||||||
"OTHER"
|
(#{"OTHER" "THIRD_PARTY_CARD"} (:type t))
|
||||||
(condp = (some-> (:note t) str/lower-case)
|
(condp = (some-> (:note t) str/lower-case)
|
||||||
"doordash" :ccp-processor/doordash
|
"doordash" :ccp-processor/doordash
|
||||||
"dd" :ccp-processor/doordash
|
"dd" :ccp-processor/doordash
|
||||||
@@ -297,15 +297,16 @@
|
|||||||
"Koala" :ccp-processor/koala
|
"Koala" :ccp-processor/koala
|
||||||
"koala-production" :ccp-processor/koala
|
"koala-production" :ccp-processor/koala
|
||||||
:ccp-processor/na))
|
:ccp-processor/na))
|
||||||
"CARD"
|
(= (:type t) "CARD")
|
||||||
:ccp-processor/square
|
:ccp-processor/square
|
||||||
|
|
||||||
"SQUARE_GIFT_CARD"
|
(= (:type t) "SQUARE_GIFT_CARD")
|
||||||
:ccp-processor/square
|
:ccp-processor/square
|
||||||
|
|
||||||
"CASH"
|
(= (:type t) "CASH")
|
||||||
:ccp-processor/na
|
:ccp-processor/na
|
||||||
|
|
||||||
|
:else
|
||||||
:ccp-processor/na)
|
:ccp-processor/na)
|
||||||
:total (amount->money (:amount_money t))
|
:total (amount->money (:amount_money t))
|
||||||
:tip (amount->money (:tip_money t))}))
|
:tip (amount->money (:tip_money t))}))
|
||||||
@@ -1033,8 +1034,15 @@
|
|||||||
l
|
l
|
||||||
|
|
||||||
|
|
||||||
(def z @(search c l #clj-time/date-time "2024-04-25T00:00:00-08:00"
|
(def z @(search c l #clj-time/date-time "2025-02-23T00:00:00-08:00"
|
||||||
#clj-time/date-time "2024-04-28T00:00:00-08:00"))))
|
#clj-time/date-time "2025-02-28T00:00:00-08:00"))
|
||||||
|
(take 10 (map #(first (deref (order->sales-order c l %))) z)))
|
||||||
|
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(->> z
|
(->> z
|
||||||
(filter (fn [o]
|
(filter (fn [o]
|
||||||
@@ -1043,7 +1051,19 @@
|
|||||||
(count)
|
(count)
|
||||||
|
|
||||||
)
|
)
|
||||||
|
(doseq [c (get-square-clients)]
|
||||||
|
(println "Upserting" (:client/name c))
|
||||||
|
@(upsert c))
|
||||||
|
|
||||||
#_(filter (comp #{"OTHER"} :type) (mapcat :tenders z))
|
#_(filter (comp #{"OTHER"} :type) (mapcat :tenders z))
|
||||||
|
(->> (apply get-square-clients [])
|
||||||
|
(s/->source)
|
||||||
|
(s/filter (fn [client]
|
||||||
|
(seq (filter :square-location/client-location (:client/square-locations client)))))
|
||||||
|
(s/map (fn [client]
|
||||||
|
(upsert client #clj-time/date-time "2025-02-12"
|
||||||
|
#clj-time/date-time "2025-02-")))
|
||||||
|
(s/buffer 5)
|
||||||
|
(s/realize-each)
|
||||||
|
(s/reduce conj []))
|
||||||
)
|
)
|
||||||
Reference in New Issue
Block a user