aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-12 10:11:24 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-12 10:11:24 +0100
commit83631bc98fe70dd73f212581fb54ab3a82560686 (patch)
tree058fd4b741f2dc650da5aee21af61df3ddf3d98b /src/include
parenta1db41e09a618c3a9797242ee593da1331175c14 (diff)
split reserve closing from main aggregation logic
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_exchangedb_lib.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/include/taler_exchangedb_lib.h b/src/include/taler_exchangedb_lib.h
index 7139335cc..d8ce0e16a 100644
--- a/src/include/taler_exchangedb_lib.h
+++ b/src/include/taler_exchangedb_lib.h
@@ -25,6 +25,7 @@
#include "taler_signatures.h"
#include "taler_exchangedb_plugin.h"
+#include "taler_bank_service.h"
/**
* Subdirectroy under the exchange's base directory which contains
@@ -460,4 +461,104 @@ TALER_EXCHANGEDB_calculate_transaction_list_totals (
struct TALER_Amount *ret);
+/* ***************** convenience functions ******** */
+
+/**
+ * Information we keep for each supported account of the exchange.
+ */
+struct TALER_EXCHANGEDB_WireAccount
+{
+ /**
+ * Accounts are kept in a DLL.
+ */
+ struct TALER_EXCHANGEDB_WireAccount *next;
+
+ /**
+ * Plugins are kept in a DLL.
+ */
+ struct TALER_EXCHANGEDB_WireAccount *prev;
+
+ /**
+ * Authentication data.
+ */
+ struct TALER_BANK_AuthenticationData auth;
+
+ /**
+ * Wire transfer fee structure.
+ */
+ struct TALER_EXCHANGEDB_AggregateFees *af;
+
+ /**
+ * Name of the section that configures this account.
+ */
+ char *section_name;
+
+ /**
+ * Name of the wire method underlying the account.
+ */
+ char *method;
+
+};
+
+
+/**
+ * Update wire transfer fee data structure in @a wa.
+ *
+ * @param cfg configuration to use
+ * @param db_plugin database plugin to use
+ * @param wa wire account data structure to update
+ * @param now timestamp to update fees to
+ * @param session DB session to use
+ * @return fee valid at @a now, or NULL if unknown
+ */
+struct TALER_EXCHANGEDB_AggregateFees *
+TALER_EXCHANGEDB_update_fees (const struct GNUNET_CONFIGURATION_Handle *cfg,
+ struct TALER_EXCHANGEDB_Plugin *db_plugin,
+ struct TALER_EXCHANGEDB_WireAccount *wa,
+ struct GNUNET_TIME_Absolute now,
+ struct TALER_EXCHANGEDB_Session *session);
+
+
+/**
+ * Find the wire plugin for the given payto:// URL.
+ * Only useful after the accounts have been loaded
+ * using #TALER_EXCHANGEDB_load_accounts().
+ *
+ * @param method wire method we need an account for
+ * @return NULL on error
+ */
+struct TALER_EXCHANGEDB_WireAccount *
+TALER_EXCHANGEDB_find_account_by_method (const char *method);
+
+
+/**
+ * Find the wire plugin for the given payto:// URL
+ * Only useful after the accounts have been loaded
+ * using #TALER_EXCHANGEDB_load_accounts().
+ *
+ * @param url wire address we need an account for
+ * @return NULL on error
+ */
+struct TALER_EXCHANGEDB_WireAccount *
+TALER_EXCHANGEDB_find_account_by_payto_uri (const char *url);
+
+
+/**
+ * Load account information opf the exchange from
+ * @a cfg.
+ *
+ * @param cfg configuration to load from
+ * @return #GNUNET_OK on success, #GNUNET_NO if no accounts are configured
+ */
+int
+TALER_EXCHANGEDB_load_accounts (const struct GNUNET_CONFIGURATION_Handle *cfg);
+
+
+/**
+ * Free resources allocated by
+ * #TALER_EXCHANGEDB_load_accounts().
+ */
+void
+TALER_EXCHANGEDB_unload_accounts (void);
+
#endif