This commit is contained in:
Bryce Covert
2019-02-07 18:05:42 -08:00
parent d674b36d30
commit 41bf4dbabb
3 changed files with 22 additions and 21 deletions

View File

@@ -106,6 +106,7 @@
:payment {:fields {:id {:type :id}
:type {:type :payment_type}
:original_id {:type 'Int}
:amount {:type 'String}
:vendor {:type :vendor}
:client {:type :client}

View File

@@ -24,7 +24,7 @@
{:client-code (query-params "client-code")
:original-id (query-params "original")}
[:id :total :outstanding-balance :invoice-number :date :status :original-id
[:payments [:amount [:payment [:check-number :memo [:bank_account [:id :name :number :bank-name :bank-code]]]]]]
[:payments [:amount [:payment [:check-number :memo [:bank_account [:id :name :number :bank-name :bank-code :code]]]]]]
[:vendor [:name :id [:primary_contact [:name]] [:address [:street1 :city :state :zip]]]]
[:expense_accounts [:amount :id :expense_account_id :location
[:expense_account [:id :name [:parent [:id :name]]]]]]
@@ -37,7 +37,7 @@
(let [query [[:all_payments
{:client-code (query-params "client-code")
:original-id (query-params "original")}
[:id :check-number :amount :memo :date :status :type
[:id :check-number :amount :memo :date :status :type :original-id
[:invoices [[:invoice [:id :original-id]] :amount]]
[:bank-account [:number :code :bank-name :bank-code :id]]
[:vendor [:name :id [:primary-contact [:name :email :phone]] :default-expense-account [:address [:street1 :city :state :zip]]]]

View File

@@ -68,23 +68,23 @@
(try
(when client-id
@(->> [(remove-nils #:transaction
{:post-date (time/parse post-date "YYYY-MM-dd")
:id (sha-256 (str id))
:account-id account-id
:date (coerce/to-date (time/parse date "YYYY-MM-dd"))
:amount amount
:description-original description-original
:description-simple description-simple
:type type
:status status
:client client-id
:check-number check-number
:bank-account (transaction->bank-account-id transaction)
:payment (when check-id
{:db/id check-id
:payment/status :payment-status/cleared}
)
})]
{:post-date (coerce/to-date (time/parse post-date "YYYY-MM-dd"))
:id (sha-256 (str id))
:account-id account-id
:date (coerce/to-date (time/parse date "YYYY-MM-dd"))
:amount (double amount)
:description-original description-original
:description-simple description-simple
:type type
:status status
:client client-id
:check-number check-number
:bank-account (transaction->bank-account-id transaction)
:payment (when check-id
{:db/id check-id
:payment/status :payment-status/cleared}
)
})]
(d/transact (d/connect uri))))
@@ -115,8 +115,8 @@
(defn do-import []
(let [transactions (client/get-transactions)
_ (println "All accounts:" (client/get-accounts))
_ (println "ALL Transactions:" transactions)
#_#__ (println "All accounts:" (client/get-accounts))
#_#__ (println "ALL Transactions:" transactions)
all-bank-accounts (mapcat (fn [c] (map
(fn [{:keys [:db/id :bank-account/yodlee-account-id]}]
(when (and id yodlee-account-id)