diff --git a/src/clj/auto_ap/jobs/import_uploaded_invoices.clj b/src/clj/auto_ap/jobs/import_uploaded_invoices.clj index 180e484c..316f3f3f 100644 --- a/src/clj/auto_ap/jobs/import_uploaded_invoices.clj +++ b/src/clj/auto_ap/jobs/import_uploaded_invoices.clj @@ -66,8 +66,7 @@ (map #(assoc % :source-url (str "https://" (:data-bucket env) "/" - s3-location) - :import-status :import-status/imported)))] + s3-location) :import-status :import-status/imported)))] (alog/info ::found-imports :imports imports) (invoices/import-uploaded-invoice {:user/role "admin" :user/name "Email Invoice Importer"} imports)))) (catch Exception e @@ -79,3 +78,28 @@ (defn -main [& _] (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) + + ) \ No newline at end of file diff --git a/src/clj/auto_ap/square/core3.clj b/src/clj/auto_ap/square/core3.clj index c35bccbe..c51651c5 100644 --- a/src/clj/auto_ap/square/core3.clj +++ b/src/clj/auto_ap/square/core3.clj @@ -280,8 +280,8 @@ :reference-link (str (url/url "https://squareup.com/receipt/preview" (:id t))) :external-id (when (:id t) (str "square/charge/" (:id t))) - :processor (condp = (:type t) - "OTHER" + :processor (cond + (#{"OTHER" "THIRD_PARTY_CARD"} (:type t)) (condp = (some-> (:note t) str/lower-case) "doordash" :ccp-processor/doordash "dd" :ccp-processor/doordash @@ -297,15 +297,16 @@ "Koala" :ccp-processor/koala "koala-production" :ccp-processor/koala :ccp-processor/na)) - "CARD" + (= (:type t) "CARD") :ccp-processor/square - "SQUARE_GIFT_CARD" + (= (:type t) "SQUARE_GIFT_CARD") :ccp-processor/square - "CASH" + (= (:type t) "CASH") :ccp-processor/na + :else :ccp-processor/na) :total (amount->money (:amount_money t)) :tip (amount->money (:tip_money t))})) @@ -1033,8 +1034,15 @@ l - (def z @(search c l #clj-time/date-time "2024-04-25T00:00:00-08:00" - #clj-time/date-time "2024-04-28T00:00:00-08:00")))) + (def z @(search c l #clj-time/date-time "2025-02-23T00: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 (filter (fn [o] @@ -1043,7 +1051,19 @@ (count) ) + (doseq [c (get-square-clients)] + (println "Upserting" (:client/name c)) + @(upsert c)) #_(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 [])) ) \ No newline at end of file