Highlights plaid errors more clearly
This commit is contained in:
@@ -1,35 +1,36 @@
|
||||
(ns auto-ap.ssr.company.plaid
|
||||
(:require
|
||||
[auto-ap.datomic
|
||||
:refer [add-sorter-fields
|
||||
apply-pagination
|
||||
apply-sort-3
|
||||
conn
|
||||
merge-query
|
||||
pull-attr
|
||||
pull-many-by-id
|
||||
query2]]
|
||||
[auto-ap.graphql.utils :refer [assert-can-see-client]]
|
||||
[auto-ap.logging :as alog]
|
||||
[auto-ap.plaid.core :as p]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.grid-page-helper :as helper]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils :refer [html-response]]
|
||||
[auto-ap.time :as atime]
|
||||
[bidi.bidi :as bidi]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clj-time.core :as time]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]))
|
||||
(:require [auto-ap.datomic
|
||||
:refer [add-sorter-fields apply-pagination apply-sort-3 conn merge-query
|
||||
pull-attr pull-many-by-id query2]]
|
||||
[auto-ap.graphql.utils :refer [assert-can-see-client]]
|
||||
[auto-ap.logging :as alog]
|
||||
[auto-ap.plaid.core :as p]
|
||||
[auto-ap.ssr-routes :as ssr-routes]
|
||||
[auto-ap.ssr.components :as com]
|
||||
[auto-ap.ssr.grid-page-helper :as helper]
|
||||
[auto-ap.ssr.hx :as hx]
|
||||
[auto-ap.ssr.svg :as svg]
|
||||
[auto-ap.ssr.utils :refer [html-response]]
|
||||
[auto-ap.time :as atime]
|
||||
[bidi.bidi :as bidi]
|
||||
[clj-time.coerce :as coerce]
|
||||
[clj-time.core :as time]
|
||||
[clojure.string :as str]
|
||||
[datomic.api :as dc]
|
||||
[hiccup2.core :as hiccup]))
|
||||
|
||||
(def default-read '[:db/id
|
||||
:plaid-item/external-id
|
||||
:plaid-item/access-token
|
||||
:plaid-item/last-updated
|
||||
:plaid-item/status
|
||||
|
||||
{:plaid-item/accounts [:db/id
|
||||
{:bank-account/_plaid-account [{:bank-account/integration-status
|
||||
[{ [ :integration-status/state :xform iol-ion.query/ident] [:db/ident]}
|
||||
:integration-status/message
|
||||
:integration-status/last-attempt
|
||||
:integration-status/last-updated]}]}
|
||||
:plaid-account/external-id
|
||||
:plaid-account/number
|
||||
:plaid-account/balance
|
||||
@@ -169,14 +170,57 @@
|
||||
:name "Plaid Item"
|
||||
:sort-key "external-id"
|
||||
:render :plaid-item/external-id}
|
||||
{:key "status"
|
||||
:name "Status"
|
||||
:sort-key "status"
|
||||
:render #(when-let [status (:plaid-item/status %)]
|
||||
[:div [:div (com/pill {:color :primary}
|
||||
status)]
|
||||
[:div (atime/unparse-local (coerce/to-date-time (:plaid-item/last-updated %)) atime/normal-date)]])}
|
||||
{:key "integreat-plaid-status"
|
||||
:name "Integreat ↔ Plaid status"
|
||||
:sort-key "integreat-plaid-status"
|
||||
:render (fn [e]
|
||||
|
||||
(let [bad-integration (->> (:plaid-item/accounts e)
|
||||
(map (comp
|
||||
first
|
||||
:bank-account/_plaid-account))
|
||||
(filter (comp #{:integration-state/failed :integration-state/unauthorized}
|
||||
:integration-status/state
|
||||
:bank-account/integration-status))
|
||||
first
|
||||
:bank-account/integration-status)]
|
||||
[:div
|
||||
(when bad-integration
|
||||
{:x-popper (hx/json {:source "$refs.button"
|
||||
:tooltip "$refs.tooltip"})
|
||||
:x-data (hx/json {})
|
||||
})
|
||||
[:div.cursor-pointer (com/pill {:color (if bad-integration
|
||||
:red
|
||||
:primary) :x-ref "button"}
|
||||
|
||||
[:div.inline-flex.gap-2
|
||||
(or
|
||||
(some-> bad-integration
|
||||
:integration-status/state
|
||||
name
|
||||
str/capitalize)
|
||||
"Success")
|
||||
(when bad-integration
|
||||
" (detail)")
|
||||
|
||||
|
||||
(when bad-integration
|
||||
(com/tooltip {:x-ref "tooltip"}
|
||||
[:div.text-red-700
|
||||
(:integration-status/message bad-integration)]))])]
|
||||
[:div.grid.grid-cols-2.gap-1.auto-cols-min.grid-flow-row.shrink
|
||||
[:div "Attempted: "] [:div (atime/unparse-local (coerce/to-date-time (:integration-status/last-attempt e)) atime/normal-date)]
|
||||
[:div "Last Updated: "] [:div (atime/unparse-local (coerce/to-date-time (:integration-status/last-updated e)) atime/normal-date)]]]))}
|
||||
{:key "plaid-bank-status"
|
||||
:name "Plaid ↔ Bank Status"
|
||||
:sort-key "plaid-bank-status"
|
||||
:render (fn [e]
|
||||
(when-let [status (:plaid-item/status e)]
|
||||
[:div [:div (com/pill {:color :primary}
|
||||
status)]
|
||||
[:div (atime/unparse-local (coerce/to-date-time (:plaid-item/last-updated e)) atime/normal-date)]]))}
|
||||
|
||||
{:key "accounts"
|
||||
:name "Accounts"
|
||||
:show-starting "md"
|
||||
|
||||
Reference in New Issue
Block a user