diff options
author | priscilla <priscilla.huang@efrei.net> | 2022-11-17 05:55:27 -0500 |
---|---|---|
committer | priscilla <priscilla.huang@efrei.net> | 2022-11-17 05:55:27 -0500 |
commit | 111b27321d504d83f523ecbe0880f69d96a6ea82 (patch) | |
tree | d15f86fbad24798a84d71b7b361f59a22e6a6e6f | |
parent | d75d8adffb207edb27434a4b42833b58253f724a (diff) | |
download | merchant-111b27321d504d83f523ecbe0880f69d96a6ea82.tar.gz merchant-111b27321d504d83f523ecbe0880f69d96a6ea82.tar.bz2 merchant-111b27321d504d83f523ecbe0880f69d96a6ea82.zip |
update
-rw-r--r-- | src/include/taler_merchantdb_plugin.h | 119 |
1 files changed, 118 insertions, 1 deletions
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 3a329096..fb0b9e53 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -216,7 +216,6 @@ typedef void unsigned int accounts_length, const struct TALER_MERCHANTDB_AccountDetails accounts[]); - /** * Typically called by `lookup_products`. * @@ -303,6 +302,40 @@ struct TALER_MERCHANTDB_ProductDetails /** + * Typically called by `lookup_templates`. + * + * @param cls a `json_t *` JSON array to build + * @param template_id ID of the template + */ +typedef void +(*TALER_MERCHANTDB_TemplatesCallback)(void *cls, + const char *template_id, + const char *template_description); + + +/** + * Details about a template. + */ +struct TALER_MERCHANTDB_TemplateDetails +{ + /** + * Description of the template. + */ + const char *template_description; + + /** + * Base64-encoded product image, or NULL. + */ + const char *image; + + /** + * In this template contract, we can have additional information. + */ + const json_t *template_contract; +}; + + +/** * Filter preferences. */ struct TALER_MERCHANTDB_OrderFilter @@ -2385,6 +2418,90 @@ struct TALER_MERCHANTDB_Plugin uint32_t offset, const struct TALER_BlindedDenominationSignature *blind_sig); + +/** + * Lookup all of the templates the given instance has configured. + * + * @param cls closure + * @param instance_id instance to lookup template for + * @param cb function to call on all template found + * @param cb_cls closure for @a cb + * @return database result code + */ +enum GNUNET_DB_QueryStatus +(*lookup_templates) (void *cls, + const char *instance_id, + TALER_MERCHANTDB_TemplatesCallback cb, + void *cb_cls); + + +/** + * Lookup details about a particular template. + * + * @param cls closure + * @param instance_id instance to lookup template for + * @param template_id template to lookup + * @param[out] pd set to the template details on success, can be NULL + * (in that case we only want to check if the template exists) + * @return database result code + */ +enum GNUNET_DB_QueryStatus +(*lookup_template) (void *cls, + const char *instance_id, + const char *template_id, + struct TALER_MERCHANTDB_TemplateDetails *pd); + +/** + * Delete information about a template. + * + * @param cls closure + * @param instance_id instance to delete product of + * @param template_id template to delete + * @return DB status code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS + * if template unknow. + */ +enum GNUNET_DB_QueryStatus +(*delete_template) (void *cls, + const char *instance_id, + const char *template_id); + + + +/** + * Insert details about a particular template. + * + * @param cls closure + * @param instance_id instance to insert template for + * @param template_id template identifier of template to insert + * @param pd the template details to insert + * @return database result code + */ +enum GNUNET_DB_QueryStatus +(*insert_template) (void *cls, + const char *instance_id, + const char *template_id, + const struct TALER_MERCHANTDB_TemplateDetails *pd); + + + +/** + * Update details about a particular template. + * + * @param cls closure + * @param instance_id instance to update template for + * @param template_id template to update + * @param pd update to the template details on success, can be NULL + * (in that case we only want to check if the template exists) + * @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the template + * does not yet exist. + */ + +enum GNUNET_DB_QueryStatus +(*update_template) (void *cls, + const char *instance_id, + const char *template_id, + const struct TALER_MERCHANTDB_TemplateDetails *pd); + }; #endif |