diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2023-09-01 14:27:48 +0200 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2023-09-01 14:27:48 +0200 |
commit | 35dcd4514a93ba0f5353ecd1194fc9b515f2aad4 (patch) | |
tree | 399d8f8fbebf5e8ac383fc318b7be08901279a31 /src/testing/test_merchant_order_creation.sh | |
parent | 858e3047b8b595ab693e16ce0bbe0b8983b072ed (diff) | |
download | merchant-35dcd4514a93ba0f5353ecd1194fc9b515f2aad4.tar.gz merchant-35dcd4514a93ba0f5353ecd1194fc9b515f2aad4.tar.bz2 merchant-35dcd4514a93ba0f5353ecd1194fc9b515f2aad4.zip |
new CRUD APIs for OTP devices and merchant accounts (fixes #7929, #7824), one minor test is still failing...
Diffstat (limited to 'src/testing/test_merchant_order_creation.sh')
-rwxr-xr-x | src/testing/test_merchant_order_creation.sh | 57 |
1 files changed, 48 insertions, 9 deletions
diff --git a/src/testing/test_merchant_order_creation.sh b/src/testing/test_merchant_order_creation.sh index 1461c005..f0355565 100755 --- a/src/testing/test_merchant_order_creation.sh +++ b/src/testing/test_merchant_order_creation.sh @@ -83,6 +83,20 @@ fi echo -n "Configuring merchant instance ..." +STATUS=$(curl -H "Content-Type: application/json" -X POST \ + -H 'Authorization: Bearer secret-token:super_secret' \ + http://localhost:9966/management/instances \ + -d '{"auth":{"method":"external"},"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000000},"default_pay_delay":{"d_us": 60000000000}}' \ + -w "%{http_code}" -s -o /dev/null) + +if [ "$STATUS" != "204" ] +then + exit_fail "Expected '204 No content' response. Got instead $STATUS" +fi +echo "Ok" + +echo -n "Configuring merchant account ..." + if [ 1 = "$USE_FAKEBANK" ] then FORTYTHREE="payto://x-taler-bank/localhost/fortythree?receiver-name=fortythree" @@ -92,26 +106,51 @@ 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/management/instances \ - -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$FORTYTHREE"'"},{"payto_uri":"payto://iban/SANDBOXX/DE270744?receiver-name=Forty+Four"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000000},"default_pay_delay":{"d_us": 60000000000}}' \ + http://localhost:9966/instances/default/private/accounts \ + -d '{"payto_uri":"'"$FORTYTHREE"'"}' \ -w "%{http_code}" -s -o /dev/null) -if [ "$STATUS" != "204" ] +if [ "$STATUS" != "200" ] then - exit_fail "Expected '204 No content' response. Got instead $STATUS" + exit_fail "Expected '200 OK' response. Got instead $STATUS" fi -echo -n "." -# remove one account address +STATUS=$(curl -H "Content-Type: application/json" -X POST \ + -H 'Authorization: Bearer secret-token:super_secret' \ + http://localhost:9966/instances/default/private/accounts \ + -d '{"payto_uri":"payto://iban/SANDBOXX/DE270744?receiver-name=Forty+Four"}' \ + -w "%{http_code}" -s -o /dev/null) + +if [ "$STATUS" != "200" ] +then + exit_fail "Expected '200 OK' response. Got instead $STATUS" +fi + +echo "Ok" + +echo -n "Get accounts..." +STATUS=$(curl http://localhost:9966/instances/default/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") +if [ "$PAY_URI" != "payto://iban/SANDBOXX/DE270744?receiver-name=Forty+Four" ] +then + cat "$LAST_RESPONSE" >&2 + exit_fail "Expected second payto URI. Got $PAY_URI" +fi +echo "OK" + +# remove one account address +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/ \ - -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$FORTYTHREE"'"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"use_stefan":true,"default_wire_transfer_delay":{"d_us" : 50000000000},"default_pay_delay":{"d_us": 60000000000}}' \ + "http://localhost:9966/instances/default/private/accounts/${H_WIRE}" \ + -X DELETE \ -w "%{http_code}" -s -o /dev/null) if [ "$STATUS" != "204" ] then - exit_fail "Expected '204 No content' response. Got instead: $STATUS" + exit_fail "Expected '204 No content' for deletion of ${H_WIRE}. Got instead: $STATUS" fi echo "OK" |