summaryrefslogtreecommitdiff
path: root/src/include/taler_merchantdb_plugin.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/taler_merchantdb_plugin.h')
-rw-r--r--src/include/taler_merchantdb_plugin.h108
1 files changed, 103 insertions, 5 deletions
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h
index 631cdcd5..c838a175 100644
--- a/src/include/taler_merchantdb_plugin.h
+++ b/src/include/taler_merchantdb_plugin.h
@@ -255,6 +255,22 @@ typedef void
(*TALER_MERCHANTDB_ProductsCallback)(void *cls,
const char *product_id);
+/**
+ * Typically called by `lookup_token_families`.
+ *
+ * @param cls a `json_t *` JSON array to build
+ * @param slug slug of the token family
+ * @param name name of the token family
+ * @param start_time start time of the token family's validity period
+ * @param expiration end time of the token family's validity period
+ */
+typedef void
+(*TALER_MERCHANTDB_TokenFamiliesCallback)(void *cls,
+ const char *slug,
+ const char *name,
+ struct GNUNET_TIME_Timestamp start_time,
+ struct GNUNET_TIME_Timestamp expiration);
+
/**
* Details about a product.
@@ -1116,6 +1132,16 @@ struct TALER_MERCHANTDB_TokenFamilyDetails
json_t *description_i18n;
/**
+ * Start time of the token family duration.
+ */
+ struct GNUNET_TIME_Timestamp valid_after;
+
+ /**
+ * End time of the token family duration.
+ */
+ struct GNUNET_TIME_Timestamp valid_before;
+
+ /**
* Validity duration of the token family.
*/
struct GNUNET_TIME_Relative duration;
@@ -1166,11 +1192,6 @@ struct TALER_MERCHANTDB_TokenFamilyKeyDetails
* Token family private key.
*/
struct TALER_TokenFamilyPrivateKey priv;
-
- /**
- * Token family key cipher.
- */
- // enum TALER_MERCHANTDB_TokenKeyCipher cipher;
};
/**
@@ -3540,6 +3561,83 @@ struct TALER_MERCHANTDB_Plugin
(*insert_exchange_keys)(void *cls,
const struct TALER_EXCHANGE_Keys *keys);
+
+ /**
+ * Lookup all of the token families the given instance has configured.
+ *
+ * @param cls closure
+ * @param instance_id instance to lookup token families for
+ * @param cb function to call on all token families found
+ * @param cb_cls closure for @a cb
+ * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*lookup_token_families)(void *cls,
+ const char *instance_id,
+ TALER_MERCHANTDB_TokenFamiliesCallback cb,
+ void *cb_cls);
+
+ /**
+ * Lookup details about a particular token family.
+ *
+ * @param cls closure
+ * @param instance_id instance to lookup token family for
+ * @param token_family_slug token family to lookup
+ * @param[out] details set to the token family details on success, can be NULL
+ * (in that case we only want to check if the token family exists)
+ * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*lookup_token_family)(void *cls,
+ const char *instance_id,
+ const char *token_family_slug,
+ struct TALER_MERCHANTDB_TokenFamilyDetails *details);
+
+ /**
+ * Delete information about a token family.
+ *
+ * @param cls closure
+ * @param instance_id instance to delete token family of
+ * @param token_family_slug slug of token family to delete
+ * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*delete_token_family)(void *cls,
+ const char *instance_id,
+ const char *token_family_slug);
+
+ /**
+ * Update details about a particular token family.
+ *
+ * @param cls closure
+ * @param instance_id instance to update token family for
+ * @param token_family_slug slug of token family to update
+ * @param details set to the updated token family on success, can be NULL
+ * (in that case we only want to check if the token family exists)
+ * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*update_token_family)(void *cls,
+ const char *instance_id,
+ const char *token_family_slug,
+ const struct TALER_MERCHANTDB_TokenFamilyDetails *details);
+
+
+ /**
+ * Insert details about a particular token family.
+ *
+ * @param cls closure
+ * @param instance_id instance to insert product for
+ * @param token_family_slug slug of token family to insert
+ * @param details the token family details to insert
+ * @return database result code
+ */
+ enum GNUNET_DB_QueryStatus
+ (*insert_token_family)(void *cls,
+ const char *instance_id,
+ const char *token_family_slug,
+ const struct TALER_MERCHANTDB_TokenFamilyDetails *details);
+
};
#endif