Adds the ability for intuit snapshot balance
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
(ns auto-ap.intuit.core
|
||||
(:require
|
||||
[amazonica.aws.s3 :as s3]
|
||||
[clj-http.client :as client]
|
||||
[clojure.core.memoize :as m]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.string :as str]
|
||||
[config.core :as cfg :refer [env]])
|
||||
(:import
|
||||
(org.apache.commons.codec.binary Base64)))
|
||||
(:require [amazonica.aws.s3 :as s3]
|
||||
[clj-http.client :as client]
|
||||
[clj-time.coerce :as c]
|
||||
[clojure.core.memoize :as m]
|
||||
[clojure.java.io :as io]
|
||||
[clojure.string :as str]
|
||||
[config.core :as cfg :refer [env]])
|
||||
(:import (org.apache.commons.codec.binary Base64)))
|
||||
|
||||
;; (def authorization-code "AB11638463964I0tYPR3A1inog2HL407u2bZBXHg6LEqCbILRO")
|
||||
;; (def realm-id "4620816365202617680")
|
||||
@@ -98,6 +97,13 @@
|
||||
{:headers base-headers
|
||||
:as :json})
|
||||
|
||||
(defn get-bank-accounts-raw [token]
|
||||
(->> (:body (client/get (str prod-base-url "/company/" prod-company-id "/query" )
|
||||
{:headers
|
||||
(with-auth prod-base-headers token)
|
||||
:as :json
|
||||
:query-params {"query" "SELECT * From Account maxresults 1000"}}))
|
||||
:QueryResponse))
|
||||
|
||||
|
||||
(defn get-bank-accounts [token]
|
||||
@@ -110,10 +116,13 @@
|
||||
:Account
|
||||
#_(filter
|
||||
#(#{"Bank" "Credit Card"} (:AccountType %)))
|
||||
(map (juxt :Id :Name))
|
||||
(map (fn [[id name]]
|
||||
(map (juxt :Id :Name :CurrentBalance :MetaData))
|
||||
(map (fn [[id name current-balance metadata]]
|
||||
{:id id
|
||||
:name name}))))
|
||||
:name name
|
||||
:last-updated (c/to-date-time (-> metadata :LastUpdatedTime))
|
||||
:current-balance current-balance}))))
|
||||
|
||||
|
||||
(defn get-all-transactions [start end]
|
||||
(let [token (get-fresh-access-token)]
|
||||
|
||||
Reference in New Issue
Block a user