summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2021-07-07 01:44:53 -0300
committerSebastian <sebasjm@gmail.com>2021-07-07 01:44:56 -0300
commit976860bfecf27cd16a77ad508879c225989cb26e (patch)
tree88c735c991e3e4285950d999dc479b8259ddac1f
parent0604cb36393129bd292caf1fab3e267fb2030fc8 (diff)
downloadmerchant-976860bfecf27cd16a77ad508879c225989cb26e.tar.gz
merchant-976860bfecf27cd16a77ad508879c225989cb26e.tar.bz2
merchant-976860bfecf27cd16a77ad508879c225989cb26e.zip
issue #6915
-rwxr-xr-xsrc/testing/test_merchant_order_creation.sh76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/testing/test_merchant_order_creation.sh b/src/testing/test_merchant_order_creation.sh
index f596666d..6e772b81 100755
--- a/src/testing/test_merchant_order_creation.sh
+++ b/src/testing/test_merchant_order_creation.sh
@@ -55,6 +55,82 @@ fi
echo OK
RANDOM_IMG='data:image/png;base64,abcdefg'
+#
+# CREATE AN ORDER WITHOUT TOKEN
+#
+
+echo -n "Creating order without TOKEN..."
+STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+ -d '{"create_token":false,"order":{"amount":"TESTKUDOS:7","summary":"3","products":[{"description":"desct","image":"'$RANDOM_IMG'","price":"TESTKUDOS:1","taxes":[],"unit":"u","quantity":1}]}}' \
+ -w "%{http_code}" -s -o $LAST_RESPONSE)
+
+if [ "$STATUS" != "200" ]
+then
+ echo 'should response ok, order created. got:' $STATUS `cat $LAST_RESPONSE`
+ exit 1
+fi
+
+ORDER_ID=`jq -r .order_id < $LAST_RESPONSE`
+TOKEN=`jq -r .token < $LAST_RESPONSE`
+
+if [ "$TOKEN" != "null" ]
+then
+ echo 'token should be null, got:' $TOKEN
+fi
+
+STATUS=$(curl http://localhost:9966/orders/$ORDER_ID \
+ -w "%{http_code}" -s -o $LAST_RESPONSE)
+
+PAY_URI=`jq -r .taler_pay_uri < $LAST_RESPONSE`
+
+if [ "$PAY_URI" == "null" ]
+then
+ echo 'should have a payuri. got:' $PAY_URI `cat $LAST_RESPONSE`
+ exit 1
+fi
+echo OK
+
+#
+# CREATE AN ORDER WITHOUT TOKEN WITH FULLFILMENT URL
+#
+
+echo -n "Creating order without TOKEN and fullfilment URL..."
+STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
+ -d '{"create_token":false,"order":{"fulfillment_url":"go_here_please", "amount":"TESTKUDOS:7","summary":"3","products":[{"description":"desct","image":"'$RANDOM_IMG'","price":"TESTKUDOS:1","taxes":[],"unit":"u","quantity":1}]}}' \
+ -w "%{http_code}" -s -o $LAST_RESPONSE)
+
+if [ "$STATUS" != "200" ]
+then
+ echo 'should response ok, order created. got:' $STATUS `cat $LAST_RESPONSE`
+ exit 1
+fi
+
+ORDER_ID=`jq -r .order_id < $LAST_RESPONSE`
+TOKEN=`jq -r .token < $LAST_RESPONSE`
+
+if [ "$TOKEN" != "null" ]
+then
+ echo 'token should be null, got:' $TOKEN
+fi
+
+STATUS=$(curl http://localhost:9966/orders/$ORDER_ID \
+ -w "%{http_code}" -s -o $LAST_RESPONSE)
+
+PAY_URI=`jq -r .taler_pay_uri < $LAST_RESPONSE`
+FULLFILMENT_URL=`jq -r .fulfillment_url < $LAST_RESPONSE`
+
+if [ "$FULLFILMENT_URL" != "go_here_please" ]
+then
+ echo 'should have a payuri. got:' $PAY_URI `cat $LAST_RESPONSE`
+ exit 1
+fi
+
+if [ "$PAY_URI" == "null" ]
+then
+ echo 'should have a payuri. got:' $PAY_URI `cat $LAST_RESPONSE`
+ exit 1
+fi
+echo OK
#
# CREATE ORDER WITH NON-INVENTORY AND CHECK