summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/taler-merchant-httpd.c27
-rw-r--r--src/backend/taler-merchant-httpd_private-delete-instances-ID.h2
-rw-r--r--src/backend/taler-merchant-httpd_private-get-instances-ID.h2
-rw-r--r--src/lib/merchant_api_delete_instance.c2
-rw-r--r--src/lib/merchant_api_get_instances.c2
-rw-r--r--src/lib/merchant_api_patch_instance.c2
-rw-r--r--src/lib/merchant_api_post_instance_auth.c2
-rw-r--r--src/lib/merchant_api_post_instances.c4
-rw-r--r--src/testing/Makefile.am1
-rwxr-xr-xsrc/testing/test_key_rotation.sh2
-rw-r--r--src/testing/test_merchant_api.c12
-rwxr-xr-xsrc/testing/test_merchant_instance_response.sh2
-rwxr-xr-xsrc/testing/test_merchant_order_creation.sh2
-rwxr-xr-xsrc/testing/test_merchant_product_creation.sh2
-rwxr-xr-xsrc/testing/test_merchant_reserve_creation.sh6
15 files changed, 41 insertions, 29 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index ed782f33..6d13b6db 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -1149,7 +1149,7 @@ url_handler (void *cls,
size_t *upload_data_size,
void **con_cls)
{
- static struct TMH_RequestHandler private_handlers[] = {
+ static struct TMH_RequestHandler management_handlers[] = {
/* GET /instances */
{
.url_prefix = "/instances",
@@ -1180,7 +1180,7 @@ url_handler (void *cls,
.have_id_segment = true,
.handler = &TMH_private_get_instances_default_ID
},
- /* DELETE /private/instances/$ID */
+ /* DELETE /instances/$ID */
{
.url_prefix = "/instances/",
.method = MHD_HTTP_METHOD_DELETE,
@@ -1213,9 +1213,14 @@ url_handler (void *cls,
.have_id_segment = true,
.handler = &TMH_private_post_instances_default_ID_auth,
/* Body should be pretty small. */
- .max_upload = 1024 * 1024,
+ .max_upload = 1024 * 1024
},
+ {
+ NULL
+ }
+ };
+ static struct TMH_RequestHandler private_handlers[] = {
/* GET /instances/$ID/: */
{
.url_prefix = "/",
@@ -1733,13 +1738,21 @@ url_handler (void *cls,
}
{
+ const char *management_prefix = "/management/";
const char *private_prefix = "/private/";
if ( (0 == strncmp (url,
- private_prefix,
- strlen (private_prefix))) ||
- (0 == strcmp (url,
- "/private")) )
+ management_prefix,
+ strlen (management_prefix))) )
+ {
+ handlers = management_handlers;
+ url += strlen (management_prefix) - 1;
+ }
+ else if ( (0 == strncmp (url,
+ private_prefix,
+ strlen (private_prefix))) ||
+ (0 == strcmp (url,
+ "/private")) )
{
handlers = private_handlers;
url += strlen (private_prefix) - 1;
diff --git a/src/backend/taler-merchant-httpd_private-delete-instances-ID.h b/src/backend/taler-merchant-httpd_private-delete-instances-ID.h
index 42add77c..59b645e4 100644
--- a/src/backend/taler-merchant-httpd_private-delete-instances-ID.h
+++ b/src/backend/taler-merchant-httpd_private-delete-instances-ID.h
@@ -39,7 +39,7 @@ TMH_private_delete_instances_ID (const struct TMH_RequestHandler *rh,
/**
- * Handle a DELETE "/private/instances/$ID" request.
+ * Handle a DELETE "/management/instances/$ID" request.
*
* @param rh context of the handler
* @param connection the MHD connection to handle
diff --git a/src/backend/taler-merchant-httpd_private-get-instances-ID.h b/src/backend/taler-merchant-httpd_private-get-instances-ID.h
index b2a0262a..42229a42 100644
--- a/src/backend/taler-merchant-httpd_private-get-instances-ID.h
+++ b/src/backend/taler-merchant-httpd_private-get-instances-ID.h
@@ -39,7 +39,7 @@ TMH_private_get_instances_ID (const struct TMH_RequestHandler *rh,
/**
- * Handle a GET "/private/instances/$ID" request.
+ * Handle a GET "/management/instances/$ID" request.
*
* @param rh context of the handler
* @param connection the MHD connection to handle
diff --git a/src/lib/merchant_api_delete_instance.c b/src/lib/merchant_api_delete_instance.c
index b0458a62..684f2c75 100644
--- a/src/lib/merchant_api_delete_instance.c
+++ b/src/lib/merchant_api_delete_instance.c
@@ -147,7 +147,7 @@ instance_delete (struct GNUNET_CURL_Context *ctx,
char *path;
GNUNET_asprintf (&path,
- "private/instances/%s",
+ "management/instances/%s",
instance_id);
idh->url = TALER_url_join (backend_url,
path,
diff --git a/src/lib/merchant_api_get_instances.c b/src/lib/merchant_api_get_instances.c
index a8eaa608..6869f89b 100644
--- a/src/lib/merchant_api_get_instances.c
+++ b/src/lib/merchant_api_get_instances.c
@@ -241,7 +241,7 @@ TALER_MERCHANT_instances_get (struct GNUNET_CURL_Context *ctx,
igh->cb = instances_cb;
igh->cb_cls = instances_cb_cls;
igh->url = TALER_url_join (backend_url,
- "private/instances",
+ "management/instances",
NULL);
if (NULL == igh->url)
{
diff --git a/src/lib/merchant_api_patch_instance.c b/src/lib/merchant_api_patch_instance.c
index 5515e5e1..810eff72 100644
--- a/src/lib/merchant_api_patch_instance.c
+++ b/src/lib/merchant_api_patch_instance.c
@@ -217,7 +217,7 @@ TALER_MERCHANT_instance_patch (
char *path;
GNUNET_asprintf (&path,
- "private/instances/%s",
+ "management/instances/%s",
instance_id);
iph->url = TALER_url_join (backend_url,
path,
diff --git a/src/lib/merchant_api_post_instance_auth.c b/src/lib/merchant_api_post_instance_auth.c
index bda209ee..870448b7 100644
--- a/src/lib/merchant_api_post_instance_auth.c
+++ b/src/lib/merchant_api_post_instance_auth.c
@@ -145,7 +145,7 @@ TALER_MERCHANT_instance_auth_post (
char *path;
GNUNET_asprintf (&path,
- "private/instances/%s/auth",
+ "management/instances/%s/auth",
instance_id);
iaph->url = TALER_url_join (backend_url,
path,
diff --git a/src/lib/merchant_api_post_instances.c b/src/lib/merchant_api_post_instances.c
index 6101e192..df8a97f5 100644
--- a/src/lib/merchant_api_post_instances.c
+++ b/src/lib/merchant_api_post_instances.c
@@ -93,7 +93,7 @@ handle_post_instances_finished (void *cls,
iph->job = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "POST /private/instances completed with response code %u\n",
+ "POST /management/instances completed with response code %u\n",
(unsigned int) response_code);
switch (response_code)
{
@@ -255,7 +255,7 @@ TALER_MERCHANT_instances_post (
iph->cb = cb;
iph->cb_cls = cb_cls;
iph->url = TALER_url_join (backend_url,
- "private/instances",
+ "management/instances",
NULL);
if (NULL == iph->url)
{
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index d4e41bd2..a5d1f24e 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -11,6 +11,7 @@ check_SCRIPTS = \
test-merchant-walletharness.sh \
test_merchant_instance_response.sh \
test_merchant_product_creation.sh \
+ test_merchant_reserve_creation.sh \
test_merchant_order_creation.sh
lib_LTLIBRARIES = \
diff --git a/src/testing/test_key_rotation.sh b/src/testing/test_key_rotation.sh
index 07251e5f..9e8e7eb0 100755
--- a/src/testing/test_key_rotation.sh
+++ b/src/testing/test_key_rotation.sh
@@ -172,7 +172,7 @@ echo "OK"
echo -n "Setting up merchant instance"
STATUS=$(curl -H "Content-Type: application/json" -X POST \
- http://localhost:9966/private/instances \
+ http://localhost:9966/management/instances \
-d '{"auth":{"method":"external"},"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms" : 3600000},"default_pay_delay":{"d_ms": 3600000}}' \
-w "%{http_code}" -s -o /dev/null)
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
index 86f665a4..c018817c 100644
--- a/src/testing/test_merchant_api.c
+++ b/src/testing/test_merchant_api.c
@@ -943,21 +943,21 @@ run (void *cls,
"Bearer " RFC_8959_PREFIX "my-other-secret"),
TALER_TESTING_cmd_merchant_post_instance_auth (
"instance-create-i1a-auth-ok-idempotent",
- merchant_url,
- "i1a",
+ merchant_url_i1a,
+ NULL,
RFC_8959_PREFIX "my-other-secret",
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_merchant_post_instance_auth (
"instance-create-i1a-clear-auth",
- merchant_url,
- "i1a",
+ merchant_url_i1a,
+ NULL,
NULL,
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_set_authorization ("set-auth-none",
NULL),
TALER_TESTING_cmd_merchant_purge_instance ("instance-delete-i1a",
- merchant_url,
- "i1a",
+ merchant_url_i1a,
+ NULL,
MHD_HTTP_NO_CONTENT),
TALER_TESTING_cmd_end ()
};
diff --git a/src/testing/test_merchant_instance_response.sh b/src/testing/test_merchant_instance_response.sh
index b89c7325..d3863642 100755
--- a/src/testing/test_merchant_instance_response.sh
+++ b/src/testing/test_merchant_instance_response.sh
@@ -28,7 +28,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/private/instances \
+ http://localhost:9966/management/instances \
-d '{"auth":{"method":"token","token":"secret-token:other_secret"},"payto_uris":["payto://x-taler-bank/localhost/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms" : 3600000},"default_pay_delay":{"d_ms": 3600000}}' \
-w "%{http_code}" -s -o /dev/null)
diff --git a/src/testing/test_merchant_order_creation.sh b/src/testing/test_merchant_order_creation.sh
index ec929c2e..0b629426 100755
--- a/src/testing/test_merchant_order_creation.sh
+++ b/src/testing/test_merchant_order_creation.sh
@@ -27,7 +27,7 @@ echo -n "Configuring merchant instance ..."
# create with 2 address
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/private/instances \
+ http://localhost:9966/management/instances \
-d '{"auth":{"method":"external"},"payto_uris":["payto://x-taler-bank/localhost:8082/43","payto://x-taler-bank/localhost:8082/44"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms" : 50000},"default_pay_delay":{"d_ms": 60000}}' \
-w "%{http_code}" -s -o /dev/null)
diff --git a/src/testing/test_merchant_product_creation.sh b/src/testing/test_merchant_product_creation.sh
index e089dcb8..b36d9fad 100755
--- a/src/testing/test_merchant_product_creation.sh
+++ b/src/testing/test_merchant_product_creation.sh
@@ -6,7 +6,7 @@
echo -n "Configuring merchant instance ..."
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/private/instances \
+ http://localhost:9966/management/instances \
-d '{"auth":{"method":"external"},"payto_uris":["payto://x-taler-bank/localhost:8082/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms" : 50000},"default_pay_delay":{"d_ms": 60000}}' \
-w "%{http_code}" -s -o /dev/null)
diff --git a/src/testing/test_merchant_reserve_creation.sh b/src/testing/test_merchant_reserve_creation.sh
index a575c236..96734478 100755
--- a/src/testing/test_merchant_reserve_creation.sh
+++ b/src/testing/test_merchant_reserve_creation.sh
@@ -8,7 +8,7 @@ echo -n "Configuring merchant instance ..."
# create instance
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/private/instances \
+ http://localhost:9966/management/instances \
-d '{"auth":{"method":"external"},"payto_uris":["payto://x-taler-bank/'$BANK_URL'/43"],"id":"default","name":"default","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_ms" : 50000},"default_pay_delay":{"d_ms": 60000}}' \
-w "%{http_code}" -s -o /dev/null)
@@ -89,7 +89,7 @@ STATUS=$(curl 'http://localhost:9966/instances/default/private/reserves/'$RESERV
if [ "$STATUS" != "200" ]
then
- echo 'should respond failed, we didn't funded yet. got:' $STATUS
+ echo 'should respond failed, we did not fund yet. got:' $STATUS
exit 1
fi
@@ -154,5 +154,3 @@ echo "FAILED (which is ok)"
exit 0
-
-