only inserting transactions if company found

This commit is contained in:
BC
2018-08-02 22:01:02 -07:00
parent 0878ccbf20
commit 208c294bec

View File

@@ -68,23 +68,24 @@
(try
(transactions/upsert!
{:post-date (time/parse post-date "YYYY-MM-dd")
:id (sha-256 (str id))
:account-id account-id
:date (time/parse date "YYYY-MM-dd")
:amount amount
:description-original description-original
:description-simple description-simple
:type type
:status status
:company-id company-id
:check-number check-number
:bank-account-id (transaction->bank-account-id transaction)
:check-id check-id
})
(when check-id
(checks/update! {:id check-id :status "cleared"}))
(when company-id
(transactions/upsert!
{:post-date (time/parse post-date "YYYY-MM-dd")
:id (sha-256 (str id))
:account-id account-id
:date (time/parse date "YYYY-MM-dd")
:amount amount
:description-original description-original
:description-simple description-simple
:type type
:status status
:company-id company-id
:check-number check-number
:bank-account-id (transaction->bank-account-id transaction)
:check-id check-id
})
(when check-id
(checks/update! {:id check-id :status "cleared"})))
(catch Exception e
(println e)))))