summaryrefslogtreecommitdiff
path: root/src/testing/test_merchant_transfer_tracking.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/testing/test_merchant_transfer_tracking.sh')
-rwxr-xr-xsrc/testing/test_merchant_transfer_tracking.sh65
1 files changed, 62 insertions, 3 deletions
diff --git a/src/testing/test_merchant_transfer_tracking.sh b/src/testing/test_merchant_transfer_tracking.sh
index 764e3d71..5a2a29e0 100755
--- a/src/testing/test_merchant_transfer_tracking.sh
+++ b/src/testing/test_merchant_transfer_tracking.sh
@@ -182,7 +182,7 @@ STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
-m 3 \
-w "%{http_code}" -s -o $LAST_RESPONSE)
-if [ "$STATUS" != "404" ]
+if [ "$STATUS" != "200" ]
then
jq . < $LAST_RESPONSE
exit_fail "Expected response ok, after providing transfer data. got: $STATUS"
@@ -203,10 +203,10 @@ fi
TRANSFERS_LIST_SIZE=`jq -r '.transfers | length' < $LAST_RESPONSE`
-if [ "$TRANSFERS_LIST_SIZE" != "0" ]
+if [ "$TRANSFERS_LIST_SIZE" != "1" ]
then
jq . < $LAST_RESPONSE
- exit_fail "Expected response ok. got: $STATUS"
+ exit_fail "Expected one transfer. got: $TRANSFERS_LIST_SIZE"
fi
echo "OK"
@@ -248,10 +248,69 @@ WAS_WIRED=`jq -r .wired < $LAST_RESPONSE`
if [ "$WAS_WIRED" == "true" ]
then
+ jq . < $LAST_RESPONSE
echo '.wired true, expected false'
exit 1
fi
echo " OK"
+echo -n "Notifying merchant of correct wire transfer in the correct instance..."
+#this time in the correct instance so the order will be marked as wired...
+
+STATUS=$(curl 'http://localhost:9966/instances/test/private/transfers' \
+ -d '{"credit_amount":"'$CREDIT_AMOUNT'","wtid":"'$WTID'","payto_uri":"'$TARGET_PAYTO'","exchange_url":"'$WURL'"}' \
+ -m 3 \
+ -w "%{http_code}" -s -o $LAST_RESPONSE)
+
+if [ "$STATUS" != "200" ]
+then
+ jq . < $LAST_RESPONSE
+ exit_fail "Expected response ok, after providing transfer data. got: $STATUS"
+fi
+echo " OK"
+
+echo -n "Fetching wire transfers of TEST instance ..."
+
+STATUS=$(curl 'http://localhost:9966/instances/test/private/transfers' \
+ -w "%{http_code}" -s -o $LAST_RESPONSE)
+
+if [ "$STATUS" != "200" ]
+then
+ jq . < $LAST_RESPONSE
+ exit_fail "Expected response 200 Ok. got: $STATUS"
+fi
+
+TRANSFERS_LIST_SIZE=`jq -r '.transfers | length' < $LAST_RESPONSE`
+
+if [ "$TRANSFERS_LIST_SIZE" != "1" ]
+then
+ jq . < $LAST_RESPONSE
+ exit_fail "Expected one transfer. got: $TRANSFERS_LIST_SIZE"
+fi
+
+echo "OK"
+
+echo -n "Checking order status ..."
+STATUS=$(curl "http://localhost:9966/instances/test/private/orders/${ORDER_ID}?transfer=YES" \
+ -w "%{http_code}" -s -o $LAST_RESPONSE)
+
+if [ "$STATUS" != "200" ]
+then
+ jq . < $LAST_RESPONSE
+ exit_fail 'should response ok, after order inquiry. got:' $STATUS `cat $LAST_RESPONSE`
+ exit 1
+fi
+
+WAS_WIRED=`jq -r .wired < $LAST_RESPONSE`
+
+if [ "$WAS_WIRED" != "true" ]
+then
+ jq . < $LAST_RESPONSE
+ echo '.wired false, expected true'
+ exit 1
+fi
+
+echo " OK"
+
exit 0