This commit is contained in:
Bryce Covert
2021-01-11 10:55:08 -08:00
parent c8da0697a2
commit 664ec69868
7 changed files with 73 additions and 40 deletions

View File

@@ -3,7 +3,8 @@
[auto-ap.datomic :refer [uri merge-query apply-sort-3 apply-pagination add-sorter-fields conn]]
[auto-ap.graphql.utils :refer [limited-clients]]
[clj-time.coerce :as c]
[clj-time.coerce :as coerce]))
[clj-time.coerce :as coerce]
[clojure.tools.logging :as log]))
(defn sort-fn [sort-by]
(cond
@@ -102,7 +103,8 @@
:args [(:location args)]})
(:unresolved args)
(merge-query {:query {:where ['(or-join [?e]
(merge-query {:query {:where ['[?e :transaction/date]
'(or-join [?e]
(not [?e :transaction/accounts])
(and [?e :transaction/accounts ?tas]
(not [?tas :transaction-account/account])))]}})
@@ -136,6 +138,7 @@
(merge-query {:query {:find ['?sort-default '?e]
:where ['[?e :transaction/id]
'[?e :transaction/date ?sort-default]]}}))]
(log/info "query is" query)
(cond->> query
true (d/query)
true (apply-sort-3 args)

View File

@@ -1176,7 +1176,8 @@
month (range -1 7)
:let [next (t/plus (t/local-date (t/year (time/local-now))
(t/month (time/local-now))
day-of-month )
(Math/min (Math/max day-of-month 1)
30) )
(t/months month))]
:when (not (has-fulfilled? id next recent-fulfillments))]
{:identifier identifier

View File

@@ -31,8 +31,7 @@
:input-stream (io/make-input-stream raw-bytes {})
:metadata {:content-type "image/jpeg"}
:canned-acl "public-read")
(str "https://integreat-signature-images.s3.amazonaws.com/" signature-id ".jpg")
))))
(str "https://integreat-signature-images.s3.amazonaws.com/" signature-id ".jpg")))))
(defn edit-client [context {:keys [edit_client new_bank_accounts] :as args} value]
(assert-admin (:id context))

View File

@@ -279,20 +279,23 @@
([client-code provider-accounts]
(let [accounts (get-accounts-for-providers (client-code->login client-code) (map :id provider-accounts))]
(map (fn [pa]
{:yodlee-provider-account/id (:id pa)
:yodlee-provider-account/status (:status pa)
:yodlee-provider-account/detailed-status (-> pa :dataset first :additionalStatus)
:yodlee-provider-account/client [:client/code client-code]
:yodlee-provider-account/last-updated (-> pa :dataset first :lastUpdated coerce/to-date)
:yodlee-provider-account/accounts (mapv
(fn [a]
{:yodlee-account/id (:id a)
:yodlee-account/name (str (:providerName a) " (" (:accountName a) ")")
:yodlee-account/number (:accountNumber a)
:yodlee-account/status (-> a :dataset first :additionalStatus)
:yodlee-account/available-balance (or (-> a :currentBalance :amount)
0.0)})
(get accounts (:id pa)))})
(cond->
{:yodlee-provider-account/id (:id pa)
:yodlee-provider-account/status (:status pa)
:yodlee-provider-account/detailed-status (-> pa :dataset first :additionalStatus)
:yodlee-provider-account/client [:client/code client-code]
:yodlee-provider-account/accounts (mapv
(fn [a]
{:yodlee-account/id (:id a)
:yodlee-account/name (str (:providerName a) " (" (:accountName a) ")")
:yodlee-account/number (:accountNumber a)
:yodlee-account/status (-> a :dataset first :additionalStatus)
:yodlee-account/available-balance (or (-> a :currentBalance :amount)
0.0)})
(get accounts (:id pa)))}
(-> pa :dataset first :lastUpdated) (assoc :yodlee-provider-account/last-updated (-> pa :dataset first :lastUpdated coerce/to-date)) ))
provider-accounts))))
(defn refresh-provider-account [client-code id]

View File

@@ -134,7 +134,7 @@
(when (> (count @clients) 1)
[navbar-drop-down {:header (str "Client: " (if @client (:name @client)
[navbar-drop-down {:header (str "Company: " (if @client (:name @client)
"All"))
:id ::select-client}
[:div
@@ -143,7 +143,7 @@
(re-frame/dispatch [::events/swap-client nil]))} "All" ]
[:hr {:class "navbar-divider"}]
[bind-field
[:input.input.navbar-item {:placeholder "Client name"
[:input.input.navbar-item {:placeholder "Company name"
:auto-focus true
:field [:value]
:on-key-up (fn [k]

View File

@@ -23,6 +23,24 @@
(def signature-canvas (r/adapt-react-class (.-default canvas)))
(defn upload-replacement-button [{:keys [on-change]} text]
(let [button (atom nil)]
(r/create-class {:display-name "Upload button"
:reagent-render
(fn []
[:<>
[:label.button {:for "upload_replacement_signature"} text]
[:input.button {:type "file" :id "upload_replacement_signature"
:style {:display "none"}
:on-change (fn []
(let [fr (js/FileReader.)]
(.addEventListener fr "load" (fn []
(on-change (.-result fr))))
(.readAsDataURL fr (aget (.-files @button) 0)))
)
:ref (fn [i] (reset! button i))} ]])})))
(defn signature [{:keys [signature-file signature-data on-change]}]
(let [canvas (atom nil)
edit-mode? (r/atom false)
@@ -56,7 +74,9 @@
[:div.buttons
[:a.button {:on-click (fn []
(reset! edit-mode? true))}
"Replace Signature"]]]
"Replace Signature"]
[upload-replacement-button {:on-change on-change} "Upload replacement"]]]
[:div
[:div.has-text-centered.is-vcentered {:style {:width w
:height h
@@ -66,7 +86,9 @@
[:div.buttons
[:a.button.is-primary.is-outlined {:on-click (fn []
(reset! edit-mode? true))}
"New Signature"]]]))
"New Signature"]
[upload-replacement-button {:on-change on-change} "Upload signature"]]]))
])))
(re-frame/reg-sub

View File

@@ -410,23 +410,28 @@
(let [authentication @(re-frame/subscribe [::authentication])
status @(re-frame/subscribe [::status/single ::authenticating])
client-code (:code @(re-frame/subscribe [::subs/client]))]
(if (and authentication client-code)
[:div
"Authentication successful!"
[:div#fa-spot]
[:button.button.is-primary {:on-click (fn []
(.open (.-fastlink js/window)
#js {"fastLinkURL" (:url authentication)
"accessToken" (:token authentication)
"params" #js { "configName" "Aggregation"}}
"fa-spot")
)}
[:span [:span.icon [:i.fa.fa-external-link]] " Go to yodlee"]]]
[:button.button.is-primary {:disabled (status/disabled-for status)
:class (status/class-for status)
:on-click (dispatch-event [::authenticate-with-yodlee client-code])}
"Authenticate with Yodlee (" client-code ")"]))])
(cond (and authentication client-code)
[:div
"Authentication successful!"
[:div#fa-spot]
[:button.button.is-primary {:on-click (fn []
(.open (.-fastlink js/window)
#js {"fastLinkURL" (:url authentication)
"accessToken" (:token authentication)
"params" #js { "configName" "Aggregation"}}
"fa-spot")
)}
[:span [:span.icon [:i.fa.fa-external-link]] " Go to yodlee"]]]
client-code
[:button.button.is-primary {:disabled (status/disabled-for status)
:class (status/class-for status)
:on-click (dispatch-event [::authenticate-with-yodlee client-code])}
"Authenticate with Yodlee (" client-code ")"]
:else
nil))])
(defn admin-yodlee-provider-accounts-content []
[:div