summaryrefslogtreecommitdiff
path: root/core/api-merchant.rst
diff options
context:
space:
mode:
authorpriscilla <priscilla.huang@efrei.net>2022-11-25 05:46:32 -0500
committerpriscilla <priscilla.huang@efrei.net>2022-11-25 05:47:06 -0500
commit2179ee1d9742011875c52ddf21d52334e895f2d3 (patch)
treec86cdf288d1a77f4fe9bfec41e1a923946a2c0f7 /core/api-merchant.rst
parentdeee208d97320fe27e17ab68c9a5a7a904ff1943 (diff)
downloaddocs-2179ee1d9742011875c52ddf21d52334e895f2d3.tar.gz
docs-2179ee1d9742011875c52ddf21d52334e895f2d3.tar.bz2
docs-2179ee1d9742011875c52ddf21d52334e895f2d3.zip
webhook
Diffstat (limited to 'core/api-merchant.rst')
-rw-r--r--core/api-merchant.rst199
1 files changed, 195 insertions, 4 deletions
diff --git a/core/api-merchant.rst b/core/api-merchant.rst
index 552ee77c..1469c815 100644
--- a/core/api-merchant.rst
+++ b/core/api-merchant.rst
@@ -2972,7 +2972,7 @@ Checking tip status
Template
--------
-The templates is a backend feature that is used to create an order. We use the template to have some static information that cannot be changed by the customer.
+The template is a backend feature that is used to create an order. We use the template to have some static information that cannot be changed by the customer.
The template is private and allows us to be flexible. The private template allows for greater security and allows us to have a minimum information we need for each store.
@@ -3054,9 +3054,9 @@ Editing templates
**Response:**
:http:statuscode:`204 No content`:
- The templates has successfully modified.
+ The template has successfully modified.
:http:statuscode:`404 Not found`:
- The templates(ID) is unknown to the backend.
+ The template(ID) is unknown to the backend.
:http:statuscode:`409 Conflict`:
The provided information is inconsistent with the current state of the template. Changes made is the same with
another store.
@@ -3214,10 +3214,201 @@ Using template
// After enter the request. The user will be pay with a taler URL.
taler_url: string;
-
}
+
+
+
+
+
+--------
+Webhooks
+--------
+
+The webhook is a backend feature that is used to send a sms to the merchant. This sms will confirm that the
+customer paid the merchant. It will show the date and the price the customer paid.
+
+
+
+Adding webhooks
+---------------
+
+.. http:post:: [/instances/$INSTANCES]/private/webhooks/$WEBHOOK_ID
+
+ This is used to create a webhook.
+
+ **Request:**
+
+ The request must be a `WebhookAddDetails`.
+
+ **Response:**
+
+ :http:statuscode:`204 No content`:
+ The creation of the webhook is successsful.
+
+ :http:statuscode:`404 Not found`:
+ The merchant instance is unknowm or it not in our data.
+
+ .. ts:def:: WebhookAddDetails
+
+ interface WebhookAddDetails {
+
+ // Webhook ID to use.
+ webhook_id: string;
+
+ // The event of the webhook: why the webhook is used.
+ event_type: string;
+
+ // URL of the webhook where the customer will be redirected.
+ url: string;
+
+ // Method used by the webhook
+ methods: string;
+
+ // Header template of the webhook
+ header_template?: string;
+
+ // Body template by the webhook
+ body_template?: string;
+
+ }
+
+
+Editing webhooks
+----------------
+
+.. http:patch:: [/instances/$INSTANCES]/private/webhooks/$WEBHOOK_ID
+
+ This is used to update a webhook.
+
+ **Request:**
+
+ The request must be a `WebhookPatchDetails`.
+
+ **Response:**
+
+ :http:statuscode:`204 No content`:
+ The webhook has successfully modified.
+ :http:statuscode:`404 Not found`:
+ The webhook(ID) is unknown to the backend.
+ :http:statuscode:`409 Conflict`:
+ The provided information is inconsistent with the current state of the template. Changes made is the same with another store.
+
+ .. ts:def:: WebhookPatchDetails
+
+ interface WebhookPatchDetails {
+
+ // The event of the webhook: why the webhook is used.
+ event_type: string;
+
+ // URL of the webhook where the customer will be redirected.
+ url: string;
+
+ // Method used by the webhook
+ methods: string;
+
+ // Header template of the webhook
+ header_template?: string;
+
+ // Body template by the webhook
+ body_template?: string;
+
+ }
+
+
+
+Inspecting webhook
+------------------
+
+.. http:get:: [/instances/$INSTANCES]/private/webhooks
+
+ This is used to return the list of all the webhooks.
+
+ **Response:**
+
+ :http:statuscode:`200 OK`:
+ The backend has successfully returned all the webhooks. Returns a `WebhookSummaryResponse`.
+
+ :http:statuscode:`404 Not found`:
+ The backend has does not know about the instance.
+
+ .. ts:def:: WebhookSummaryResponse
+
+ interface WebhookSummaryResponse {
+
+ // List of webhooks that are present in our backend.
+ webhooks_list: WebhookEntry[];
+
+ }
+
+ The WebhookEntry object describes a webhook. It has the following structure:
+
+ .. ts:def:: WebhookEntry
+
+ interface WebhookEntry {
+
+ // Webhook identifier, as found in the webhook.
+ webhook_id: string;
+
+ // The event of the webhook: why the webhook is used.
+ event_type: string;
+
+ }
+
+
+.. http:get:: [/instances/$INSTANCES]/private/webhooks/$WEBHOOK_ID
+
+ This is used to obtain detailed information about apecific template.
+
+ **Response:**
+
+ :http:statuscode:`200 OK`:
+ The backend has successfully returned the detailed information about a specific webhook. Returns a `Webhookdetails`.
+
+ :http:statuscode:`404 Not found`:
+ The webhook(ID) is unknown to the backend.
+
+
+ .. ts:def:: WebhookDetails
+
+ interface WebhookDetails {
+
+ // The event of the webhook: why the webhook is used.
+ event_type: string;
+
+ // URL of the webhook where the customer will be redirected.
+ url: string;
+
+ // Method used by the webhook
+ methods: string;
+
+ // Header template of the webhook
+ header_template?: string;
+
+ // Body template by the webhook
+ body_template?: string;
+
+ }
+
+
+Removing template
+-----------------
+
+.. http:delete:: [/instances/$INSTANCES]/private/webhooks/$WEBHOOK_ID
+
+ This is used to delete information about a webhook.
+
+ **Response:**
+
+ :http:statuscode:`204 No content`:
+ The backend has successfully deleted the template.
+
+ :http:statuscode:`404 Not found`:
+ The webhook(ID) or the instance is unknown to the backend.
+
+
+
------------------
The Contract Terms
------------------