aboutsummaryrefslogtreecommitdiff
path: root/integrationtests/test-double-link.sh
diff options
context:
space:
mode:
authorTorsten Grote <t@grobox.de>2020-05-06 16:05:38 -0300
committerTorsten Grote <t@grobox.de>2020-05-06 16:05:38 -0300
commitb7c75bd56a484efcf77210f1541cda67e2a90f61 (patch)
tree29ef27231280b5756ed542084a60e98f418b9537 /integrationtests/test-double-link.sh
parent85af5421e53f92f24919cb57c02efb6f72fb8e27 (diff)
integration test for handling the same pay URI multiple times
Diffstat (limited to 'integrationtests/test-double-link.sh')
-rwxr-xr-xintegrationtests/test-double-link.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/integrationtests/test-double-link.sh b/integrationtests/test-double-link.sh
new file mode 100755
index 000000000..75de484c3
--- /dev/null
+++ b/integrationtests/test-double-link.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+# Script to check that Uris are properly handled when used a second time
+
+source "common.sh"
+setup_config "double-link"
+setup_services
+launch_services
+wait_for_services
+
+WALLET_DB=wallet-double-link.json
+
+echo "Getting pay taler:// Uri"
+PAY_URI=$(taler-wallet-cli testing gen-pay-uri -m "$MERCHANT_URL" -k sandbox -a "TESTKUDOS:1" -s "foo" | grep -E -o 'taler://.*')
+echo "Trying to pay without balance"
+taler-wallet-cli --wallet-db=$WALLET_DB --no-throttle handle-uri --yes "$PAY_URI" 2>&1 | grep -q "insufficient balance" || exit_error "not reporting insufficient balance"
+echo "Withdrawing"
+taler-wallet-cli --wallet-db=$WALLET_DB --no-throttle testing withdraw -e "$EXCHANGE_URL" -b "$BANK_URL" -a "TESTKUDOS:10" > /dev/null
+echo "Trying to pay again, should work this time"
+taler-wallet-cli --wallet-db=$WALLET_DB --no-throttle handle-uri --yes "$PAY_URI" > /dev/null
+echo "Trying to pay what was paid already should throw error"
+taler-wallet-cli --wallet-db=$WALLET_DB --no-throttle handle-uri --yes "$PAY_URI" 2>&1 | grep -q "already paid" || exit_error "not reporting already paid"
+echo "Already paid properly detected"
+
+rm $WALLET_DB || true
+
+exit 0