aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/auditor/generate-auditor-basedb.sh190
-rwxr-xr-xsrc/auditor/generate-revoke-basedb.sh205
-rwxr-xr-xsrc/auditor/test-auditor.sh91
-rwxr-xr-xsrc/auditor/test-revocation.sh25
4 files changed, 424 insertions, 87 deletions
diff --git a/src/auditor/generate-auditor-basedb.sh b/src/auditor/generate-auditor-basedb.sh
index 469abbc3e..5eca38e4e 100755
--- a/src/auditor/generate-auditor-basedb.sh
+++ b/src/auditor/generate-auditor-basedb.sh
@@ -13,7 +13,7 @@
# user running this script must be Postgres superuser
# and be allowed to create/drop databases.
#
-set -eu
+set -eux
function get_iban() {
export LIBEUFIN_SANDBOX_USERNAME=$1
@@ -30,40 +30,40 @@ function get_payto_uri() {
}
# Cleanup to run whenever we exit
-function cleanup()
+function exit_cleanup()
{
- echo "Killing Libeufin..."
+ echo "Running generate-auditor-basedb exit cleanup logic..."
if test -f libeufin-sandbox.pid
then
- echo "Killing libeufin sandbox"
PID=`cat libeufin-sandbox.pid 2> /dev/null`
kill $PID 2> /dev/null || true
- wait $PID
rm libeufin-sandbox.pid
+ echo "Killed libeufin sandbox $PID"
+ wait $PID || true
fi
if test -f libeufin-nexus.pid
then
- echo "Killing libeufin nexus"
PID=`cat libeufin-nexus.pid 2> /dev/null`
kill $PID 2> /dev/null || true
- wait $PID
rm libeufin-nexus.pid
+ echo "Killed libeufin nexus $PID"
+ wait $PID || true
fi
echo "killing libeufin DONE"
for n in `jobs -p`
do
kill $n 2> /dev/null || true
done
- wait
+ wait || true
}
# Install cleanup handler (except for kill -9)
-trap cleanup EXIT
+trap exit_cleanup EXIT
# Exit, with status code "skip" (no 'real' failure)
function exit_skip() {
- echo $1
+ echo "SKIPPING: $1"
exit 77
}
# Where do we write the result?
@@ -150,7 +150,168 @@ taler-auditor-exchange -c $CONF -m $MASTER_PUB -u $EXCHANGE_URL || exit_skip "Fa
# Launch services
echo "Launching services (pre audit DB: $TARGET_DB)"
-taler-bank-manage-testing $BANK_PORT $TARGET_DB $EXCHANGE_URL $CONF
+
+rm -f ${TARGET_DB}-sandbox.sqlite3 ${TARGET_DB}-nexus.sqlite3 2> /dev/null # libeufin DB
+export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:${TARGET_DB}-sandbox.sqlite3"
+# Create the default demobank.
+libeufin-sandbox config --currency "TESTKUDOS" default
+export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=secret
+libeufin-sandbox serve --port "1${BANK_PORT}" \
+ > libeufin-sandbox-stdout.log \
+ 2> libeufin-sandbox-stderr.log &
+echo $! > libeufin-sandbox.pid
+export LIBEUFIN_SANDBOX_URL="http://localhost:1${BANK_PORT}/demobanks/default"
+set +e
+echo -n "Waiting for Sandbox..."
+OK=0
+for n in `seq 1 50`; do
+ echo -n "."
+ sleep 1
+ if wget --timeout=1 \
+ --tries=3 --waitretry=0 \
+ -o /dev/null -O /dev/null \
+ $LIBEUFIN_SANDBOX_URL;
+ then
+ OK=1
+ break
+ fi
+done
+if test $OK != 1
+then
+ exit_skip " Failed to launch sandbox"
+fi
+echo "OK"
+
+register_sandbox_account() {
+ export LIBEUFIN_SANDBOX_USERNAME=$1
+ export LIBEUFIN_SANDBOX_PASSWORD=$2
+ libeufin-cli sandbox \
+ demobank \
+ register --name "$3"
+ unset LIBEUFIN_SANDBOX_USERNAME
+ unset LIBEUFIN_SANDBOX_PASSWORD
+}
+set -e
+echo -n "Register the 'fortytwo' Sandbox user.."
+register_sandbox_account fortytwo x "Forty Two"
+echo OK
+echo -n "Register the 'fortythree' Sandbox user.."
+register_sandbox_account fortythree x "Forty Three"
+echo OK
+echo -n "Register 'exchange' Sandbox user.."
+register_sandbox_account exchange x "Exchange Company"
+echo OK
+echo -n "Specify exchange's PAYTO_URI in the config ..."
+export LIBEUFIN_SANDBOX_USERNAME=exchange
+export LIBEUFIN_SANDBOX_PASSWORD=x
+PAYTO=`libeufin-cli sandbox demobank info --bank-account exchange | jq --raw-output '.paytoUri'`
+taler-config -c $CONF -s exchange-account-1 -o PAYTO_URI -V $PAYTO
+echo " OK"
+echo -n "Setting this exchange as the bank's default ..."
+EXCHANGE_PAYTO=`libeufin-cli sandbox demobank info --bank-account exchange | jq --raw-output '.paytoUri'`
+libeufin-sandbox default-exchange "$EXCHANGE_URL" "$EXCHANGE_PAYTO"
+echo " OK"
+# Prepare EBICS: create Ebics host and Exchange subscriber.
+# Shortly becoming admin to setup Ebics.
+export LIBEUFIN_SANDBOX_USERNAME=admin
+export LIBEUFIN_SANDBOX_PASSWORD=secret
+echo -n "Create EBICS host at Sandbox.."
+libeufin-cli sandbox \
+ --sandbox-url "http://localhost:1${BANK_PORT}" \
+ ebicshost create --host-id "talerebics"
+echo "OK"
+echo -n "Create exchange EBICS subscriber at Sandbox.."
+libeufin-cli sandbox \
+ demobank new-ebicssubscriber --host-id talerebics \
+ --user-id exchangeebics --partner-id talerpartner \
+ --bank-account exchange # that's a username _and_ a bank account name
+echo "OK"
+unset LIBEUFIN_SANDBOX_USERNAME
+unset LIBEUFIN_SANDBOX_PASSWORD
+# Prepare Nexus, which is the side actually talking
+# to the exchange.
+export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:${TARGET_DB}-nexus.sqlite3"
+# For convenience, username and password are
+# identical to those used at the Sandbox.
+echo -n "Create exchange Nexus user..."
+libeufin-nexus superuser exchange --password x
+echo " OK"
+libeufin-nexus serve --port ${BANK_PORT} \
+ 2> libeufin-nexus-stderr.log \
+ > libeufin-nexus-stdout.log &
+echo $! > libeufin-nexus.pid
+export LIBEUFIN_NEXUS_URL="http://localhost:${BANK_PORT}"
+echo -n "Waiting for Nexus..."
+set +e
+OK=0
+for n in `seq 1 50`; do
+ echo -n "."
+ sleep 1
+ if wget --timeout=1 \
+ --tries=3 --waitretry=0 \
+ -o /dev/null -O /dev/null \
+ $LIBEUFIN_NEXUS_URL;
+ then
+ OK=1
+ break
+ fi
+done
+if test $OK != 1
+then
+ exit_skip " Failed to launch Nexus at $LIBEUFIN_NEXUS_URL"
+fi
+set -e
+echo "OK"
+export LIBEUFIN_NEXUS_USERNAME=exchange
+export LIBEUFIN_NEXUS_PASSWORD=x
+echo -n "Creating an EBICS connection at Nexus..."
+libeufin-cli connections new-ebics-connection \
+ --ebics-url "http://localhost:1${BANK_PORT}/ebicsweb" \
+ --host-id "talerebics" \
+ --partner-id "talerpartner" \
+ --ebics-user-id "exchangeebics" \
+ talerconn
+echo "OK"
+echo -n "Setup EBICS keying..."
+libeufin-cli connections connect "talerconn" > /dev/null
+echo "OK"
+echo -n "Download bank account name from Sandbox..."
+libeufin-cli connections download-bank-accounts "talerconn"
+echo "OK"
+echo -n "Importing bank account info into Nexus..."
+libeufin-cli connections import-bank-account \
+ --offered-account-id "exchange" \
+ --nexus-bank-account-id "exchange-nexus" \
+ "talerconn"
+echo "OK"
+echo -n "Setup payments submission task..."
+# Tries every second.
+libeufin-cli accounts task-schedule \
+ --task-type submit \
+ --task-name "exchange-payments" \
+ --task-cronspec "* * *" \
+ "exchange-nexus"
+echo "OK"
+# Tries every second. Ask C52
+echo -n "Setup history fetch task..."
+libeufin-cli accounts task-schedule \
+ --task-type fetch \
+ --task-name "exchange-history" \
+ --task-cronspec "* * *" \
+ --task-param-level report \
+ --task-param-range-type latest \
+ "exchange-nexus"
+echo "OK"
+# create Taler facade.
+echo -n "Create the Taler facade at Nexus..."
+libeufin-cli facades \
+ new-taler-wire-gateway-facade \
+ --currency "TESTKUDOS" --facade-name "test-facade" \
+ "talerconn" "exchange-nexus"
+echo "OK"
+# Facade schema: http://localhost:$BANK_PORT/facades/test-facade/taler-wire-gateway/
+
+
TFN=`which taler-exchange-httpd`
TBINPFX=`dirname $TFN`
TLIBEXEC=${TBINPFX}/../lib/taler/libexec/
@@ -258,19 +419,20 @@ taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api 'runIntegrationTest' \
)" &> taler-wallet-cli.log
echo "Shutting down services"
-cleanup
+exit_cleanup
# Dump database
echo "Dumping database ${BASEDB}(-libeufin).sql"
pg_dump -O $TARGET_DB | sed -e '/AS integer/d' > ${BASEDB}.sql
-sqlite3 $TARGET_DB ".dump" > ${BASEDB}-libeufin.sql
+sqlite3 ${TARGET_DB}-nexus.sqlite3 ".dump" > ${BASEDB}-libeufin-nexus.sql
+sqlite3 ${TARGET_DB}-sandbox.sqlite3 ".dump" > ${BASEDB}-libeufin-sandbox.sql
echo $MASTER_PUB > ${BASEDB}.mpub
# clean up
echo "Final clean up"
dropdb $TARGET_DB
-rm $TARGET_DB # libeufin DB
+rm ${TARGET_DB}-sandbox.sqlite3 ${TARGET_DB}-nexus.sqlite3 # libeufin DB
echo "====================================="
echo " Finished generation of $BASEDB"
diff --git a/src/auditor/generate-revoke-basedb.sh b/src/auditor/generate-revoke-basedb.sh
index 0d33d3a3b..5a1d5364c 100755
--- a/src/auditor/generate-revoke-basedb.sh
+++ b/src/auditor/generate-revoke-basedb.sh
@@ -5,27 +5,34 @@
# user running this script must be Postgres superuser and be allowed to
# create/drop databases.
#
-set -eu
+set -eux
# Cleanup to run whenever we exit
-function cleanup()
+function exit_cleanup()
{
- for n in `jobs -p`
- do
- kill $n 2> /dev/null || true
- done
- wait
+ echo "Running generate-revoke-basedb exit cleanup logic..."
if test -f libeufin-sandbox.pid
then
- echo "Killing libeufin sandbox"
- kill `cat libeufin-sandbox.pid 2> /dev/null` &> /dev/null || true
+ PID=`cat libeufin-sandbox.pid 2> /dev/null`
+ kill $PID 2> /dev/null || true
+ rm libeufin-sandbox.pid
+ echo "Killed libeufin sandbox $PID"
+ wait $PID || true
fi
if test -f libeufin-nexus.pid
then
- echo "Killing libeufin nexus"
- kill `cat libeufin-nexus.pid 2> /dev/null` &> /dev/null || true
+ PID=`cat libeufin-nexus.pid 2> /dev/null`
+ kill $PID 2> /dev/null || true
+ rm libeufin-nexus.pid
+ echo "Killed libeufin nexus $PID"
+ wait $PID || true
fi
- rm -f libeufin-sandbox.pid libeufin-nexus.pid
+ echo "killing libeufin DONE"
+ for n in `jobs -p`
+ do
+ kill $n 2> /dev/null || true
+ done
+ wait
}
function get_payto_uri() {
@@ -36,7 +43,7 @@ function get_payto_uri() {
}
# Install cleanup handler (except for kill -9)
-trap cleanup EXIT
+trap exit_cleanup EXIT
# Exit, with status code "skip" (no 'real' failure)
function exit_skip() {
@@ -130,7 +137,167 @@ taler-auditor-exchange -c $CONF -m $MASTER_PUB -u $EXCHANGE_URL
# Launch services
echo "Launching services"
-taler-bank-manage-testing $BANK_PORT $TARGET_DB $EXCHANGE_URL $CONF
+
+rm -f ${TARGET_DB}-sandbox.sqlite3 ${TARGET_DB}-nexus.sqlite3 2> /dev/null # libeufin DB
+export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:${TARGET_DB}-sandbox.sqlite3"
+# Create the default demobank.
+libeufin-sandbox config --currency "TESTKUDOS" default
+export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=secret
+libeufin-sandbox serve --port "1${BANK_PORT}" \
+ > libeufin-sandbox-stdout.log \
+ 2> libeufin-sandbox-stderr.log &
+echo $! > libeufin-sandbox.pid
+export LIBEUFIN_SANDBOX_URL="http://localhost:1${BANK_PORT}/demobanks/default"
+set +e
+echo -n "Waiting for Sandbox..."
+OK=0
+for n in `seq 1 50`; do
+ echo -n "."
+ sleep 1
+ if wget --timeout=1 \
+ --tries=3 --waitretry=0 \
+ -o /dev/null -O /dev/null \
+ $LIBEUFIN_SANDBOX_URL;
+ then
+ OK=1
+ break
+ fi
+done
+if test $OK != 1
+then
+ exit_skip " Failed to launch sandbox"
+fi
+echo "OK"
+
+register_sandbox_account() {
+ export LIBEUFIN_SANDBOX_USERNAME=$1
+ export LIBEUFIN_SANDBOX_PASSWORD=$2
+ libeufin-cli sandbox \
+ demobank \
+ register --name "$3"
+ unset LIBEUFIN_SANDBOX_USERNAME
+ unset LIBEUFIN_SANDBOX_PASSWORD
+}
+set -e
+echo -n "Register the 'fortytwo' Sandbox user.."
+register_sandbox_account fortytwo x "Forty Two"
+echo OK
+echo -n "Register the 'fortythree' Sandbox user.."
+register_sandbox_account fortythree x "Forty Three"
+echo OK
+echo -n "Register 'exchange' Sandbox user.."
+register_sandbox_account exchange x "Exchange Company"
+echo OK
+echo -n "Specify exchange's PAYTO_URI in the config ..."
+export LIBEUFIN_SANDBOX_USERNAME=exchange
+export LIBEUFIN_SANDBOX_PASSWORD=x
+PAYTO=`libeufin-cli sandbox demobank info --bank-account exchange | jq --raw-output '.paytoUri'`
+taler-config -c $CONF -s exchange-account-1 -o PAYTO_URI -V $PAYTO
+echo " OK"
+echo -n "Setting this exchange as the bank's default ..."
+EXCHANGE_PAYTO=`libeufin-cli sandbox demobank info --bank-account exchange | jq --raw-output '.paytoUri'`
+libeufin-sandbox default-exchange "$EXCHANGE_URL" "$EXCHANGE_PAYTO"
+echo " OK"
+# Prepare EBICS: create Ebics host and Exchange subscriber.
+# Shortly becoming admin to setup Ebics.
+export LIBEUFIN_SANDBOX_USERNAME=admin
+export LIBEUFIN_SANDBOX_PASSWORD=secret
+echo -n "Create EBICS host at Sandbox.."
+libeufin-cli sandbox \
+ --sandbox-url "http://localhost:1${BANK_PORT}" \
+ ebicshost create --host-id "talerebics"
+echo "OK"
+echo -n "Create exchange EBICS subscriber at Sandbox.."
+libeufin-cli sandbox \
+ demobank new-ebicssubscriber --host-id talerebics \
+ --user-id exchangeebics --partner-id talerpartner \
+ --bank-account exchange # that's a username _and_ a bank account name
+echo "OK"
+unset LIBEUFIN_SANDBOX_USERNAME
+unset LIBEUFIN_SANDBOX_PASSWORD
+# Prepare Nexus, which is the side actually talking
+# to the exchange.
+export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:${TARGET_DB}-nexus.sqlite3"
+# For convenience, username and password are
+# identical to those used at the Sandbox.
+echo -n "Create exchange Nexus user..."
+libeufin-nexus superuser exchange --password x
+echo " OK"
+libeufin-nexus serve --port ${BANK_PORT} \
+ 2> libeufin-nexus-stderr.log \
+ > libeufin-nexus-stdout.log &
+echo $! > libeufin-nexus.pid
+export LIBEUFIN_NEXUS_URL="http://localhost:${BANK_PORT}"
+echo -n "Waiting for Nexus..."
+set +e
+OK=0
+for n in `seq 1 50`; do
+ echo -n "."
+ sleep 1
+ if wget --timeout=1 \
+ --tries=3 --waitretry=0 \
+ -o /dev/null -O /dev/null \
+ $LIBEUFIN_NEXUS_URL;
+ then
+ OK=1
+ break
+ fi
+done
+if test $OK != 1
+then
+ exit_skip " Failed to launch Nexus at $LIBEUFIN_NEXUS_URL"
+fi
+set -e
+echo "OK"
+export LIBEUFIN_NEXUS_USERNAME=exchange
+export LIBEUFIN_NEXUS_PASSWORD=x
+echo -n "Creating an EBICS connection at Nexus..."
+libeufin-cli connections new-ebics-connection \
+ --ebics-url "http://localhost:1${BANK_PORT}/ebicsweb" \
+ --host-id "talerebics" \
+ --partner-id "talerpartner" \
+ --ebics-user-id "exchangeebics" \
+ talerconn
+echo "OK"
+echo -n "Setup EBICS keying..."
+libeufin-cli connections connect "talerconn" > /dev/null
+echo "OK"
+echo -n "Download bank account name from Sandbox..."
+libeufin-cli connections download-bank-accounts "talerconn"
+echo "OK"
+echo -n "Importing bank account info into Nexus..."
+libeufin-cli connections import-bank-account \
+ --offered-account-id "exchange" \
+ --nexus-bank-account-id "exchange-nexus" \
+ "talerconn"
+echo "OK"
+echo -n "Setup payments submission task..."
+# Tries every second.
+libeufin-cli accounts task-schedule \
+ --task-type submit \
+ --task-name "exchange-payments" \
+ --task-cronspec "* * *" \
+ "exchange-nexus"
+echo "OK"
+# Tries every second. Ask C52
+echo -n "Setup history fetch task..."
+libeufin-cli accounts task-schedule \
+ --task-type fetch \
+ --task-name "exchange-history" \
+ --task-cronspec "* * *" \
+ --task-param-level report \
+ --task-param-range-type latest \
+ "exchange-nexus"
+echo "OK"
+# create Taler facade.
+echo -n "Create the Taler facade at Nexus..."
+libeufin-cli facades \
+ new-taler-wire-gateway-facade \
+ --currency "TESTKUDOS" --facade-name "test-facade" \
+ "talerconn" "exchange-nexus"
+echo "OK"
+# Facade schema: http://localhost:$BANK_PORT/facades/test-facade/taler-wire-gateway/
+
TFN=`which taler-exchange-httpd`
TBINPFX=`dirname $TFN`
TLIBEXEC=${TBINPFX}/../lib/taler/libexec/
@@ -182,7 +349,7 @@ done
if [ 1 != $OK ]
then
- cleanup
+ exit_cleanup
exit_skip "Failed to launch Taler services"
fi
echo " DONE"
@@ -408,7 +575,7 @@ taler-wallet-cli $TIMETRAVEL --wallet-db=$WALLET_DB run-until-done
echo "Bought something with refresh-recouped coin"
echo "Shutting down services"
-cleanup
+exit_cleanup
# Dump database
@@ -416,15 +583,15 @@ echo "Dumping database"
echo "Dumping PostgreSQL database: ${BASEDB}.sql"
pg_dump -O $TARGET_DB | sed -e '/AS integer/d' > ${BASEDB}.sql
echo "Dumping libeufin database: ${BASEDB}-libeufin.sql"
-sqlite3 $TARGET_DB ".dump" > ${BASEDB}-libeufin.sql
+sqlite3 ${TARGET_DB}-nexus.sqlite3 ".dump" > ${BASEDB}-libeufin-nexus.sql
+sqlite3 ${TARGET_DB}-sandbox.sqlite3 ".dump" > ${BASEDB}-libeufin-sandbox.sql
echo $MASTER_PUB > ${BASEDB}.mpub
-date +%s > ${BASEDB}.age
# clean up
echo "Final clean up"
dropdb $TARGET_DB
-rm $TARGET_DB # libeufin
+rm ${TARGET_DB}-sandbox.sqlite3 ${TARGET_DB}-nexus.sqlite3 # libeufin DB
echo "====================================="
echo " Finished generation of $BASEDB "
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index 831fec67c..f06974153 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -72,7 +72,7 @@ function stop_libeufin()
echo "Killing libeufin sandbox"
PID=`cat libeufin-sandbox.pid 2> /dev/null`
kill $PID 2> /dev/null || true
- wait $PID
+ wait $PID || true
rm libeufin-sandbox.pid
fi
if test -f libeufin-nexus.pid
@@ -80,7 +80,7 @@ function stop_libeufin()
echo "Killing libeufin nexus"
PID=`cat libeufin-nexus.pid 2> /dev/null`
kill $PID 2> /dev/null || true
- wait $PID
+ wait $PID || true
rm libeufin-nexus.pid
fi
echo "killing libeufin DONE"
@@ -93,7 +93,7 @@ function cleanup()
then
echo -n "Stopping exchange $EPID..."
kill -TERM $EPID
- wait $EPID
+ wait $EPID || true
echo "DONE"
unset EPID
fi
@@ -114,7 +114,7 @@ function exit_cleanup()
do
kill $n 2> /dev/null || true
done
- wait
+ wait || true
echo "DONE"
}
@@ -122,12 +122,12 @@ function exit_cleanup()
trap exit_cleanup EXIT
function launch_libeufin () {
- export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:$DB.sqlite3"
+ export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:${DB}-nexus.sqlite3"
libeufin-nexus serve --port 8082 \
2> libeufin-nexus-stderr.log \
> libeufin-nexus-stdout.log &
echo $! > libeufin-nexus.pid
- export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:$DB.sqlite3"
+ export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:${DB}-sandbox.sqlite3"
export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=secret
libeufin-sandbox serve --port 18082 \
> libeufin-sandbox-stdout.log \
@@ -159,6 +159,8 @@ function nexus_submit_to_sandbox () {
unset LIBEUFIN_NEXUS_PASSWORD
unset LIBEUFIN_NEXUS_URL
}
+
+
# Operations to run before the actual audit
function pre_audit () {
# Launch bank
@@ -294,7 +296,7 @@ function run_audit () {
upload \
2> taler-exchange-offline-drain.log || exit_fail "offline draining failed"
kill -TERM $EPID
- wait $EPID
+ wait $EPID || true
unset EPID
echo -n "Running taler-exchange-drain ..."
echo "\n" | taler-exchange-drain -L DEBUG -c $CONF 2> taler-exchange-drain.log || exit_fail "FAIL"
@@ -328,13 +330,16 @@ function full_reload()
{
echo "Doing full reload of the database ($BASEDB - $DB)... "
dropdb $DB 2> /dev/null || true
- rm -f $DB.sqlite3 2> /dev/null || true # libeufin
+ rm -f ${DB}-nexus.sqlite3 ${DB}-sandbox.sqlite3 2> /dev/null || true # libeufin
createdb -T template0 $DB || exit_skip "could not create database $DB (at $PGHOST)"
# Import pre-generated database, -q(ietly) using single (-1) transaction
psql -Aqt $DB -q -1 -f ${BASEDB}.sql > /dev/null || exit_skip "Failed to load database $DB from ${BASEDB}.sql"
echo "DONE"
- echo -n "Loading libeufin basedb: ${BASEDB}-libeufin.sql"
- sqlite3 $DB.sqlite3 < ${BASEDB}-libeufin.sql || exit_skip "Failed to load libEufin database"
+ echo -n "Loading libeufin Nexus basedb: ${BASEDB}-libeufin-nexus.sql "
+ sqlite3 ${DB}-nexus.sqlite3 < ${BASEDB}-libeufin-nexus.sql || exit_skip "Failed to load Nexus database"
+ echo "DONE"
+ echo -n "Loading libeufin Sandbox basedb: ${BASEDB}-libeufin-sandbox.sql "
+ sqlite3 ${DB}-sandbox.sqlite3 < ${BASEDB}-libeufin-sandbox.sql || exit_skip "Failed to load Sandbox database"
echo "DONE"
}
@@ -829,10 +834,10 @@ function test_7() {
function test_8() {
echo "===========8: wire-transfer-subject disagreement==========="
- OLD_ID=`echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | sqlite3 $DB.sqlite3`
- OLD_WTID=`echo "SELECT reservePublicKey FROM TalerIncomingPayments WHERE payment='$OLD_ID';" | sqlite3 $DB.sqlite3`
+ OLD_ID=`echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | sqlite3 ${DB}-nexus.sqlite3`
+ OLD_WTID=`echo "SELECT reservePublicKey FROM TalerIncomingPayments WHERE payment='$OLD_ID';" | sqlite3 ${DB}-nexus.sqlite3`
NEW_WTID="CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG"
- echo "UPDATE TalerIncomingPayments SET reservePublicKey='$NEW_WTID' WHERE payment='$OLD_ID';" | sqlite3 $DB.sqlite3
+ echo "UPDATE TalerIncomingPayments SET reservePublicKey='$NEW_WTID' WHERE payment='$OLD_ID';" | sqlite3 ${DB}-nexus.sqlite3
run_audit
@@ -889,7 +894,7 @@ function test_8() {
echo PASS
# Undo database modification
- echo "UPDATE TalerIncomingPayments SET reservePublicKey='$OLD_WTID' WHERE payment='$OLD_ID';" | sqlite3 $DB.sqlite3
+ echo "UPDATE TalerIncomingPayments SET reservePublicKey='$OLD_WTID' WHERE payment='$OLD_ID';" | sqlite3 ${DB}-nexus.sqlite3
}
@@ -898,9 +903,9 @@ function test_8() {
function test_9() {
echo "===========9: wire-origin disagreement==========="
- OLD_ID=`echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | sqlite3 $DB.sqlite3`
- OLD_ACC=`echo "SELECT incomingPaytoUri FROM TalerIncomingPayments WHERE payment='$OLD_ID';" | sqlite3 $DB.sqlite3`
- echo "UPDATE TalerIncomingPayments SET incomingPaytoUri='payto://iban/SANDBOXX/DE144373?receiver-name=New+Exchange+Company' WHERE payment='$OLD_ID';" | sqlite3 $DB.sqlite3
+ OLD_ID=`echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | sqlite3 ${DB}-nexus.sqlite3`
+ OLD_ACC=`echo "SELECT incomingPaytoUri FROM TalerIncomingPayments WHERE payment='$OLD_ID';" | sqlite3 ${DB}-nexus.sqlite3`
+ echo "UPDATE TalerIncomingPayments SET incomingPaytoUri='payto://iban/SANDBOXX/DE144373?receiver-name=New+Exchange+Company' WHERE payment='$OLD_ID';" | sqlite3 ${DB}-nexus.sqlite3
run_audit
@@ -918,7 +923,7 @@ function test_9() {
echo PASS
# Undo database modification
- echo "UPDATE TalerIncomingPayments SET incomingPaytoUri='$OLD_ACC' WHERE payment='$OLD_ID';" | sqlite3 $DB.sqlite3
+ echo "UPDATE TalerIncomingPayments SET incomingPaytoUri='$OLD_ACC' WHERE payment='$OLD_ID';" | sqlite3 ${DB}-nexus.sqlite3
}
@@ -927,9 +932,9 @@ function test_9() {
function test_10() {
NOW_MS=`date +%s`000
echo "===========10: wire-timestamp disagreement==========="
- OLD_ID=`echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | sqlite3 $DB.sqlite3`
- OLD_DATE=`echo "SELECT timestampMs FROM TalerIncomingPayments WHERE payment='$OLD_ID';" | sqlite3 $DB.sqlite3`
- echo "UPDATE TalerIncomingPayments SET timestampMs=$NOW_MS WHERE payment=$OLD_ID;" | sqlite3 $DB.sqlite3
+ OLD_ID=`echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | sqlite3 ${DB}-nexus.sqlite3`
+ OLD_DATE=`echo "SELECT timestampMs FROM TalerIncomingPayments WHERE payment='$OLD_ID';" | sqlite3 ${DB}-nexus.sqlite3`
+ echo "UPDATE TalerIncomingPayments SET timestampMs=$NOW_MS WHERE payment=$OLD_ID;" | sqlite3 ${DB}-nexus.sqlite3
run_audit
@@ -947,7 +952,7 @@ function test_10() {
echo PASS
# Undo database modification
- echo "UPDATE TalerIncomingPayments SET timestampMs='$OLD_DATE' WHERE payment=$OLD_ID;" | sqlite3 $DB.sqlite3
+ echo "UPDATE TalerIncomingPayments SET timestampMs='$OLD_DATE' WHERE payment=$OLD_ID;" | sqlite3 ${DB}-nexus.sqlite3
}
@@ -957,25 +962,25 @@ function test_10() {
# ingested table: '.batches[0].batchTransactions[0].details.unstructuredRemittanceInformation'
function test_11() {
echo "===========11: spurious outgoing transfer ==========="
- OLD_ID=`echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | sqlite3 $DB.sqlite3`
- OLD_TX=`echo "SELECT transactionJson FROM NexusBankTransactions WHERE id='$OLD_ID';" | sqlite3 $DB.sqlite3`
+ OLD_ID=`echo "SELECT id FROM NexusBankTransactions WHERE amount='10' AND currency='TESTKUDOS' ORDER BY id LIMIT 1;" | sqlite3 ${DB}-nexus.sqlite3`
+ OLD_TX=`echo "SELECT transactionJson FROM NexusBankTransactions WHERE id='$OLD_ID';" | sqlite3 ${DB}-nexus.sqlite3`
# Change wire transfer to be FROM the exchange (#2) to elsewhere!
# (Note: this change also causes a missing incoming wire transfer, but
# this test is only concerned about the outgoing wire transfer
# being detected as such, and we simply ignore the other
# errors being reported.)
- OTHER_IBAN=`echo -e "SELECT iban FROM BankAccounts WHERE label='fortytwo'" | sqlite3 $DB.sqlite3`
+ OTHER_IBAN=`echo -e "SELECT iban FROM BankAccounts WHERE label='fortytwo'" | sqlite3 ${DB}-nexus.sqlite3`
NEW_TX=$(echo "$OLD_TX" | jq .batches[0].batchTransactions[0].details.creditDebitIndicator='"DBIT"' | jq 'del(.batches[0].batchTransactions[0].details.debtor)' | jq 'del(.batches[0].batchTransactions[0].details.debtorAccount)' | jq 'del(.batches[0].batchTransactions[0].details.debtorAgent)' | jq '.batches[0].batchTransactions[0].details.creditor'='{"name": "Forty Two"}' | jq .batches[0].batchTransactions[0].details.creditorAccount='{"iban": "'$OTHER_IBAN'"}' | jq .batches[0].batchTransactions[0].details.creditorAgent='{"bic": "SANDBOXX"}' | jq .batches[0].batchTransactions[0].details.unstructuredRemittanceInformation='"CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG http://exchange.example.com/"')
- echo -e "UPDATE NexusBankTransactions SET transactionJson='"$NEW_TX"' WHERE id=$OLD_ID" | sqlite3 $DB.sqlite3
+ echo -e "UPDATE NexusBankTransactions SET transactionJson='"$NEW_TX"' WHERE id=$OLD_ID" | sqlite3 ${DB}-nexus.sqlite3
# Now fake that the exchange prepared this payment (= it POSTed to /transfer)
# This step is necessary, because the TWG table that accounts for outgoing
# payments needs it. Worth noting here is the column 'rawConfirmation' that
# points to the transaction from the main Nexus ledger; without that column set,
# a prepared payment won't appear as actually outgoing.
- echo -e "INSERT INTO PaymentInitiations (bankAccount,preparationDate,submissionDate,sum,currency,endToEndId,paymentInformationId,instructionId,subject,creditorIban,creditorBic,creditorName,submitted,messageId,rawConfirmation) VALUES (1,1,1,10,'TESTKUDOS','NOTGIVEN','unused','unused','CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG http://exchange.example.com/','"$OTHER_IBAN"','SANDBOXX','Forty Two','unused',1,$OLD_ID)" | sqlite3 $DB.sqlite3
+ echo -e "INSERT INTO PaymentInitiations (bankAccount,preparationDate,submissionDate,sum,currency,endToEndId,paymentInformationId,instructionId,subject,creditorIban,creditorBic,creditorName,submitted,messageId,rawConfirmation) VALUES (1,1,1,10,'TESTKUDOS','NOTGIVEN','unused','unused','CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG http://exchange.example.com/','"$OTHER_IBAN"','SANDBOXX','Forty Two','unused',1,$OLD_ID)" | sqlite3 ${DB}-nexus.sqlite3
# Now populate the TWG table that accounts for outgoing payments, in
# order to let /history/outgoing return one result.
- echo -e "INSERT INTO TalerRequestedPayments (facade,payment,requestUid,amount,exchangeBaseUrl,wtid,creditAccount) VALUES (1,1,'unused','TESTKUDOS:10','http://exchange.example.com/','CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG','payto://iban/SANDBOXX/"$OTHER_IBAN"?receiver-name=Forty+Two')" | sqlite3 $DB.sqlite3
+ echo -e "INSERT INTO TalerRequestedPayments (facade,payment,requestUid,amount,exchangeBaseUrl,wtid,creditAccount) VALUES (1,1,'unused','TESTKUDOS:10','http://exchange.example.com/','CK9QBFY972KR32FVA1MW958JWACEB6XCMHHKVFMCH1A780Q12SVG','payto://iban/SANDBOXX/"$OTHER_IBAN"?receiver-name=Forty+Two')" | sqlite3 ${DB}-nexus.sqlite3
run_audit
@@ -1008,11 +1013,11 @@ function test_11() {
echo PASS
# Undo database modification
- echo -e "UPDATE NexusBankTransactions SET transactionJson='"$OLD_TX"' WHERE id=$OLD_ID;" | sqlite3 $DB.sqlite3
+ echo -e "UPDATE NexusBankTransactions SET transactionJson='"$OLD_TX"' WHERE id=$OLD_ID;" | sqlite3 ${DB}-nexus.sqlite3
# No other prepared payment should exist at this point,
# so OK to remove the number 1.
- echo -e "DELETE FROM PaymentInitiations WHERE id=1" | sqlite3 $DB.sqlite3
- echo -e "DELETE FROM TalerRequestedPayments WHERE id=1" | sqlite3 $DB.sqlite3
+ echo -e "DELETE FROM PaymentInitiations WHERE id=1" | sqlite3 ${DB}-nexus.sqlite3
+ echo -e "DELETE FROM TalerRequestedPayments WHERE id=1" | sqlite3 ${DB}-nexus.sqlite3
}
# Test for hanging/pending refresh.
@@ -1154,9 +1159,9 @@ function test_16() {
# (Only one payment out exist, so the logic below should select the outgoing
# wire transfer):
function test_16_db () {
- OLD_AMOUNT=`echo "SELECT amount FROM TalerRequestedPayments WHERE id='1';" | sqlite3 $DB.sqlite3`
+ OLD_AMOUNT=`echo "SELECT amount FROM TalerRequestedPayments WHERE id='1';" | sqlite3 ${DB}-nexus.sqlite3`
NEW_AMOUNT="TESTKUDOS:50"
- echo "UPDATE TalerRequestedPayments SET amount='${NEW_AMOUNT}' WHERE id='1';" | sqlite3 $DB.sqlite3
+ echo "UPDATE TalerRequestedPayments SET amount='${NEW_AMOUNT}' WHERE id='1';" | sqlite3 ${DB}-nexus.sqlite3
}
echo -n Trying to patch the SQLite database..
for try in `seq 1 10`; do
@@ -1199,7 +1204,7 @@ function test_16() {
echo "Second modification: wire nothing"
NEW_AMOUNT="TESTKUDOS:0"
- echo "UPDATE TalerRequestedPayments SET amount='${NEW_AMOUNT}' WHERE id='1';" | sqlite3 $DB.sqlite3
+ echo "UPDATE TalerRequestedPayments SET amount='${NEW_AMOUNT}' WHERE id='1';" | sqlite3 ${DB}-nexus.sqlite3
audit_only
echo -n "Testing inconsistency detection... "
@@ -1249,12 +1254,12 @@ function test_17() {
# wire transfer).
function test_17_db () {
OLD_ID=1
- OLD_PREP=`echo "SELECT payment FROM TalerRequestedPayments WHERE id='${OLD_ID}';" | sqlite3 $DB.sqlite3`
- OLD_DATE=`echo "SELECT preparationDate FROM PaymentInitiations WHERE id='${OLD_ID}';" | sqlite3 $DB.sqlite3`
+ OLD_PREP=`echo "SELECT payment FROM TalerRequestedPayments WHERE id='${OLD_ID}';" | sqlite3 ${DB}-nexus.sqlite3`
+ OLD_DATE=`echo "SELECT preparationDate FROM PaymentInitiations WHERE id='${OLD_ID}';" | sqlite3 ${DB}-nexus.sqlite3`
# Note: need - interval '1h' as "NOW()" may otherwise be exactly what is already in the DB
# (due to rounding, if this machine is fast...)
NOW_1HR=$(expr $(date +%s) - 3600)
- echo "UPDATE PaymentInitiations SET preparationDate='$NOW_1HR' WHERE id='${OLD_PREP}';" | sqlite3 $DB.sqlite3
+ echo "UPDATE PaymentInitiations SET preparationDate='$NOW_1HR' WHERE id='${OLD_PREP}';" | sqlite3 ${DB}-nexus.sqlite3
}
echo -n Trying to patch the SQLite database..
for try in `seq 1 10`; do
@@ -1417,7 +1422,7 @@ function test_21() {
# remove transaction from bank DB
# Currently emulating this (to be deleted):
- echo "DELETE FROM TalerRequestedPayments WHERE amount='TESTKUDOS:${VAL_DELTA}'" | sqlite3 $DB.sqlite3
+ echo "DELETE FROM TalerRequestedPayments WHERE amount='TESTKUDOS:${VAL_DELTA}'" | sqlite3 ${DB}-nexus.sqlite3
audit_only
post_audit
@@ -1668,14 +1673,14 @@ function test_27() {
pre_audit aggregator
# Obtain data to duplicate.
- WTID=`echo SELECT wtid FROM TalerRequestedPayments WHERE id=1 | sqlite3 $DB.sqlite3`
+ WTID=`echo SELECT wtid FROM TalerRequestedPayments WHERE id=1 | sqlite3 ${DB}-nexus.sqlite3`
echo WTID=$WTID
- OTHER_IBAN=`echo -e "SELECT iban FROM BankAccounts WHERE label='fortytwo'" | sqlite3 $DB.sqlite3`
+ OTHER_IBAN=`echo -e "SELECT iban FROM BankAccounts WHERE label='fortytwo'" | sqlite3 ${DB}-nexus.sqlite3`
stop_libeufin
# 'rawConfirmation' is set to 2 here, that doesn't
# point to any record. That's only needed to set a non null value.
- echo -e "INSERT INTO PaymentInitiations (bankAccount,preparationDate,submissionDate,sum,currency,endToEndId,paymentInformationId,instructionId,subject,creditorIban,creditorBic,creditorName,submitted,messageId,rawConfirmation) VALUES (1,$(date +%s),$(expr $(date +%s) + 2),10,'TESTKUDOS','NOTGIVEN','unused','unused','$WTID http://exchange.example.com/','$OTHER_IBAN','SANDBOXX','Forty Two','unused',1,2)" | sqlite3 $DB.sqlite3
- echo -e "INSERT INTO TalerRequestedPayments (facade,payment,requestUid,amount,exchangeBaseUrl,wtid,creditAccount) VALUES (1,2,'unused','TESTKUDOS:1','http://exchange.example.com/','$WTID','payto://iban/SANDBOXX/$OTHER_IBAN?receiver-name=Forty+Two')" | sqlite3 $DB.sqlite3
+ echo -e "INSERT INTO PaymentInitiations (bankAccount,preparationDate,submissionDate,sum,currency,endToEndId,paymentInformationId,instructionId,subject,creditorIban,creditorBic,creditorName,submitted,messageId,rawConfirmation) VALUES (1,$(date +%s),$(expr $(date +%s) + 2),10,'TESTKUDOS','NOTGIVEN','unused','unused','$WTID http://exchange.example.com/','$OTHER_IBAN','SANDBOXX','Forty Two','unused',1,2)" | sqlite3 ${DB}-nexus.sqlite3
+ echo -e "INSERT INTO TalerRequestedPayments (facade,payment,requestUid,amount,exchangeBaseUrl,wtid,creditAccount) VALUES (1,2,'unused','TESTKUDOS:1','http://exchange.example.com/','$WTID','payto://iban/SANDBOXX/$OTHER_IBAN?receiver-name=Forty+Two')" | sqlite3 ${DB}-nexus.sqlite3
launch_libeufin
audit_only
post_audit
@@ -2082,7 +2087,7 @@ export PGHOST
MYDIR=`mktemp -d /tmp/taler-auditor-basedbXXXXXX`
echo "Generating fresh database at $MYDIR"
-rm -f $DB.sqlite3 2> /dev/null || true # libeufin
+rm -f ${DB}-nexus.sqlite3 ${DB}-sandbox.sqlite3 2> /dev/null || true # libeufin
if faketime -f '-1 d' ./generate-auditor-basedb.sh $MYDIR/$DB
then
check_with_database $MYDIR/$DB
diff --git a/src/auditor/test-revocation.sh b/src/auditor/test-revocation.sh
index 1aeb6b641..db36bf034 100755
--- a/src/auditor/test-revocation.sh
+++ b/src/auditor/test-revocation.sh
@@ -20,7 +20,7 @@
# Check that the auditor report is as expected.
#
# Requires 'jq' tool and Postgres superuser rights!
-set -eu
+set -eux
# Set of numbers for all the testcases.
# When adding new tests, increase the last number:
@@ -65,7 +65,7 @@ function stop_libeufin()
echo "Killing libeufin sandbox"
PID=`cat libeufin-sandbox.pid 2> /dev/null`
kill $PID 2> /dev/null || true
- wait $PID
+ wait $PID || true
rm libeufin-sandbox.pid
fi
if test -f libeufin-nexus.pid
@@ -73,7 +73,7 @@ function stop_libeufin()
echo "Killing libeufin nexus"
PID=`cat libeufin-nexus.pid 2> /dev/null`
kill $PID 2> /dev/null || true
- wait $PID
+ wait $PID || true
rm libeufin-nexus.pid
fi
echo "killing libeufin DONE"
@@ -147,12 +147,12 @@ function get_payto_uri() {
}
function launch_libeufin () {
- export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:$DB.sqlite3"
+ export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:${DB}-nexus.sqlite3"
libeufin-nexus serve --port 8082 \
2> libeufin-nexus-stderr.log \
> libeufin-nexus-stdout.log &
echo $! > libeufin-nexus.pid
- export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:$DB.sqlite3"
+ export LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:${DB}-sandbox.sqlite3"
export LIBEUFIN_SANDBOX_ADMIN_PASSWORD=secret
libeufin-sandbox serve --port 18082 \
> libeufin-sandbox-stdout.log \
@@ -248,7 +248,7 @@ function audit_only () {
# Cleanup to run after the auditor
function post_audit () {
cleanup
- echo -n "TeXing ."
+ echo -n "TeXing ."
taler-helper-auditor-render.py test-audit-aggregation.json test-audit-coins.json test-audit-deposits.json test-audit-reserves.json test-audit-wire.json < ../../contrib/auditor-report.tex.j2 > test-report.tex || exit_fail "Renderer failed"
echo -n "."
@@ -276,20 +276,23 @@ function full_reload()
{
echo -n "Doing full reload of the database... "
dropdb $DB 2> /dev/null || true
- rm -f $DB.sqlite3 || true # libeufin
+ rm -f ${DB}-nexus.sqlite3 ${DB}-sandbox.sqlite3 || true # libeufin
createdb -T template0 $DB || exit_skip "could not create database $DB (at $PGHOST)"
# Import pre-generated database, -q(ietly) using single (-1) transaction
psql -Aqt $DB -q -1 -f ${BASEDB}.sql > /dev/null || exit_skip "Failed to load database $DB from ${BASEDB}.sql"
echo "DONE"
- echo "Loading libeufin basedb: ${BASEDB}-libeufin.sql"
- sqlite3 $DB.sqlite3 < ${BASEDB}-libeufin.sql || exit_skip "Failed to load libEufin database"
+ echo "Loading libeufin Nexus basedb: ${BASEDB}-libeufin-nexus.sql"
+ sqlite3 ${DB}-nexus.sqlite3 < ${BASEDB}-libeufin-nexus.sql || exit_skip "Failed to load Nexus database"
+ echo "DONE"
+ echo "Loading libeufin Sandbox basedb: ${BASEDB}-libeufin-nexus.sql"
+ sqlite3 ${DB}-sandbox.sqlite3 < ${BASEDB}-libeufin-sandbox.sql || exit_skip "Failed to load Sandbox database"
echo "DONE"
# Exchange payto URI contains the (dynamically generated)
# IBAN, that can only be written in CONF after libeufin is
# setup.
taler-config -c $CONF -s exchange-account-1 -o PAYTO_URI &> /dev/null || (
- echo -n "Specifying exchange payto URI in the configuration ($CONF) (grab IBAN from $DB.sqlite3)...";
- EXCHANGE_IBAN=`echo "SELECT iban FROM BankAccounts WHERE label='exchange'" | sqlite3 $DB.sqlite3`;
+ echo -n "Specifying exchange payto URI in the configuration ($CONF) (grab IBAN from ${DB}-sandbox.sqlite3)...";
+ EXCHANGE_IBAN=`echo "SELECT iban FROM BankAccounts WHERE label='exchange'" | sqlite3 ${DB}-sandbox.sqlite3`;
taler-config -c $CONF -s exchange-account-1 -o PAYTO_URI \
-V "payto://iban/SANDBOXX/$EXCHANGE_IBAN?receiver-name=Exchange+Company"
echo " DONE"