diff options
Diffstat (limited to 'src/include/taler_merchantdb_plugin.h')
-rw-r--r-- | src/include/taler_merchantdb_plugin.h | 143 |
1 files changed, 136 insertions, 7 deletions
diff --git a/src/include/taler_merchantdb_plugin.h b/src/include/taler_merchantdb_plugin.h index 1fa58ecd..0e70ec02 100644 --- a/src/include/taler_merchantdb_plugin.h +++ b/src/include/taler_merchantdb_plugin.h @@ -337,6 +337,53 @@ struct TALER_MERCHANTDB_TemplateDetails /** + * Typically called by `lookup_webhooks`. + * + * @param cls a `json_t *` JSON array to build + * @param webhook_id ID of the webhook + */ +typedef void +(*TALER_MERCHANTDB_WebhooksCallback)(void *cls, + const char *webhook_id, + const char *event_type); + + +/** + * Details about a webhook. + */ +struct TALER_MERCHANTDB_WebhookDetails +{ + /** + * event of the webhook. + */ + char *event_type; + + /** + * URL of the webhook. The customer will be redirected on this url. + */ + char *url; + + /** + * Http method used by the webhook. + */ + char *http_method; + + + /** + * Header template of the webhook. + */ + char *header_template; + + + /** + * Body template of the webhook. + */ + char *body_template; + +}; + + +/** * Filter preferences. */ struct TALER_MERCHANTDB_OrderFilter @@ -2442,7 +2489,7 @@ struct TALER_MERCHANTDB_Plugin * @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 + * @param[out] td 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 */ @@ -2450,13 +2497,13 @@ struct TALER_MERCHANTDB_Plugin (*lookup_template)(void *cls, const char *instance_id, const char *template_id, - struct TALER_MERCHANTDB_TemplateDetails *pd); + struct TALER_MERCHANTDB_TemplateDetails *td); /** * Delete information about a template. * * @param cls closure - * @param instance_id instance to delete product of + * @param instance_id instance to delete template of * @param template_id template to delete * @return DB status code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS * if template unknown. @@ -2473,14 +2520,14 @@ struct TALER_MERCHANTDB_Plugin * @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 + * @param td 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); + const struct TALER_MERCHANTDB_TemplateDetails *td); /** @@ -2489,7 +2536,7 @@ struct TALER_MERCHANTDB_Plugin * @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 + * @param td 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. @@ -2499,7 +2546,89 @@ struct TALER_MERCHANTDB_Plugin (*update_template)(void *cls, const char *instance_id, const char *template_id, - const struct TALER_MERCHANTDB_TemplateDetails *pd); + const struct TALER_MERCHANTDB_TemplateDetails *td); + + +/** + * Lookup all of the webhooks the given instance has configured. + * + * @param cls closure + * @param instance_id instance to lookup webhook for + * @param cb function to call on all webhook found + * @param cb_cls closure for @a cb + * @return database result code + */ + enum GNUNET_DB_QueryStatus + (*lookup_webhooks)(void *cls, + const char *instance_id, + TALER_MERCHANTDB_WebhooksCallback cb, + void *cb_cls); + + +/** + * Lookup details about a particular webhook. + * + * @param cls closure + * @param instance_id instance to lookup webhook for + * @param webhook_id webhook to lookup + * @param[out] wb set to the webhook details on success, can be NULL + * (in that case we only want to check if the webhook exists) + * @return database result code + */ + enum GNUNET_DB_QueryStatus + (*lookup_webhook)(void *cls, + const char *instance_id, + const char *webhook_id, + struct TALER_MERCHANTDB_WebhookDetails *wb); + +/** + * Delete information about a webhook. + * + * @param cls closure + * @param instance_id instance to delete webhook of + * @param webhook_id webhook to delete + * @return DB status code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS + * if webhook unknown. + */ + enum GNUNET_DB_QueryStatus + (*delete_webhook)(void *cls, + const char *instance_id, + const char *webhook_id); + + +/** + * Insert details about a particular webhook. + * + * @param cls closure + * @param instance_id instance to insert template for + * @param webhook_id webhook identifier of webhook to insert + * @param wb the webhook details to insert + * @return database result code + */ + enum GNUNET_DB_QueryStatus + (*insert_webhook)(void *cls, + const char *instance_id, + const char *webhook_id, + const struct TALER_MERCHANTDB_WebhookDetails *wb); + + +/** + * Update details about a particular webhook. + * + * @param cls closure + * @param instance_id instance to update webhook for + * @param webhook_id webhook to update + * @param wb update to the webhook details on success, can be NULL + * (in that case we only want to check if the webhook exists) + * @return database result code, #GNUNET_DB_STATUS_SUCCESS_NO_RESULTS if the webhook + * does not yet exist. + */ + + enum GNUNET_DB_QueryStatus + (*update_webhook)(void *cls, + const char *instance_id, + const char *webhook_id, + const struct TALER_MERCHANTDB_WebhookDetails *wb); }; |