aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-02-06 00:12:10 +0100
committerChristian Grothoff <christian@grothoff.org>2024-02-06 00:12:10 +0100
commite51192f0e708670b19acfb3fc1c969f1702a334c (patch)
treeb8262bfcd609762d278bb412ce3050a89dbb78e6
parent4e0b8b34dd32e233b252a76798dca1f4823b7a4f (diff)
deprecate '/instances/default', for clients to just use the shorter '/' path for the default instance
-rw-r--r--src/backend/taler-merchant-httpd.c35
-rw-r--r--src/lib/merchant_api_get_kyc.c4
-rwxr-xr-xsrc/testing/test_merchant_instance_auth.sh6
-rwxr-xr-xsrc/testing/test_merchant_instance_response.sh18
-rwxr-xr-xsrc/testing/test_merchant_kyc.sh10
-rwxr-xr-xsrc/testing/test_merchant_order_autocleanup.sh28
-rwxr-xr-xsrc/testing/test_merchant_order_creation.sh46
-rwxr-xr-xsrc/testing/test_merchant_product_creation.sh26
-rwxr-xr-xsrc/testing/test_merchant_transfer_tracking.sh8
-rwxr-xr-xsrc/testing/test_merchant_wirewatch.sh12
10 files changed, 112 insertions, 81 deletions
diff --git a/src/backend/taler-merchant-httpd.c b/src/backend/taler-merchant-httpd.c
index 59f61899..f1668389 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -622,7 +622,9 @@ spa_redirect (const struct TMH_RequestHandler *rh,
MHD_add_response_header (response,
MHD_HTTP_HEADER_CONTENT_TYPE,
"text/plain"));
- if (NULL == hc->instance)
+ if ( (NULL == hc->instance) ||
+ (0 == strcmp ("default",
+ hc->instance->settings.id)) )
dst = GNUNET_strdup ("/webui/");
else
GNUNET_asprintf (&dst,
@@ -863,7 +865,7 @@ url_handler (void *cls,
/* Body should be pretty small. */
.max_upload = 1024 * 1024
},
- /* POST /kyc: */
+ /* GET /kyc: */
{
.url_prefix = "/instances/",
.url_suffix = "kyc",
@@ -1605,6 +1607,35 @@ url_handler (void *cls,
else
instance_id = GNUNET_strndup (istart,
slash - istart);
+ if (0 == strcmp (instance_id,
+ "default"))
+ {
+ MHD_RESULT ret;
+ struct MHD_Response *response;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Client used deprecated '/instances/default/' path. Redirecting to modern path\n");
+
+ response
+ = MHD_create_response_from_buffer (0,
+ NULL,
+ MHD_RESPMEM_PERSISTENT);
+ TALER_MHD_add_global_headers (response);
+ if (MHD_NO ==
+ MHD_add_response_header (response,
+ MHD_HTTP_HEADER_LOCATION,
+ slash))
+ {
+ GNUNET_break (0);
+ MHD_destroy_response (response);
+ return MHD_NO;
+ }
+ ret = MHD_queue_response (connection,
+ MHD_HTTP_PERMANENT_REDIRECT,
+ response);
+ MHD_destroy_response (response);
+ return ret;
+ }
hc->instance = TMH_lookup_instance (instance_id);
if ( (NULL == hc->instance) &&
(0 == strcmp ("default",
diff --git a/src/lib/merchant_api_get_kyc.c b/src/lib/merchant_api_get_kyc.c
index b3008ef6..2590745f 100644
--- a/src/lib/merchant_api_get_kyc.c
+++ b/src/lib/merchant_api_get_kyc.c
@@ -323,7 +323,7 @@ TALER_MERCHANT_kyc_get (struct GNUNET_CURL_Context *ctx,
"%sprivate/",
backend_url);
return kyc_get (ctx,
- url,
+ url, /* consumed! */
h_wire,
exchange_url,
timeout,
@@ -349,7 +349,7 @@ TALER_MERCHANT_management_kyc_get (struct GNUNET_CURL_Context *ctx,
backend_url,
instance_id);
return kyc_get (ctx,
- url,
+ url, /* consumed! */
h_wire,
exchange_url,
timeout,
diff --git a/src/testing/test_merchant_instance_auth.sh b/src/testing/test_merchant_instance_auth.sh
index ce6b1e07..1dea1368 100755
--- a/src/testing/test_merchant_instance_auth.sh
+++ b/src/testing/test_merchant_instance_auth.sh
@@ -51,7 +51,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:new_value' \
- http://localhost:9966/instances/default/private/accounts \
+ http://localhost:9966/private/accounts \
-d '{"payto_uri":"payto://x-taler-bank/localhost:8082/43"}' \
-w "%{http_code}" -s -o /dev/null)
@@ -96,7 +96,7 @@ fi
echo -n "Creating order to test auth is ok..." >&2
STATUS=$(curl -H "Content-Type: application/json" -X POST \
- 'http://localhost:9966/instances/default/private/orders' \
+ 'http://localhost:9966/private/orders' \
-H 'Authorization: Bearer '"$NEW_SECRET" \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"}}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -110,7 +110,7 @@ fi
ORDER_ID=$(jq -e -r .order_id < "$LAST_RESPONSE")
TOKEN=$(jq -e -r .token < "$LAST_RESPONSE")
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-H 'Authorization: Bearer '"$NEW_SECRET" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
diff --git a/src/testing/test_merchant_instance_response.sh b/src/testing/test_merchant_instance_response.sh
index 336c33cc..066efb67 100755
--- a/src/testing/test_merchant_instance_response.sh
+++ b/src/testing/test_merchant_instance_response.sh
@@ -24,7 +24,7 @@ setup -c test_template.conf -m
STATUS=$(curl -H "Content-Type: application/json" -X OPTIONS \
- http://localhost:9966/instances/default/private/products \
+ http://localhost:9966/private/products \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
@@ -34,7 +34,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X GET \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/instances/default/private/products \
+ http://localhost:9966/private/products \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "404" ]
@@ -54,7 +54,7 @@ then
fi
STATUS=$(curl -H "Content-Type: application/json" -X GET \
- http://localhost:9966/instances/default/private/products \
+ http://localhost:9966/private/products \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "401" ]
@@ -64,7 +64,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X GET \
-H 'Authorization: Bearer secret-token:other_secret' \
- http://localhost:9966/instances/default/private/products \
+ http://localhost:9966/private/products \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "200" ]
@@ -74,7 +74,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:other_secret' \
- http://localhost:9966/instances/default/private/auth \
+ http://localhost:9966/private/auth \
-d '{"method":"token","token":"secret-token:zxc"}' \
-w "%{http_code}" -s -o /dev/null)
@@ -85,7 +85,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X DELETE \
- "http://localhost:9966/instances/default/private" \
+ "http://localhost:9966/private" \
-w "%{http_code}" -s -o /dev/null)
@@ -96,7 +96,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X DELETE \
-H 'Authorization: Bearer secret-token:other_secret' \
- "http://localhost:9966/instances/default/private" \
+ "http://localhost:9966/private" \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "401" ]
@@ -106,7 +106,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X DELETE \
-H 'Authorization: Bearer secret-token:zxc' \
- "http://localhost:9966/instances/default/private" \
+ "http://localhost:9966/private" \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
@@ -116,7 +116,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X GET \
-H 'Authorization: Bearer secret-token:zxc' \
- http://localhost:9966/instances/default/private/products \
+ http://localhost:9966/private/products \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "404" ]
diff --git a/src/testing/test_merchant_kyc.sh b/src/testing/test_merchant_kyc.sh
index f2a74cd5..9eef6ca5 100755
--- a/src/testing/test_merchant_kyc.sh
+++ b/src/testing/test_merchant_kyc.sh
@@ -40,7 +40,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/instances/default/private/accounts \
+ http://localhost:9966/private/accounts \
-d '{"payto_uri":"payto://x-taler-bank/localhost:8082/43"}' \
-w "%{http_code}" -s -o /dev/null)
@@ -52,7 +52,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/instances/default/private/accounts \
+ http://localhost:9966/private/accounts \
-d '{"payto_uri":"payto://x-taler-bank/localhost:8082/44"}' \
-w "%{http_code}" -s -o /dev/null)
@@ -67,7 +67,7 @@ echo " OK"
echo -n "Check the instance exists ..."
STATUS=$(curl -H "Content-Type: application/json" -X GET \
- http://localhost:9966/instances/default/private/ \
+ http://localhost:9966/private/ \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "200" ]
@@ -84,7 +84,7 @@ RANDOM_IMG='data:image/png;base64,abcdefg'
#
echo -n "Creating order without TOKEN..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"create_token":false,"order":{"amount":"TESTKUDOS:7","summary":"3","products":[{"description":"desct","image":"'"$RANDOM_IMG"'","price":"TESTKUDOS:1","taxes":[],"unit":"u","quantity":1}]}}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -123,7 +123,7 @@ echo "OK"
echo -n "Getting information about KYC ..."
STATUS=$(curl -H "Content-Type: application/json" -X GET \
- http://localhost:9966/instances/default/private/kyc \
+ http://localhost:9966/private/kyc \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
diff --git a/src/testing/test_merchant_order_autocleanup.sh b/src/testing/test_merchant_order_autocleanup.sh
index 73dd4cad..3f792f12 100755
--- a/src/testing/test_merchant_order_autocleanup.sh
+++ b/src/testing/test_merchant_order_autocleanup.sh
@@ -106,7 +106,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/instances/default/private/accounts \
+ http://localhost:9966/private/accounts \
-d '{"payto_uri":"'"$FORTYTHREE"'"}' \
-w "%{http_code}" -s -o /dev/null)
@@ -119,7 +119,7 @@ NOW=$(date +%s)
IN_TEN_SECS=$(( NOW + 10 ))
echo -n "Creating order to be claimed..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme","pay_deadline": {"t_s":'"$IN_TEN_SECS"'}}}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -132,7 +132,7 @@ fi
ORDER_ID=$(jq -e -r .order_id < "$LAST_RESPONSE")
TOKEN=$(jq -e -r .token < "$LAST_RESPONSE")
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -155,7 +155,7 @@ taler-wallet-cli \
"${PAY_URL}" \
2> wallet-claim1.err > wallet-claim1.log
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -178,7 +178,7 @@ echo "Wait 8 secs ..."
sleep 8
echo -n "Trying to get the list of orders..."
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders" \
+STATUS=$(curl "http://localhost:9966/private/orders" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -189,7 +189,7 @@ fi
echo "ok"
echo -n "Creating a new order that will trigger the db cleanup..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"}}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -202,7 +202,7 @@ fi
ORDER_ID=$(jq -e -r .order_id < "$LAST_RESPONSE")
TOKEN=$(jq -e -r .token < "$LAST_RESPONSE")
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -216,7 +216,7 @@ PAY_URL=$(jq -e -r .taler_pay_uri < "$LAST_RESPONSE")
echo "Ok (order $ORDER_ID)"
echo -n "Trying to get the list of orders (issue #7025)..."
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders" \
+STATUS=$(curl "http://localhost:9966/private/orders" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -236,7 +236,7 @@ taler-wallet-cli \
-y \
2> wallet-pay1.err > wallet-pay1.log
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -257,7 +257,7 @@ echo " OK (took $(( NOW2 - NOW)) secs )"
echo -n "Trying to get the list of orders..."
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders" \
+STATUS=$(curl "http://localhost:9966/private/orders" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -269,7 +269,7 @@ echo ok
echo -n "Finally, create another order..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"}}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -282,7 +282,7 @@ fi
ORDER_ID=$(jq -e -r .order_id < "$LAST_RESPONSE")
TOKEN=$(jq -e -r .token < "$LAST_RESPONSE")
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -304,7 +304,7 @@ taler-wallet-cli \
-y \
2> wallet-pay1.err > wallet-pay1.log
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -324,7 +324,7 @@ NOW2=$(date +%s)
echo " OK (took $( echo -n $(($NOW2 - $NOW)) ) secs )"
echo -n "Trying to get the list of orders..."
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders" \
+STATUS=$(curl "http://localhost:9966/private/orders" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
diff --git a/src/testing/test_merchant_order_creation.sh b/src/testing/test_merchant_order_creation.sh
index 38508cfb..175667b9 100755
--- a/src/testing/test_merchant_order_creation.sh
+++ b/src/testing/test_merchant_order_creation.sh
@@ -115,7 +115,7 @@ fi
# create with 2 bank account addresses
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/instances/default/private/accounts \
+ http://localhost:9966/private/accounts \
-d '{"payto_uri":"'"$FORTYTHREE"'"}' \
-w "%{http_code}" -s -o /dev/null)
@@ -125,7 +125,7 @@ then
fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/instances/default/private/accounts \
+ http://localhost:9966/private/accounts \
-d '{"payto_uri":"payto://iban/SANDBOXX/DE270744?receiver-name=Forty+Four"}' \
-w "%{http_code}" -s -o /dev/null)
@@ -138,7 +138,7 @@ fi
echo "Ok"
echo -n "Get accounts..."
-STATUS=$(curl http://localhost:9966/instances/default/private/accounts \
+STATUS=$(curl http://localhost:9966/private/accounts \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
PAY_URI=$(jq -r .accounts[1].payto_uri < "$LAST_RESPONSE")
H_WIRE=$(jq -r .accounts[1].h_wire < "$LAST_RESPONSE")
@@ -153,7 +153,7 @@ echo "OK"
echo -n "Deleting one account ..."
STATUS=$(curl -H "Content-Type: application/json" -X PATCH \
-H 'Authorization: Bearer secret-token:super_secret' \
- "http://localhost:9966/instances/default/private/accounts/${H_WIRE}" \
+ "http://localhost:9966/private/accounts/${H_WIRE}" \
-X DELETE \
-w "%{http_code}" -s -o /dev/null)
@@ -170,7 +170,7 @@ RANDOM_IMG='data:image/png;base64,abcdefg'
#
echo -n "Creating order without TOKEN..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"create_token":false,"order":{"amount":"TESTKUDOS:7","summary":"3","products":[{"description":"desct","image":"'"$RANDOM_IMG"'","price":"TESTKUDOS:1","taxes":[],"unit":"u","quantity":1}]}}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -206,7 +206,7 @@ echo "OK"
#
echo -n "Creating order without TOKEN and fullfilment URL..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"create_token":false,"order":{"fulfillment_url":"go_here_please", "amount":"TESTKUDOS:7","summary":"3","products":[{"description":"desct","image":"'"$RANDOM_IMG"'","price":"TESTKUDOS:1","taxes":[],"unit":"u","quantity":1}]}}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -248,7 +248,7 @@ echo "OK"
#
echo -n "Creating order with non-inventory products..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:7","summary":"3","products":[{"description":"desct","image":"'"$RANDOM_IMG"'","price":"TESTKUDOS:1","taxes":[],"unit":"u","quantity":1}]}}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -290,7 +290,7 @@ echo "OK"
#
echo -n "Creating product..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/products' \
+STATUS=$(curl 'http://localhost:9966/private/products' \
-d '{"product_id":"2","description":"product with id 2 and price :15","price":"TESTKUDOS:15","total_stock":2,"description_i18n":{},"unit":"","image":"'$RANDOM_IMG'","taxes":[],"address":{},"next_restock":{"t_s":"never"}}' \
-w "%{http_code}" -s -o /dev/null)
@@ -301,7 +301,7 @@ fi
echo "OK"
echo -n "Creating order with inventory products..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:7","summary":"3"},"inventory_products":[{"product_id":"2","quantity":1}]}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -339,7 +339,7 @@ echo "OK"
#
-STATUS=$(curl 'http://localhost:9966/instances/default/private/products' \
+STATUS=$(curl 'http://localhost:9966/private/products' \
-d '{"product_id":"1","description":"product with id 1 and price :15","price":"USD:15","total_stock":1,"description_i18n":{},"unit":"","image":"","taxes":[],"address":{},"next_restock":{"t_s":"never"}}' \
-w "%{http_code}" -s -o /dev/null)
@@ -353,7 +353,7 @@ fi
#
echo -n "Creating order to be paid..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"},"inventory_products":[{"product_id":"2","quantity":1}]}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -366,7 +366,7 @@ fi
ORDER_ID=$(jq -e -r .order_id < "$LAST_RESPONSE")
TOKEN=$(jq -e -r .token < "$LAST_RESPONSE")
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -387,7 +387,7 @@ taler-wallet-cli --no-throttle --wallet-db="$WALLET_DB" run-until-done 2> wallet
NOW2=$(date +%s)
echo " OK (took $(( NOW2 - NOW )) secs )"
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -447,7 +447,7 @@ set +e
echo -n "Notifying merchant of bogus wire transfer ..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
+STATUS=$(curl 'http://localhost:9966/private/transfers' \
-d '{"credit_amount":"'"$CREDIT_AMOUNT"'1","wtid":"'"$WTID"'","payto_uri":"'"$TARGET_PAYTO"'","exchange_url":"'"$WURL"'"}' \
-m 3 \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -462,7 +462,7 @@ echo "OK"
echo -n "Notifying merchant of correct wire transfer (conflicting with old data)..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
+STATUS=$(curl 'http://localhost:9966/private/transfers' \
-d '{"credit_amount":"'"$CREDIT_AMOUNT"'","wtid":"'"$WTID"'","payto_uri":"'"$TARGET_PAYTO"'","exchange_url":"'"$WURL"'"}' \
-m 3 \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -477,9 +477,9 @@ echo " OK"
echo -n "Deleting bogus wire transfer ..."
-TID=$(curl -s http://localhost:9966/instances/default/private/transfers | jq -r .transfers[0].transfer_serial_id)
+TID=$(curl -s http://localhost:9966/private/transfers | jq -r .transfers[0].transfer_serial_id)
STATUS=$(curl -H "Content-Type: application/json" -X DELETE \
- "http://localhost:9966/instances/default/private/transfers/$TID" \
+ "http://localhost:9966/private/transfers/$TID" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "204" ]
@@ -489,7 +489,7 @@ then
fi
STATUS=$(curl -H "Content-Type: application/json" -X DELETE \
- "http://localhost:9966/instances/default/private/transfers/$TID" \
+ "http://localhost:9966/private/transfers/$TID" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "404" ]
then
@@ -501,7 +501,7 @@ echo " OK"
echo -n "Notifying merchant of correct wire transfer (now working)..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
+STATUS=$(curl 'http://localhost:9966/private/transfers' \
-d '{"credit_amount":"'"$CREDIT_AMOUNT"'","wtid":"'"$WTID"'","payto_uri":"'"$TARGET_PAYTO"'","exchange_url":"'"$WURL"'"}' \
-m 3 \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -520,7 +520,7 @@ set -e
# Test idempotence: do it again!
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
+STATUS=$(curl 'http://localhost:9966/private/transfers' \
-d '{"credit_amount":"'"$CREDIT_AMOUNT"'","wtid":"'"$WTID"'","payto_uri":"'"$TARGET_PAYTO"'","exchange_url":"'"$WURL"'"}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -539,7 +539,7 @@ echo " OK"
echo -n "Fetching wire transfers ..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
+STATUS=$(curl 'http://localhost:9966/private/transfers' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -559,7 +559,7 @@ fi
echo "OK"
echo -n "Checking order status ..."
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}?transfer=YES" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}?transfer=YES" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
then
@@ -613,7 +613,7 @@ echo " OK"
echo -n "Getting information about kyc ..."
STATUS=$(curl -H "Content-Type: application/json" -X GET \
- http://localhost:9966/instances/default/private/kyc \
+ http://localhost:9966/private/kyc \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
then
diff --git a/src/testing/test_merchant_product_creation.sh b/src/testing/test_merchant_product_creation.sh
index 10ae765c..e745774c 100755
--- a/src/testing/test_merchant_product_creation.sh
+++ b/src/testing/test_merchant_product_creation.sh
@@ -75,7 +75,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/instances/default/private/accounts \
+ http://localhost:9966/private/accounts \
-d '{"payto_uri":"'"$FORTYTHREE"'"}' \
-w "%{http_code}" -s -o /dev/null)
@@ -91,7 +91,7 @@ INFINITE_PRODUCT_TEMPLATE='{"product_id":"2","description":"product with id 2 an
MANAGED_PRODUCT_TEMPLATE='{"product_id":"3","description":"product with id 3 and price :10","price":"TESTKUDOS:150","total_stock":2,"unit":"","image":"'"$RANDOM_IMG"'","taxes":[]}'
echo -n "Creating products..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/products' \
+STATUS=$(curl 'http://localhost:9966/private/products' \
-d "$INFINITE_PRODUCT_TEMPLATE" \
-w "%{http_code}" -s -o /dev/null)
@@ -100,7 +100,7 @@ then
exit_fail "Expected 204, product created. got: $STATUS"
fi
-STATUS=$(curl 'http://localhost:9966/instances/default/private/products' \
+STATUS=$(curl 'http://localhost:9966/private/products' \
-d "$MANAGED_PRODUCT_TEMPLATE" \
-w "%{http_code}" -s -o /dev/null)
@@ -114,7 +114,7 @@ echo "OK"
PRODUCT_DATA=$(echo "$INFINITE_PRODUCT_TEMPLATE" | jq 'del(.product_id) | . + {description: "other description"}')
echo -n "Updating infinite stock product..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/products/2' -X PATCH \
+STATUS=$(curl 'http://localhost:9966/private/products/2' -X PATCH \
-d "$PRODUCT_DATA" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -124,7 +124,7 @@ then
exit_fail "Expected 204, updating product. got: $STATUS"
fi
-STATUS=$(curl 'http://localhost:9966/instances/default/private/products/2' \
+STATUS=$(curl 'http://localhost:9966/private/products/2' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
DESCRIPTION=$(jq -r .description < "$LAST_RESPONSE")
@@ -140,7 +140,7 @@ MANAGED_PRODUCT_ID=$(echo "$MANAGED_PRODUCT_TEMPLATE" | jq -r '.product_id')
echo -n "Locking inventory ..."
-STATUS=$(curl "http://localhost:9966/instances/default/private/products/${MANAGED_PRODUCT_ID}/lock" \
+STATUS=$(curl "http://localhost:9966/private/products/${MANAGED_PRODUCT_ID}/lock" \
-d '{"lock_uuid":"luck","duration":{"d_us": 100000000},"quantity":10}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -152,7 +152,7 @@ fi
echo -n "."
-STATUS=$(curl "http://localhost:9966/instances/default/private/products/${MANAGED_PRODUCT_ID}/lock" \
+STATUS=$(curl "http://localhost:9966/private/products/${MANAGED_PRODUCT_ID}/lock" \
-d '{"lock_uuid":"luck","duration":{"d_us": 100000000},"quantity":1}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -164,7 +164,7 @@ fi
echo " OK"
echo -n "Creating order to be paid..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"},"inventory_products":[{"product_id":"'"${MANAGED_PRODUCT_ID}"'","quantity":1}]}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -177,7 +177,7 @@ fi
ORDER_ID=$(jq -e -r .order_id < "$LAST_RESPONSE")
#TOKEN=$(jq -e -r .token < "$LAST_RESPONSE")
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -189,7 +189,7 @@ PAY_URL=$(jq -e -r .taler_pay_uri < "$LAST_RESPONSE")
echo -n "."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"},"inventory_products":[{"product_id":"'"${MANAGED_PRODUCT_ID}"'","quantity":1}]}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -202,7 +202,7 @@ fi
echo -n "."
# Using the 'luck' inventory lock, order creation should work.
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"},"lock_uuids":["luck"],"inventory_products":[{"product_id":"'"$MANAGED_PRODUCT_ID"'","quantity":1}]}' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -262,7 +262,7 @@ NOW2=$(date +%s)
echo " OK (took $(( NOW2 - NOW)) secs )"
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
@@ -284,7 +284,7 @@ echo -n "Updating product..."
PRODUCT_DATA=$(echo "$MANAGED_PRODUCT_TEMPLATE" | jq 'del(.product_id) | . + {"total_stock": (.total_stock + 2) }')
-STATUS=$(curl 'http://localhost:9966/instances/default/private/products/3' -X PATCH \
+STATUS=$(curl 'http://localhost:9966/private/products/3' -X PATCH \
-d "$PRODUCT_DATA" \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
diff --git a/src/testing/test_merchant_transfer_tracking.sh b/src/testing/test_merchant_transfer_tracking.sh
index 7400ea27..41a20c11 100755
--- a/src/testing/test_merchant_transfer_tracking.sh
+++ b/src/testing/test_merchant_transfer_tracking.sh
@@ -126,7 +126,7 @@ fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/instances/default/private/accounts \
+ http://localhost:9966/private/accounts \
-d '{"payto_uri":"'"$TOR_PAYTO"'"}' \
-w "%{http_code}" -s -o /dev/null)
@@ -136,7 +136,7 @@ then
fi
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/instances/default/private/accounts \
+ http://localhost:9966/private/accounts \
-d '{"payto_uri":"'"$GNUNET_PAYTO"'"}' \
-w "%{http_code}" -s -o /dev/null)
@@ -273,7 +273,7 @@ echo -n "Notifying merchant of correct wire transfer, but on wrong instance..."
#issue 6912
#here we are notifying the transfer into a wrong instance (default) and the payto_uri of the default instance
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
+STATUS=$(curl 'http://localhost:9966/private/transfers' \
-d "{\"credit_amount\":\"$CREDIT_AMOUNT\",\"wtid\":\"$WTID\",\"payto_uri\":\"$TOR_PAYTO\",\"exchange_url\":\"$WURL\"}" \
-m 3 \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
@@ -288,7 +288,7 @@ echo " OK"
echo -n "Fetching wire transfers of DEFAULT instance ..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
+STATUS=$(curl 'http://localhost:9966/private/transfers' \
-w "%{http_code}" -s -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
diff --git a/src/testing/test_merchant_wirewatch.sh b/src/testing/test_merchant_wirewatch.sh
index df576cfd..61bd2049 100755
--- a/src/testing/test_merchant_wirewatch.sh
+++ b/src/testing/test_merchant_wirewatch.sh
@@ -227,7 +227,7 @@ echo "OK"
echo -n "Configuring bank account..."
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/instances/default/private/accounts \
+ http://localhost:9966/private/accounts \
-d '{"payto_uri":"'"$GNUNET_PAYTO"'","credit_facade_url":"'"${FACADE_URL}"'","credit_facade_credentials":{"type":"basic","username":"'"$FACADE_USERNAME"'","password":"'"$FACADE_PASSWORD"'"}}' \
-w "%{http_code}" -s -o /dev/null)
@@ -240,7 +240,7 @@ echo "OK"
# CREATE ORDER AND SELL IT
echo -n "Creating order to be paid..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+STATUS=$(curl 'http://localhost:9966/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"}}' \
-w "%{http_code}" \
-s \
@@ -252,7 +252,7 @@ then
fi
ORDER_ID=$(jq -e -r .order_id < "$LAST_RESPONSE")
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" \
-s \
-o "$LAST_RESPONSE")
@@ -274,7 +274,7 @@ taler-wallet-cli \
NOW2=$(date +%s)
echo "OK. Took $(( NOW2 - NOW))s."
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}" \
-w "%{http_code}" \
-s \
-o "$LAST_RESPONSE")
@@ -331,7 +331,7 @@ taler-merchant-wirewatch \
echo " OK"
echo -n "Fetching wire transfers of DEFAULT instance ..."
-STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
+STATUS=$(curl 'http://localhost:9966/private/transfers' \
-w "%{http_code}" \
-s \
-o "$LAST_RESPONSE")
@@ -354,7 +354,7 @@ taler-merchant-exchange \
echo " OK"
echo -n "Checking order status ..."
-STATUS=$(curl "http://localhost:9966/instances/default/private/orders/${ORDER_ID}?transfer=YES" \
+STATUS=$(curl "http://localhost:9966/private/orders/${ORDER_ID}?transfer=YES" \
-w "%{http_code}" \
-s \
-o "$LAST_RESPONSE")