summaryrefslogtreecommitdiff
path: root/src/include/taler_exchangedb_plugin.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-04-20 21:38:02 +0200
committerChristian Grothoff <christian@grothoff.org>2017-04-20 21:38:02 +0200
commit27c921c7c45f8ea8fed5c945a9e0ae0cfcc1c8e9 (patch)
tree16da56b06fb589d3be77fc48c2116b7cb54647dc /src/include/taler_exchangedb_plugin.h
parent92d9ec69e6d8e9f7eb0be0d6a7f67444189b319e (diff)
downloadexchange-27c921c7c45f8ea8fed5c945a9e0ae0cfcc1c8e9.tar.gz
exchange-27c921c7c45f8ea8fed5c945a9e0ae0cfcc1c8e9.tar.bz2
exchange-27c921c7c45f8ea8fed5c945a9e0ae0cfcc1c8e9.zip
finished implementing #4956 in principle, but not yet tested
Diffstat (limited to 'src/include/taler_exchangedb_plugin.h')
-rw-r--r--src/include/taler_exchangedb_plugin.h49
1 files changed, 44 insertions, 5 deletions
diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h
index 5daa9d2f8..b040077e8 100644
--- a/src/include/taler_exchangedb_plugin.h
+++ b/src/include/taler_exchangedb_plugin.h
@@ -100,8 +100,8 @@ struct TALER_EXCHANGEDB_ClosingTransfer
* Detailed wire transfer information that uniquely identifies the
* wire transfer.
*/
- json_t *transfer_details;
-
+ struct TALER_WireTransferIdentifierRawP transfer_details;
+
};
@@ -991,7 +991,25 @@ typedef int
const struct TALER_Amount *closing_fee,
const struct TALER_ReservePublicKeyP *reserve_pub,
const json_t *receiver_account,
- const json_t *transfer_details);
+ const struct TALER_WireTransferIdentifierRawP *transfer_details);
+
+
+/**
+ * Function called with details about expired reserves.
+ *
+ * @param cls closure
+ * @param reserve_pub public key of the reserve
+ * @param left amount left in the reserve
+ * @param account_details information about the reserve's bank account
+ * @param expiration_date when did the reserve expire
+ * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
+ */
+typedef int
+(*TALER_EXCHANGEDB_ReserveExpiredCallback)(void *cls,
+ const struct TALER_ReservePublicKeyP *reserve_pub,
+ const struct TALER_Amount *left,
+ const json_t *account_details,
+ struct GNUNET_TIME_Absolute expiration_date);
/**
@@ -1784,6 +1802,27 @@ struct TALER_EXCHANGEDB_Plugin
/**
+ * Obtain information about expired reserves and their
+ * remaining balances.
+ *
+ * @param cls closure of the plugin
+ * @param session database connection
+ * @param now timestamp based on which we decide expiration
+ * @param rec function to call on expired reserves
+ * @param rec_cls closure for @a rec
+ * @return #GNUNET_SYSERR on database error
+ * #GNUNET_NO if there are no expired non-empty reserves
+ * #GNUNET_OK on success
+ */
+ int
+ (*get_expired_reserves)(void *cls,
+ struct TALER_EXCHANGEDB_Session *session,
+ struct GNUNET_TIME_Absolute now,
+ TALER_EXCHANGEDB_ReserveExpiredCallback rec,
+ void *rec_cls);
+
+
+ /**
* Insert reserve close operation into database.
*
* @param cls closure
@@ -1800,10 +1839,10 @@ struct TALER_EXCHANGEDB_Plugin
int
(*insert_reserve_closed)(void *cls,
struct TALER_EXCHANGEDB_Session *session,
- struct TALER_ReservePublicKeyP *reserve_pub,
+ const struct TALER_ReservePublicKeyP *reserve_pub,
struct GNUNET_TIME_Absolute execution_date,
const json_t *receiver_account,
- const json_t *transfer_details,
+ const struct TALER_WireTransferIdentifierRawP *transfer_details,
const struct TALER_Amount *amount_with_fee,
const struct TALER_Amount *closing_fee);