summaryrefslogtreecommitdiff
path: root/src/testing/test_merchant_reserve_creation.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/test_merchant_reserve_creation.sh')
-rwxr-xr-xsrc/testing/test_merchant_reserve_creation.sh32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/testing/test_merchant_reserve_creation.sh b/src/testing/test_merchant_reserve_creation.sh
index 29ad7dda..d3ececb8 100755
--- a/src/testing/test_merchant_reserve_creation.sh
+++ b/src/testing/test_merchant_reserve_creation.sh
@@ -22,6 +22,7 @@
echo -n "Configuring merchant instance ..."
# create instance
+FORTYTHREE=`get_payto_uri fortythree x`
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
@@ -39,7 +40,7 @@ echo OK
echo -n "creating reserve ..."
STATUS=$(curl 'http://localhost:9966/instances/default/private/reserves' \
- -d '{"initial_balance":"TESTKUDOS:2","exchange_url":"'$EXCHANGE_URL'","wire_method":"x-taler-bank"}' \
+ -d '{"initial_balance":"TESTKUDOS:2","exchange_url":"'$EXCHANGE_URL'","wire_method":"iban"}' \
-w "%{http_code}" -s -o $LAST_RESPONSE)
@@ -67,17 +68,22 @@ fi
echo -n Wire transferring...
-STATUS=$(curl http://Exchange:x@localhost:$BANK_PORT/taler-wire-gateway/Exchange/admin/add-incoming \
- -d '{"reserve_pub":"'$RESERVE_PUB'","debit_account":"payto://x-taler-bank/localhost:'$BANK_PORT'/43","amount":"TESTKUDOS:2"}' \
- -w "%{http_code}" -s -o $LAST_RESPONSE)
-
-if [ "$STATUS" != "200" ]
-then
- echo 'should respond ok, wire transfer executed. got:' $STATUS
- exit 1
-fi
-
-echo OK
+# Exchange wants TESTKUDOS:2 from account 43, under RESERVE_PUB.
+
+EXCHANGE_PAYTO=`get_payto_uri exchange x`
+export LIBEUFIN_SANDBOX_USERNAME=fortythree
+export LIBEUFIN_SANDBOX_PASSWORD=x
+export LIBEUFIN_SANDBOX_URL=http://localhost:18082/demobanks/default
+libeufin-cli sandbox demobank new-transaction \
+ --bank-account fortythree \
+ --payto-with-subject "$EXCHANGE_PAYTO&message=$RESERVE_PUB" \
+ --amount 2 # Currency taken from the demobank config.
+unset LIBEUFIN_SANDBOX_USERNAME
+unset LIBEUFIN_SANDBOX_PASSWORD
+unset LIBEUFIN_SANDBOX_URL
+echo -n "Give background tasks time to detect the payment..."
+sleep 4
+echo " OK"
# Stop existing background service, we need to run it here, now, and only once
kill -TERM $WIREWATCH_PID
@@ -158,7 +164,7 @@ echo OK
echo -n "trying to create invalid reserve ..."
STATUS=$(curl 'http://localhost:9966/instances/default/private/reserves' \
- -d '{"initial_balance":"INVALID:2","exchange_url":"'$EXCHANGE_URL'","wire_method":"x-taler-bank"}' \
+ -d '{"initial_balance":"INVALID:2","exchange_url":"'$EXCHANGE_URL'","wire_method":"iban"}' \
-w "%{http_code}" -s -o $LAST_RESPONSE)
if [ "$STATUS" != "400" ]