From ed592aaa983882644974c300737133d530a1bfb2 Mon Sep 17 00:00:00 2001 From: Bryce Covert Date: Sun, 17 Nov 2019 19:44:24 -0800 Subject: [PATCH] Added new vendors --- src/clj/auto_ap/parse/templates.clj | 17 +++++++++++++---- src/clj/auto_ap/yodlee/core.clj | 15 +++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/clj/auto_ap/parse/templates.clj b/src/clj/auto_ap/parse/templates.clj index b4c2edba..7bacb01f 100644 --- a/src/clj/auto_ap/parse/templates.clj +++ b/src/clj/auto_ap/parse/templates.clj @@ -55,12 +55,12 @@ {:vendor "Southbay Fresh Produce" :keywords [#"SOUTH BAY FRESH PRODUCE"] :extract {:date #"^([0-9]+/[0-9]+/[0-9]+)" - :customer-identifier #"FAX:[^\n]+\n\s+([A-Za-z ]+)\s{2}" - :invoice-number #"^[0-9]+/[0-9]+/[0-9]+\s+(\d+)" - :total #"\$([0-9.]+)"} + :customer-identifier #"To:[^\n]*\n\s+([A-Za-z' ]+)\s{2}" + :invoice-number #"INV #\/(\d+)" + :total #"\$([0-9.]+)\."} :parser {:date [:clj-time "MM/dd/yyyy"]} :multi #"\n" - :multi-match? #"^[0-9]+/[0-9]+/[0-9]+\s+(\d+)"} + :multi-match? #"^[0-9]+/[0-9]+/[0-9]+\s+INV "} {:vendor "Performance Food Group - LEDYARD" :keywords [#"performancefoodservice"] :extract {:date #"DELIVER TO[^\n]+\n.+?(?=[0-9]+/[0-9]+/[0-9]+)([0-9]+/[0-9]+/[0-9]+)" @@ -89,6 +89,15 @@ :invoice-number #"Invoice No: ([^\n]+)\n" :total #" Total:\s+([\d\.]+)"} :parser {:date [:clj-time "MMM dd, yyyy"]}} + {:vendor "A&B Produce" + :keywords [#"ABProduce"] + :extract {:date #"^\s+([0-9]+/[0-9]+/[0-9]+)" + :customer-identifier #"BILL TO:[^\n]+\n[^\n]+\n[^\n]+\n(.*)\s{2,}" + :invoice-number #"(\d+)\s+INV" + :total #" INV\s+([\d\.]+)"} + :parser {:date [:clj-time "MM/dd/yyyy"]} + :multi #"\n" + :multi-match? #"^\s+[0-9]+/[0-9]+/[0-9]+\s+\d+\s+INV\s+"} {:vendor "Performance Food Group - ROMA" :keywords [#"Performance Food Group, Inc\n\f"] :extract {:date #"Date: ([0-9]+/[0-9]+/[0-9]+)" diff --git a/src/clj/auto_ap/yodlee/core.clj b/src/clj/auto_ap/yodlee/core.clj index e7c04a43..1554a240 100644 --- a/src/clj/auto_ap/yodlee/core.clj +++ b/src/clj/auto_ap/yodlee/core.clj @@ -160,6 +160,21 @@ (recur (concat transactions transaction-batch) (+ batch-size skip)) transactions))))) +(defn count-specific-transactions [account] + (let [cob-session (login-cobrand) + user-session (login-user cob-session)] + + (-> (str (:yodlee-base-url env) "/transactions/count?accountId=" account) + (doto println) + + (client/get {:headers (doto + (merge base-headers {"Authorization" (auth-header cob-session user-session)}) + println) + :as :json}) + :body + :transaction + ))) + (defn get-access-token [] (let [cob-session (login-cobrand) user-session (login-user cob-session)