adding yodlee vetndors.
This commit is contained in:
@@ -124,9 +124,10 @@
|
||||
:requires [:auto-ap/convert-vendors]}
|
||||
:auto-ap/convert-transactions {:txes-fn `add-general-ledger/convert-transactions
|
||||
:requires [:auto-ap/convert-invoices]}
|
||||
:auto-ap/add-yodlee-merchant {:txes add-general-ledger/add-yodlee-merchant :requires [:auto-ap/convert-transactions]}
|
||||
|
||||
:auto-ap/bulk-load-invoice-ledger3 {:txes-fn `add-general-ledger/bulk-load-invoice-ledger :requires [:auto-ap/convert-transactions]}
|
||||
:auto-ap/bulk-load-transaction-ledger3 {:txes-fn `add-general-ledger/bulk-load-transaction-ledger :requires [:auto-ap/convert-transactions]}
|
||||
#_#_:auto-ap/bulk-load-invoice-ledger3 {:txes-fn `add-general-ledger/bulk-load-invoice-ledger :requires [:auto-ap/convert-transactions]}
|
||||
#_#_:auto-ap/bulk-load-transaction-ledger3 {:txes-fn `add-general-ledger/bulk-load-transaction-ledger :requires [:auto-ap/convert-transactions]}
|
||||
|
||||
}]
|
||||
(println "Conforming database...")
|
||||
|
||||
@@ -81,6 +81,23 @@
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "The debit/credit for this transaction"}]])
|
||||
|
||||
(def add-yodlee-merchant
|
||||
[[{:db/ident :yodlee-merchant/name
|
||||
:db/valueType :db.type/string
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "The yodlee merchant name"}
|
||||
|
||||
{:db/ident :yodlee-merchant/id
|
||||
:db/valueType :db.type/string
|
||||
:db/unique :db.unique/identity
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "The yodlee merchant id"}
|
||||
|
||||
{:db/ident :transaction/yodlee-merchant
|
||||
:db/valueType :db.type/ref
|
||||
:db/cardinality :db.cardinality/one
|
||||
:db/doc "The yodlee merchant"}]])
|
||||
|
||||
(def add-accounts
|
||||
[[
|
||||
{:db/ident :account/code
|
||||
|
||||
@@ -75,7 +75,8 @@
|
||||
(->> (d/pull-many db '[* {:transaction/client [:client/name :db/id :client/code]
|
||||
:transaction/bank-account [:bank-account/name :bank-account/code :bank-account/yodlee-account-id :db/id]
|
||||
:transaction/vendor [:db/id :vendor/name]
|
||||
:transaction/account [:db/id :account/name :account/numeric-code]}]
|
||||
:transaction/account [:db/id :account/name :account/numeric-code]
|
||||
:transaction/yodlee-merchant [:db/id :yodlee-merchant/id :yodlee-merchant/name]}]
|
||||
ids)
|
||||
(map #(update % :transaction/date c/from-date))
|
||||
(map #(update % :transaction/post-date c/from-date))
|
||||
@@ -95,7 +96,8 @@
|
||||
'[* {:transaction/client [:client/name :db/id :client/code :client/locations]
|
||||
:transaction/bank-account [:bank-account/name :bank-account/code :bank-account/yodlee-account-id :db/id]
|
||||
:transaction/vendor [:db/id :vendor/name]
|
||||
:transaction/account [:db/id :account/name :account/numeric-code]}]
|
||||
:transaction/account [:db/id :account/name :account/numeric-code]
|
||||
:transaction/yodlee-merchant [:db/id :yodlee-merchant/id :yodlee-merchant/name]}]
|
||||
id)
|
||||
(update :transaction/date c/from-date)
|
||||
(update :transaction/post-date c/from-date)
|
||||
|
||||
@@ -151,13 +151,16 @@
|
||||
:invoices {:type '(list :invoice_payment)}
|
||||
}}
|
||||
|
||||
:yodlee_merchant {:fields {:id {:type 'String}
|
||||
:name {:type 'String}}}
|
||||
|
||||
:transaction {:fields {:id {:type :id}
|
||||
:amount {:type 'String}
|
||||
:description_original {:type 'String}
|
||||
:description_simple {:type 'String}
|
||||
:location {:type 'String}
|
||||
:status {:type 'String}
|
||||
:merchant_name {:type 'String}
|
||||
:yodlee_merchant {:type :yodlee_merchant}
|
||||
:client {:type :client}
|
||||
:account {:type :account}
|
||||
:payment {:type :payment}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
(let [args (assoc args :id (:id context))
|
||||
[transactions transactions-count] (d-transactions/get-graphql (<-graphql args))
|
||||
transactions (map ->graphql transactions)]
|
||||
(println transactions)
|
||||
[{:transactions transactions
|
||||
:total transactions-count
|
||||
:count (count transactions)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
(ns auto-ap.yodlee.core
|
||||
(:require [clj-http.client :as client]
|
||||
[cemerick.url :as u]
|
||||
[clojure.data.json :as json]
|
||||
[config.core :refer [env]]))
|
||||
|
||||
@@ -26,7 +27,7 @@
|
||||
|
||||
|
||||
(defn login-user
|
||||
([cob-session] (:yodlee-user-login env) (:yodlee-user-password env))
|
||||
([cob-session] (login-user cob-session "sbMemda48aa19712a83c3ca4e935dd5e5d46b1a2" "sbMemda48aa19712a83c3ca4e935dd5e5d46b1a2#123"))
|
||||
([cob-session user password]
|
||||
(-> (str (:yodlee-base-url env) "/user/login")
|
||||
(client/post {:headers (merge base-headers {"Authorization" (auth-header cob-session)})
|
||||
@@ -75,7 +76,7 @@
|
||||
batch-size 100
|
||||
get-transaction-batch (fn [skip]
|
||||
(-> (str (:yodlee-base-url env) "/transactions?top=" batch-size "&skip=" skip)
|
||||
(doto println)
|
||||
|
||||
|
||||
(client/get {:headers (doto
|
||||
(merge base-headers {"Authorization" (auth-header cob-session user-session)})
|
||||
@@ -146,7 +147,6 @@
|
||||
batch-size 100
|
||||
get-transaction-batch (fn [skip]
|
||||
(-> (str (:yodlee-base-url env) "/transactions?top=" batch-size "&skip=" skip "&accountId=" account)
|
||||
(doto println)
|
||||
|
||||
(client/get {:headers (doto
|
||||
(merge base-headers {"Authorization" (auth-header cob-session user-session)})
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
{amount :amount} :amount
|
||||
{description-original :original
|
||||
description-simple :simple} :description
|
||||
{merchant-id :i
|
||||
{merchant-id :id
|
||||
merchant-name :name} :merchant
|
||||
base-type :baseType
|
||||
type :type
|
||||
@@ -73,6 +73,10 @@
|
||||
:id (sha-256 (str id))
|
||||
:account-id account-id
|
||||
:date (coerce/to-date (time/parse date "YYYY-MM-dd"))
|
||||
:yodlee-merchant (when (and merchant-id merchant-name)
|
||||
(println "INCLUDING MERCHANT")
|
||||
{:yodlee-merchant/id merchant-id
|
||||
:yodlee-merchant/name merchant-name})
|
||||
:amount (double amount)
|
||||
:description-original description-original
|
||||
:description-simple description-simple
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
[:vendor [:name :id]]
|
||||
[:account [:id :name]]
|
||||
:date
|
||||
[:yodlee_merchant [:name :id]]
|
||||
:post_date
|
||||
:status
|
||||
:description_original
|
||||
|
||||
@@ -9,8 +9,11 @@
|
||||
(re-frame/reg-event-db
|
||||
::editing
|
||||
(fn [db [_ which]]
|
||||
(println which)
|
||||
(-> db
|
||||
(forms/start-form ::edit-transaction {:id (:id which)
|
||||
:yodlee-merchant (:yodlee-merchant which)
|
||||
:description-original (:description-original which)
|
||||
:location (:location which)
|
||||
:client-id (:id (:client which))
|
||||
:account-id (:id (:account which))
|
||||
@@ -69,7 +72,6 @@
|
||||
(defn form [{:keys [edit-completed]}]
|
||||
[forms/side-bar-form {:form ::edit-transaction }
|
||||
(let [{:keys [data active? error id]} @(re-frame/subscribe [::forms/form ::edit-transaction])
|
||||
data (assoc data :merchant-name "Hello") ;; TODO - just until merchant is added
|
||||
locations @(re-frame/subscribe [::subs/locations-for-client (:client-id data)])
|
||||
change-event [::forms/change ::edit-transaction]]
|
||||
^{:key id}
|
||||
@@ -78,6 +80,7 @@
|
||||
(.stopPropagation e)
|
||||
(.preventDefault e))
|
||||
(re-frame/dispatch-sync [::saving edit-completed]))}
|
||||
(println data)
|
||||
[:h1.title.is-2 "Edit Transaction"]
|
||||
|
||||
(comment
|
||||
@@ -90,7 +93,16 @@
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input.input {:type "text"
|
||||
:field [:merchant-name]
|
||||
:field [:yodlee-merchant :name]
|
||||
:disabled "disabled"
|
||||
:subscription data}]]]]
|
||||
|
||||
[:div.field
|
||||
[:p.help "Description"]
|
||||
[:div.control
|
||||
[bind-field
|
||||
[:input.input {:type "text"
|
||||
:field [:description-original]
|
||||
:disabled "disabled"
|
||||
:subscription data}]]]]
|
||||
|
||||
|
||||
@@ -77,14 +77,18 @@
|
||||
[:tr
|
||||
[:td {:col-span 5}
|
||||
[:i.fa.fa-spin.fa-spinner]]]
|
||||
(for [{:keys [client account vendor payment status bank-account description-original date amount id ] :as i} (:transactions @transaction-page)]
|
||||
(for [{:keys [client account vendor payment status bank-account description-original date amount id yodlee-merchant ] :as i} (:transactions @transaction-page)]
|
||||
^{:key id}
|
||||
[:tr {:class (:class i)}
|
||||
(when-not selected-client
|
||||
[:td (:name client)])
|
||||
[:td (if vendor
|
||||
[:td (cond vendor
|
||||
(:name vendor)
|
||||
[:i.has-text-grey (str "Merchant '" "Hello" "'")])]
|
||||
yodlee-merchant
|
||||
[:i.has-text-grey (str "Merchant '" (:name yodlee-merchant) "'")]
|
||||
|
||||
:else
|
||||
[:i.has-text-grey (str "Unknown Merchant")])]
|
||||
#_[:td description-original]
|
||||
[:td (date->str date) ]
|
||||
[:td.has-text-right (nf amount )]
|
||||
|
||||
Reference in New Issue
Block a user