aboutsummaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-05-05 22:57:55 +0200
committerChristian Grothoff <christian@grothoff.org>2016-05-05 22:57:55 +0200
commit0c959e75d109fc914ab8891518f7963ade74cff8 (patch)
tree2f0bc9375e019a57d9787dddb5eed8fd6aadfc67 /src/exchangedb
parent07d9978fb94b50345dfe0d52f48b1fe962417cfd (diff)
working on #3641: more on /refund implementation
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/plugin_exchangedb_common.c5
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c40
2 files changed, 44 insertions, 1 deletions
diff --git a/src/exchangedb/plugin_exchangedb_common.c b/src/exchangedb/plugin_exchangedb_common.c
index c8e689cfd..c18b958cf 100644
--- a/src/exchangedb/plugin_exchangedb_common.c
+++ b/src/exchangedb/plugin_exchangedb_common.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2015 GNUnet e.V.
+ Copyright (C) 2015, 2016 Inria & GNUnet e.V.
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -107,6 +107,9 @@ common_free_coin_transaction_list (void *cls,
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
GNUNET_free (list->details.melt);
break;
+ case TALER_EXCHANGEDB_TT_REFUND:
+ GNUNET_free (list->details.refund);
+ break;
}
GNUNET_free (list);
list = next;
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 612dabb79..b189b7a17 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -2177,6 +2177,26 @@ postgres_mark_deposit_tiny (void *cls,
/**
+ * Test if a deposit was marked as done, thereby declaring that it cannot be
+ * refunded anymore.
+ *
+ * @param cls the @e cls of this struct with the plugin-specific state
+ * @param session connection to the database
+ * @param deposit the deposit to check
+ * @return #GNUNET_YES if is is marked done done, #GNUNET_NO if not,
+ * #GNUNET_SYSERR on error (deposit unknown)
+ */
+static int
+postgres_test_deposit_done (void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const struct TALER_EXCHANGEDB_Deposit *deposit)
+{
+ GNUNET_break (0); // not implemented
+ return GNUNET_SYSERR;
+}
+
+
+/**
* Mark a deposit as done, thereby declaring that it cannot be
* executed at all anymore, and should no longer be returned by
* @e iterate_ready_deposits() or @e iterate_matching_deposits().
@@ -2467,6 +2487,24 @@ postgres_insert_deposit (void *cls,
/**
+ * Insert information about refunded coin into the database.
+ *
+ * @param cls the @e cls of this struct with the plugin-specific state
+ * @param session connection to the database
+ * @param refund refund information to store
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
+ */
+static int
+postgres_insert_refund (void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ const struct TALER_EXCHANGEDB_Refund *refund)
+{
+ GNUNET_break (0); // not implemented
+ return GNUNET_SYSERR;
+}
+
+
+/**
* Lookup refresh session data under the given @a session_hash.
*
* @param cls the `struct PostgresClosure` with the plugin-specific state
@@ -4242,10 +4280,12 @@ libtaler_plugin_exchangedb_postgres_init (void *cls)
plugin->free_reserve_history = &common_free_reserve_history;
plugin->have_deposit = &postgres_have_deposit;
plugin->mark_deposit_tiny = &postgres_mark_deposit_tiny;
+ plugin->test_deposit_done = &postgres_test_deposit_done;
plugin->mark_deposit_done = &postgres_mark_deposit_done;
plugin->get_ready_deposit = &postgres_get_ready_deposit;
plugin->iterate_matching_deposits = &postgres_iterate_matching_deposits;
plugin->insert_deposit = &postgres_insert_deposit;
+ plugin->insert_refund = &postgres_insert_refund;
plugin->get_refresh_session = &postgres_get_refresh_session;
plugin->create_refresh_session = &postgres_create_refresh_session;
plugin->insert_refresh_melt = &postgres_insert_refresh_melt;