diff --git a/src/clj/auto_ap/graphql.clj b/src/clj/auto_ap/graphql.clj index 326b3859..5aa9cbde 100644 --- a/src/clj/auto_ap/graphql.clj +++ b/src/clj/auto_ap/graphql.clj @@ -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} diff --git a/src/clj/auto_ap/routes/exports.clj b/src/clj/auto_ap/routes/exports.clj index 5b333a27..fde51090 100644 --- a/src/clj/auto_ap/routes/exports.clj +++ b/src/clj/auto_ap/routes/exports.clj @@ -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]]]] diff --git a/src/clj/auto_ap/yodlee/import.clj b/src/clj/auto_ap/yodlee/import.clj index dd69e590..942e0485 100644 --- a/src/clj/auto_ap/yodlee/import.clj +++ b/src/clj/auto_ap/yodlee/import.clj @@ -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)