/
confirmation.clj
47 lines (34 loc) · 2.95 KB
/
confirmation.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
;; Freecoin-lib - library to facilitate blockchain functions
;; part of Decentralized Citizen Engagement Technologies (D-CENT)
;; R&D funded by the European Commission (FP7/CAPS 610349)
;; Copyright (C) 2015- Dyne.org foundation
;; Sourcecode designed, written and maintained by
;; Denis Roio <jaromil@dyne.org>
;; Aspasia Beneti <aspra@dyne.org>
;; With contributions by
;; Carlo Sciolla
;; Arjan Scherpenisse <arjan@scherpenisse.net>
;; Freecoin-lib is free software; you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
;; Freecoin-lib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
;; You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
;; Additional permission under GNU AGPL version 3 section 7.
;; If you modify Freecoin-lib, or any covered work, by linking or combining it with any library (or a modified version of that library), containing parts covered by the terms of EPL v 1.0, the licensors of this Program grant you additional permission to convey the resulting work. Your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. Corresponding Source for a non-source form of such a combination shall include the source code for the parts of the libraries (dependencies) covered by the terms of EPL v 1.0 used as well as that of the covered work.
(ns freecoin-lib.db.confirmation
(:require [clj-storage.core :as storage]
[freecoin-lib.utils :as util]))
(defn new-transaction-confirmation!
([confirmation-store uuid-generator sender-email recipient-email amount]
(new-transaction-confirmation! confirmation-store uuid-generator sender-email recipient-email amount #{}))
([confirmation-store uuid-generator sender-email recipient-email amount tags]
(let [confirmation {:uid (uuid-generator)
:type :transaction
:data {:sender-email sender-email
:recipient-email recipient-email
:amount amount
:tags tags}}
stored (some-> (storage/store! confirmation-store :uid confirmation))]
stored)))
(defn fetch [confirmation-store email]
(some-> (storage/fetch confirmation-store email)))
(defn delete! [confirmation-store email]
(storage/delete! confirmation-store email))