summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpriscilla <priscilla.huang@efrei.net>2022-12-02 10:47:39 -0500
committerpriscilla <priscilla.huang@efrei.net>2022-12-02 10:49:00 -0500
commit3be8637b90adac677a0be1eea3ccb2b5a151e9de (patch)
tree10269babce6f81132d249cfe6a647f95f6be21ab
parent361833d6160c6debd99a962d0bef95993b2f3e55 (diff)
downloadmerchant-3be8637b90adac677a0be1eea3ccb2b5a151e9de.tar.gz
merchant-3be8637b90adac677a0be1eea3ccb2b5a151e9de.tar.bz2
merchant-3be8637b90adac677a0be1eea3ccb2b5a151e9de.zip
update
-rw-r--r--src/include/taler_merchant_service.h295
1 files changed, 292 insertions, 3 deletions
diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h
index ea9c8464..f7e9ebd9 100644
--- a/src/include/taler_merchant_service.h
+++ b/src/include/taler_merchant_service.h
@@ -4310,7 +4310,7 @@ TALER_MERCHANT_template_patch (
const char *template_description,
const char *image,
const json_t *template_contract,
- TALER_MERCHANT_ProductPatchCallback cb,
+ TALER_MERCHANT_TemplatePatchCallback cb,
void *cb_cls);
@@ -4343,7 +4343,7 @@ typedef void
/**
- * Make a DELETE /template/$ID request to delete a product.
+ * Make a DELETE /template/$ID request to delete a template.
*
* @param ctx the context
* @param backend_url HTTP base URL for the backend
@@ -4364,11 +4364,300 @@ TALER_MERCHANT_template_delete (
/**
* Cancel DELETE /template/$ID operation.
*
- * @param pdh operation to cancel
+ * @param tdh operation to cancel
*/
void
TALER_MERCHANT_template_delete_cancel (
struct TALER_MERCHANT_TemplateDeleteHandle *tdh);
+/* ********************* /webhooks *********************** */
+
+
+/**
+ * Handle for a GET /webhooks operation.
+ */
+struct TALER_MERCHANT_WebhooksGetHandle;
+
+/**
+ * Individual webhook (minimal information
+ * returned via GET /webhooks).
+ */
+struct TALER_MERCHANT_WebhookEntry
+{
+ /**
+ * webhook identifier.
+ */
+ const char *webhook_id;
+
+};
+
+
+/**
+ * Function called with the result of the GET /webhooks operation.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ * @param webhooks_length length of the @a webhooks array
+ * @param webhooks array of webhooks the requested instance offers
+ */
+typedef void
+(*TALER_MERCHANT_WebhooksGetCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr,
+ unsigned int webhooks_length,
+ const struct TALER_MERCHANT_WebhookEntry webhooks[]);
+
+
+/**
+ * Make a GET /webhooks request.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param cb function to call with the backend information
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_WebhooksGetHandle *
+TALER_MERCHANT_webhooks_get (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ TALER_MERCHANT_WebhooksGetCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel GET /webhooks operation.
+ *
+ * @param tgh operation to cancel
+ */
+void
+TALER_MERCHANT_webhooks_get_cancel (
+ struct TALER_MERCHANT_WebhooksGetHandle *tgh);
+
+
+/**
+ * Handle for a GET /webhook/$ID operation. Gets details
+ * about a single webhook. Do not confused with a
+ * `struct TALER_MERCHANT_WebhooksGetHandle`, which
+ * obtains a list of all webhooks.
+ */
+struct TALER_MERCHANT_WebhookGetHandle;
+
+
+/**
+ * Function called with the result of the GET /webhooks operation.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ * @param event_type event of the webhook
+ * @param url url use by ther customer
+ * @param http_method use by the merchant
+ * @param header_template header of the webhook
+ * @param body_template body of the webhook
+ */
+typedef void
+(*TALER_MERCHANT_WebhookGetCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr,
+ const char *event_type,
+ const char *url,
+ const char *http_method,
+ const char *header_template,
+ const char *body_template);
+
+
+/**
+ * Make a GET /webhook/$ID request to get details about an
+ * individual webhook.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param webhook_id identifier of the webhook to inquire about
+ * @param cb function to call with the backend's webhook information
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_WebhookGetHandle *
+TALER_MERCHANT_webhook_get (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *webhook_id,
+ TALER_MERCHANT_WebhookGetCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel GET /webhooks/$ID operation.
+ *
+ * @param tgh operation to cancel
+ */
+void
+TALER_MERCHANT_webhook_get_cancel (
+ struct TALER_MERCHANT_WebhookGetHandle *tgh);
+
+
+/**
+ * Handle for a POST /webhooks operation.
+ */
+struct TALER_MERCHANT_WebhooksPostHandle;
+
+
+/**
+ * Function called with the result of the POST /webhooks operation.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ */
+typedef void
+(*TALER_MERCHANT_WebhooksPostCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr);
+
+
+/**
+ * Make a POST /webhooks request to add a webhook
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param webhook_id identifier to use for the webhook
+ * @param event_type event of the webhook
+ * @param url url use by the customer
+ * @param http_method http method use by the merchant
+ * @param header_template header of the webhook
+ * @param body_template body of the webhook
+ * @param cb function to call with the backend's result
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_TemplatesPostHandle *
+TALER_MERCHANT_templates_post (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *webhook_id,
+ const char *event_type,
+ const char *url,
+ const char *http_method,
+ const char *header_template,
+ const char *body_template,
+ TALER_MERCHANT_WebhooksPostCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel POST /webhooks operation.
+ *
+ * @param wph operation to cancel
+ */
+void
+TALER_MERCHANT_webhooks_post_cancel (
+ struct TALER_MERCHANT_WebhooksPostHandle *wph);
+
+
+/**
+ * Handle for a PATCH /webhook operation.
+ */
+struct TALER_MERCHANT_WebhookPatchHandle;
+
+
+/**
+ * Function called with the result of the PATCH /webhook operation.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ */
+typedef void
+(*TALER_MERCHANT_webhookPatchCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr);
+
+
+/**
+ * Make a PATCH /webhook request to update webhook details
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param webhook_id identifier to use for the webhook; the webhook must exist,
+ * or the transaction will fail with a #MHD_HTTP_NOT_FOUND
+ * HTTP status code
+ * @param event_type event of the webhook
+ * @param url url use by the customer
+ * @param http_method http method use by the merchant
+ * @param header_template header of the webhook
+ * @param body_template body of the webhook
+ * @param cb function to call with the backend's result
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_WebhookPatchHandle *
+TALER_MERCHANT_webhook_patch (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *webhook_id,
+ const char *event_type,
+ const char *url,
+ const char *http_method,
+ const char *header_template,
+ const char *body_template,
+ TALER_MERCHANT_WebhookPatchCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel PATCH /webhook operation.
+ *
+ * @param wph operation to cancel
+ */
+void
+TALER_MERCHANT_webhook_patch_cancel (
+ struct TALER_MERCHANT_WebhookPatchHandle *wph);
+
+
+/**
+ * Handle for a DELETE /webhook$ID operation.
+ */
+struct TALER_MERCHANT_WebhookDeleteHandle;
+
+
+/**
+ * Function called with the result of the DELETE /webhook/$ID operation.
+ *
+ * @param cls closure
+ * @param hr HTTP response details
+ */
+typedef void
+(*TALER_MERCHANT_WebhookDeleteCallback)(
+ void *cls,
+ const struct TALER_MERCHANT_HttpResponse *hr);
+
+
+/**
+ * Make a DELETE /webhook/$ID request to delete a webhook.
+ *
+ * @param ctx the context
+ * @param backend_url HTTP base URL for the backend
+ * @param webhook_id identifier of the webhook
+ * @param cb function to call with the backend's deletion status
+ * @param cb_cls closure for @a cb
+ * @return the request handle; NULL upon error
+ */
+struct TALER_MERCHANT_WebhookDeleteHandle *
+TALER_MERCHANT_webhook_delete (
+ struct GNUNET_CURL_Context *ctx,
+ const char *backend_url,
+ const char *webhok_id,
+ TALER_MERCHANT_WebhookDeleteCallback cb,
+ void *cb_cls);
+
+
+/**
+ * Cancel DELETE /webhook/$ID operation.
+ *
+ * @param wdh operation to cancel
+ */
+void
+TALER_MERCHANT_template_webhook_cancel (
+ struct TALER_MERCHANT_WebhookDeleteHandle *wdh);
+
+
#endif /* _TALER_MERCHANT_SERVICE_H */