diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-07-14 22:32:37 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-07-14 22:32:37 +0200 |
commit | b8649f414c160fc2882977b0fe11fc272feb879d (patch) | |
tree | 1bc4c87367d9c1db5a1bab385bd21087154352cd | |
parent | ccb863d9287fefc52fdd792b374214cc2bd00812 (diff) |
bugfixes for wirewatch
-rw-r--r-- | src/backend/taler-merchant-httpd_private-post-instances.c | 3 | ||||
-rw-r--r-- | src/backend/taler-merchant-wirewatch.c | 8 | ||||
-rw-r--r-- | src/backenddb/pg_select_wirewatch_accounts.c | 4 | ||||
-rw-r--r-- | src/include/taler_merchant_service.h | 3 | ||||
-rwxr-xr-x | src/testing/test_merchant_wirewatch.sh | 31 | ||||
-rw-r--r-- | src/testing/test_template.conf | 16 |
6 files changed, 33 insertions, 32 deletions
diff --git a/src/backend/taler-merchant-httpd_private-post-instances.c b/src/backend/taler-merchant-httpd_private-post-instances.c index 97b096d6..236741a1 100644 --- a/src/backend/taler-merchant-httpd_private-post-instances.c +++ b/src/backend/taler-merchant-httpd_private-post-instances.c @@ -187,10 +187,13 @@ TMH_private_post_instances (const struct TMH_RequestHandler *rh, /* check accounts for well-formedness */ if (! TMH_accounts_array_valid (accounts)) + { + GNUNET_break_op (0); return TALER_MHD_reply_with_error (connection, MHD_HTTP_BAD_REQUEST, TALER_EC_GENERIC_PAYTO_URI_MALFORMED, NULL); + } /* check 'id' well-formed */ { diff --git a/src/backend/taler-merchant-wirewatch.c b/src/backend/taler-merchant-wirewatch.c index 03e317b0..23e5b4de 100644 --- a/src/backend/taler-merchant-wirewatch.c +++ b/src/backend/taler-merchant-wirewatch.c @@ -558,6 +558,14 @@ run (void *cls, GNUNET_SCHEDULER_shutdown (); return; } + if ( (0 == qs) && + (GNUNET_YES == test_mode) ) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "No active wirewatch accounts in database and in test mode. Exiting.\n"); + GNUNET_SCHEDULER_shutdown (); + return; + } } } diff --git a/src/backenddb/pg_select_wirewatch_accounts.c b/src/backenddb/pg_select_wirewatch_accounts.c index 1046710c..050caefb 100644 --- a/src/backenddb/pg_select_wirewatch_accounts.c +++ b/src/backenddb/pg_select_wirewatch_accounts.c @@ -71,8 +71,8 @@ handle_results (void *cls, json_t *credential; uint64_t last_serial; struct GNUNET_PQ_ResultSpec rs[] = { - GNUNET_PQ_result_spec_auto_from_type ("merchant_id", - &instance), + GNUNET_PQ_result_spec_string ("merchant_id", + &instance), GNUNET_PQ_result_spec_string ("payto_uri", &payto_uri), GNUNET_PQ_result_spec_string ("credit_facade_url", diff --git a/src/include/taler_merchant_service.h b/src/include/taler_merchant_service.h index b1876a30..d427dc22 100644 --- a/src/include/taler_merchant_service.h +++ b/src/include/taler_merchant_service.h @@ -4659,7 +4659,8 @@ TALER_MERCHANT_reward_pickup ( * @param tph handle from the operation to cancel */ void -TALER_MERCHANT_reward_pickup_cancel (struct TALER_MERCHANT_RewardPickupHandle *tph); +TALER_MERCHANT_reward_pickup_cancel (struct + TALER_MERCHANT_RewardPickupHandle *tph); /** diff --git a/src/testing/test_merchant_wirewatch.sh b/src/testing/test_merchant_wirewatch.sh index cd3ff4e4..b1fba6b2 100755 --- a/src/testing/test_merchant_wirewatch.sh +++ b/src/testing/test_merchant_wirewatch.sh @@ -19,6 +19,10 @@ # Testcase for #6363 (WiP) set -eu +echo "Re-initializing database (needed for current libeufin)" # FIXME-MS: enable idempotency AND db-reset! +dropdb talercheck || true +createdb talercheck + . setup.sh # Launch exchange, merchant and bank. setup -c "test_template.conf" -enms -u "exchange-account-1" -d "iban" @@ -29,8 +33,7 @@ BANK_URL="http://localhost:18082/demobanks/default/" EXCHANGE_URL="http://localhost:8081/" - -export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:libeufin-sandbox.sqlite3" +export LIBEUFIN_SANDBOX_DB_CONNECTION='jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432' export LIBEUFIN_SANDBOX_ADMIN_PASSWORD="secret" export LIBEUFIN_SANDBOX_URL="http://localhost:18082/" @@ -49,17 +52,13 @@ export SANDBOX_ACCOUNT_NAME="gnunet" export LIBEUFIN_NEXUS_URL="http://localhost:8082" # These two are from taler-bank-manage-testing... -# Make credit user, will be Merchant client. -CREDIT_USERNAME=$(taler-config -c "$CONF" \ - -s "taler-merchant-wirewatch" \ - -o "USERNAME") -CREDIT_PASSWORD=$(taler-config -c "$CONF" \ - -s "taler-merchant-wirewatch" \ - -o "PASSWORD") +# Define credentials for wirewatch user, will be Merchant client. +CREDIT_USERNAME="merchant-wirewatch" +CREDIT_PASSWORD="merchant-wirewatch-password" echo -n "Create credit user (for gnunet-merchant) at Nexus ..." -export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:libeufin-nexus.sqlite3" +export LIBEUFIN_NEXUS_DB_CONNECTION='jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432' libeufin-nexus \ superuser "$CREDIT_USERNAME" \ --password="$CREDIT_PASSWORD" \ @@ -119,12 +118,10 @@ libeufin-cli \ FACADE_URL=$(libeufin-cli facades list | jq .facades[0].baseUrl | tr -d \") -echo -n "Setting FACADE URL in configuration..." -taler-config -c "$CONF" \ - -s "taler-merchant-wirewatch" \ - -o "WIRE_GATEWAY_URL" \ - -V "${FACADE_URL}" -echo " OK" +# FIXME: is this correct? Strange to use the super-user +# credentials here! +FACADE_USERNAME="${CREDIT_USERNAME}" +FACADE_PASSWORD="${CREDIT_PASSWORD}" echo -n "First prepare wallet with coins..." rm -f "${WALLET_DB}" @@ -168,7 +165,7 @@ GNUNET_PAYTO=$(get_payto_uri gnunet x) 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":"'"$GNUNET_PAYTO"'"}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \ + -d '{"auth":{"method":"external"},"accounts":[{"payto_uri":"'"$GNUNET_PAYTO"'","credit_facade_url":"'"${FACADE_URL}"'","credit_facade_credentials":{"type":"basic","username":"'"$FACADE_USERNAME"'","password":"'"$FACADE_PASSWORD"'"}}],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1", "default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us" : 50000000},"default_pay_delay":{"d_us": 60000000}}' \ -w "%{http_code}" -s -o /dev/null) if [ "$STATUS" != "204" ] diff --git a/src/testing/test_template.conf b/src/testing/test_template.conf index cbd794c6..a81fba1e 100644 --- a/src/testing/test_template.conf +++ b/src/testing/test_template.conf @@ -49,24 +49,16 @@ FORCE_AUDIT = YES [merchantdb-postgres] CONFIG = postgres:///talercheck -[taler-merchant-wirewatch] -INSTANCE = "default" -# This one will be set by test_merchant_wirewatch.sh -# WIRE_GATEWAY_URL = -WIRE_GATEWAY_AUTH_METHOD = BASIC -USERNAME = merchant-wirewatch -PASSWORD = merchant-wirewatch-password - [bank] HTTP_PORT = 8082 [libeufin-nexus] -#DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432" -DB_CONNECTION="jdbc:sqlite:libeufin-nexus.sqlite3" +DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432" +#DB_CONNECTION="jdbc:sqlite:libeufin-nexus.sqlite3" [libeufin-sandbox] -#DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432" -DB_CONNECTION="jdbc:sqlite:libeufin-sandbox.sqlite3" +DB_CONNECTION="jdbc:postgresql://localhost/talercheck?socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/var/run/postgresql/.s.PGSQL.5432" +#DB_CONNECTION="jdbc:sqlite:libeufin-sandbox.sqlite3" [auditor] |