Skip to content

Instantly share code, notes, and snippets.

@joncol
Last active June 25, 2020 09:53
Show Gist options
  • Save joncol/5976485fa7b2454dd164838004908d6c to your computer and use it in GitHub Desktop.
Save joncol/5976485fa7b2454dd164838004908d6c to your computer and use it in GitHub Desktop.
pr-suggestion
(defn get-callback-success [request id]
(jdbc/with-db-transaction [db (-> request :opts :db)]
(let [config (-> request :opts :config)
boundaries (-> request :opts :boundaries)
merchant (:merchant boundaries)
mantis (:mantis boundaries)
deposit (db/get-deposit db {:id id})
identification (delay (db/get-identification db {:id id}))
withdrawal (delay (update-withdrawal! (:opts request) id))]
(cond
deposit (get-deposit-success db boundaries deposit)
@identification (get-identification-success db mantis merchant @identification)
@withdrawal (get-withdrawal-success merchant @withdrawal)
:else (resp/not-found {:error "No such ID!"})))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment