diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-05-28 00:06:08 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-05-28 00:06:08 +0200 |
commit | 62220c02979c1a7e81d8ac261d2f624680bdedc1 (patch) | |
tree | 0f5308a8ff1a3d4fbd5e6c916b112b2ee7cea0d9 /src/backend/taler-merchant-httpd.c | |
parent | 16a14fc2b1885129144c003c163551e0dbd7d43d (diff) |
towards a CRUD API for merchant instance account editing
Diffstat (limited to 'src/backend/taler-merchant-httpd.c')
-rw-r--r-- | src/backend/taler-merchant-httpd.c | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c index d7ac2b74..00e4689c 100644 --- a/src/backend/taler-merchant-httpd.c +++ b/src/backend/taler-merchant-httpd.c @@ -33,13 +33,14 @@ #include "taler-merchant-httpd_get-orders-ID.h" #include "taler-merchant-httpd_get-tips-ID.h" #include "taler-merchant-httpd_mhd.h" -#include "taler-merchant-httpd_private-delete-webhooks-ID.h" -#include "taler-merchant-httpd_private-delete-templates-ID.h" +#include "taler-merchant-httpd_private-delete-account-ID.h" #include "taler-merchant-httpd_private-delete-instances-ID.h" #include "taler-merchant-httpd_private-delete-products-ID.h" #include "taler-merchant-httpd_private-delete-orders-ID.h" #include "taler-merchant-httpd_private-delete-reserves-ID.h" +#include "taler-merchant-httpd_private-delete-templates-ID.h" #include "taler-merchant-httpd_private-delete-transfers-ID.h" +#include "taler-merchant-httpd_private-delete-webhooks-ID.h" #include "taler-merchant-httpd_private-get-webhooks.h" #include "taler-merchant-httpd_private-get-webhooks-ID.h" #include "taler-merchant-httpd_private-get-templates.h" @@ -61,8 +62,7 @@ #include "taler-merchant-httpd_private-patch-instances-ID.h" #include "taler-merchant-httpd_private-patch-orders-ID-forget.h" #include "taler-merchant-httpd_private-patch-products-ID.h" -#include "taler-merchant-httpd_private-post-webhooks.h" -#include "taler-merchant-httpd_private-post-templates.h" +#include "taler-merchant-httpd_private-post-account.h" #include "taler-merchant-httpd_private-post-instances.h" #include "taler-merchant-httpd_private-post-instances-ID-auth.h" #include "taler-merchant-httpd_private-post-orders.h" @@ -71,7 +71,9 @@ #include "taler-merchant-httpd_private-post-products-ID-lock.h" #include "taler-merchant-httpd_private-post-reserves.h" #include "taler-merchant-httpd_private-post-reserves-ID-authorize-tip.h" +#include "taler-merchant-httpd_private-post-templates.h" #include "taler-merchant-httpd_private-post-transfers.h" +#include "taler-merchant-httpd_private-post-webhooks.h" #include "taler-merchant-httpd_post-orders-ID-abort.h" #include "taler-merchant-httpd_post-orders-ID-claim.h" #include "taler-merchant-httpd_post-orders-ID-paid.h" @@ -224,6 +226,17 @@ TMH_compute_auth (const char *token, void +TMH_wire_method_free (struct TMH_WireMethod *wm) +{ + GNUNET_free (wm->payto_uri); + GNUNET_free (wm->wire_method); + GNUNET_free (wm->credit_facade_url); + json_decref (wm->credit_facade_credentials); + GNUNET_free (wm); +} + + +void TMH_instance_decref (struct TMH_MerchantInstance *mi) { struct TMH_WireMethod *wm; @@ -237,11 +250,7 @@ TMH_instance_decref (struct TMH_MerchantInstance *mi) GNUNET_CONTAINER_DLL_remove (mi->wm_head, mi->wm_tail, wm); - GNUNET_free (wm->payto_uri); - GNUNET_free (wm->wire_method); - GNUNET_free (wm->credit_facade_url); - json_decref (wm->credit_facade_credentials); - GNUNET_free (wm); + TMH_wire_method_free (wm); } GNUNET_free (mi->settings.id); @@ -1067,6 +1076,21 @@ url_handler (void *cls, in the code... */ .max_upload = 1024 * 1024 * 8 }, + /* POST /account: */ + { + .url_prefix = "/account", + .method = MHD_HTTP_METHOD_POST, + .handler = &TMH_private_post_account, + /* allow account details of up to 8 kb, that should be plenty */ + .max_upload = 1024 * 8 + }, + /* DELETE /account/$PAYTO: */ + { + .url_prefix = "/account", + .method = MHD_HTTP_METHOD_DELETE, + .handler = &TMH_private_delete_account_ID, + .have_id_segment = true + }, { .url_prefix = NULL } @@ -1816,9 +1840,8 @@ load_instances (void *cls, /** - * A transaction modified an instance setting - * (or created/deleted/purged one). Notify all - * backends about the change. + * A transaction modified an instance setting (or created/deleted/purged + * one). Notify all backends about the change. * * @param id ID of the instance that changed */ |