[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: -more style fixes
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: -more style fixes |
Date: |
Sun, 16 Apr 2023 10:51:48 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new bee412d0 -more style fixes
bee412d0 is described below
commit bee412d0d4fb788f79259836b525be2888cc321f
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Sun Apr 16 10:51:45 2023 +0200
-more style fixes
---
src/testing/test_merchant_wirewatch.sh | 151 ++++++++++++++-------------------
1 file changed, 63 insertions(+), 88 deletions(-)
diff --git a/src/testing/test_merchant_wirewatch.sh
b/src/testing/test_merchant_wirewatch.sh
index 32c5544c..b6cadc1b 100755
--- a/src/testing/test_merchant_wirewatch.sh
+++ b/src/testing/test_merchant_wirewatch.sh
@@ -31,8 +31,6 @@ export
LIBEUFIN_SANDBOX_DB_CONNECTION="jdbc:sqlite:${TALER_DB}"
export LIBEUFIN_SANDBOX_ADMIN_PASSWORD="secret"
export LIBEUFIN_SANDBOX_URL="http://localhost:1${NEXUS_PORT}/"
-export GNUNET_PAYTO=$(get_payto_uri gnunet x)
-
export LIBEUFIN_SANDBOX_USERNAME="admin"
export LIBEUFIN_SANDBOX_PASSWORD="secret"
export EBICS_USER_ID="gnunet_ebics"
@@ -60,7 +58,8 @@ echo -n "Create credit user (for gnunet-merchant) at Nexus
..."
export LIBEUFIN_NEXUS_DB_CONNECTION="jdbc:sqlite:${TALER_DB}"
libeufin-nexus \
superuser "$CREDIT_USERNAME" \
- --password="$CREDIT_PASSWORD"
+ --password="$CREDIT_PASSWORD" \
+ &> nexus-credit-create.log
echo " OK"
export LIBEUFIN_NEXUS_USERNAME="$CREDIT_USERNAME"
export LIBEUFIN_NEXUS_PASSWORD="$CREDIT_PASSWORD"
@@ -72,7 +71,8 @@ libeufin-cli sandbox \
--host-id ${EBICS_HOST} \
--user-id ${NEXUS_ACCOUNT_NAME} \
--partner-id ${EBICS_PARTNER} \
- --bank-account ${SANDBOX_ACCOUNT_NAME}
+ --bank-account ${SANDBOX_ACCOUNT_NAME} \
+ &> sandbox-subscriber-create.log
libeufin-cli \
connections \
@@ -81,24 +81,28 @@ libeufin-cli \
--host-id=${EBICS_HOST} \
--partner-id=${EBICS_PARTNER} \
--ebics-user-id=${NEXUS_ACCOUNT_NAME} \
- ${BANK_CONNECTION_NAME}
+ ${BANK_CONNECTION_NAME} \
+ &> nexus-connection-create.log
-# FIXME-MS: This step fails with a 500 error (code 9000!)
libeufin-cli \
connections \
connect \
- ${BANK_CONNECTION_NAME}
+ ${BANK_CONNECTION_NAME} \
+ &> nexus-connection-connect.log
libeufin-cli \
connections \
download-bank-accounts \
- ${BANK_CONNECTION_NAME}
+ ${BANK_CONNECTION_NAME} \
+ &> nexus-account-download.log
+
libeufin-cli \
connections \
import-bank-account \
--offered-account-id=${SANDBOX_ACCOUNT_NAME} \
--nexus-bank-account-id=${NEXUS_ACCOUNT_NAME} \
- ${BANK_CONNECTION_NAME}
+ ${BANK_CONNECTION_NAME} \
+ &> nexus-account-import.log
libeufin-cli \
facades \
@@ -106,11 +110,12 @@ libeufin-cli \
--currency=TESTKUDOS \
--facade-name=${GNUNET_CREDIT_FACADE} \
${BANK_CONNECTION_NAME} \
- ${NEXUS_ACCOUNT_NAME}
+ ${NEXUS_ACCOUNT_NAME} \
+ &> nexus-new-facade.log
FACADE_URL=$(libeufin-cli facades list | jq .facades[0].baseUrl | tr -d \")
-echo -n "Setting FACADE URL ${FACADE_URL} in configuration..."
+echo -n "Setting FACADE URL in configuration..."
taler-config -c "$CONF" \
-s "taler-merchant-wirewatch" \
-o "WIRE_GATEWAY_URL" \
@@ -118,10 +123,10 @@ taler-config -c "$CONF" \
echo " OK"
echo -n "First prepare wallet with coins..."
-rm "${WALLET_DB}"
+rm -f "${WALLET_DB}"
taler-wallet-cli \
--no-throttle \
- --wallet-db=$WALLET_DB \
+ --wallet-db="$WALLET_DB" \
api \
--expect-success 'withdrawTestBalance' \
"$(jq -n '
@@ -134,7 +139,7 @@ taler-wallet-cli \
--arg EXCHANGE_URL "$EXCHANGE_URL"
)" 2>wallet-withdraw-1.err >wallet-withdraw-1.out
taler-wallet-cli \
- --wallet-db=$WALLET_DB \
+ --wallet-db="$WALLET_DB" \
run-until-done \
2>wallet-withdraw-finish-1.err \
>wallet-withdraw-finish-1.out
@@ -152,7 +157,7 @@ GNUNET_PAYTO=$(get_payto_uri gnunet x)
STATUS=$(curl -H "Content-Type: application/json" -X POST \
-H 'Authorization: Bearer secret-token:super_secret' \
http://localhost:9966/management/instances \
- -d
'{"auth":{"method":"external"},"payto_uris":["'$TOR_PAYTO'","'$GNUNET_PAYTO'"],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1",
"default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 50000000},"default_pay_delay":{"d_us": 60000000}}' \
+ -d
'{"auth":{"method":"external"},"payto_uris":["'"$TOR_PAYTO"'","'"$GNUNET_PAYTO"'"],"id":"default","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1",
"default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 50000000},"default_pay_delay":{"d_us": 60000000}}' \
-w "%{http_code}" -s -o /dev/null)
if [ "$STATUS" != "204" ]
@@ -162,88 +167,67 @@ fi
echo "OK"
-
-echo -n "Configuring merchant test instance ..."
-SURVEY_PAYTO=$(get_payto_uri survey x)
-TUTORIAL_PAYTO=$(get_payto_uri tutorial x)
-# create with 2 address
-
-STATUS=$(curl -H "Content-Type: application/json" -X POST \
- -H 'Authorization: Bearer secret-token:super_secret' \
- http://localhost:9966/management/instances \
- -d
'{"auth":{"method":"external"},"payto_uris":["'$SURVEY_PAYTO'","'$TUTORIAL_PAYTO'"],"id":"test","name":"default","user_type":"business","address":{},"jurisdiction":{},"default_max_wire_fee":"TESTKUDOS:1",
"default_max_deposit_fee":"TESTKUDOS:1","default_wire_fee_amortization":1,"default_wire_transfer_delay":{"d_us"
: 50000000},"default_pay_delay":{"d_us": 60000000}}' \
- -w "%{http_code}" -s -o /dev/null)
-
-if [ "$STATUS" != "204" ]
-then
- exit_fail "Expected 204 no content. Got: $STATUS"
-fi
-echo "OK"
-
-RANDOM_IMG='data:image/png;base64,abcdefg'
-
# CREATE ORDER AND SELL IT
echo -n "Creating order to be paid..."
-STATUS=$(curl 'http://localhost:9966/instances/test/private/orders' \
+STATUS=$(curl 'http://localhost:9966/instances/default/private/orders' \
-d '{"order":{"amount":"TESTKUDOS:1","summary":"payme"}}' \
- -w "%{http_code}" -s -o $LAST_RESPONSE)
+ -w "%{http_code}" \
+ -s \
+ -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
then
- exit_fail "Expected 200 OK. Got: $STATUS " $(cat "$LAST_RESPONSE")
+ exit_fail "Expected 200 OK. Got: $STATUS " "$(cat "$LAST_RESPONSE")"
fi
-ORDER_ID=$(jq -e -r .order_id < $LAST_RESPONSE)
-TOKEN=$(jq -e -r .token < $LAST_RESPONSE)
-
-STATUS=$(curl
"http://localhost:9966/instances/test/private/orders/${ORDER_ID}" \
- -w "%{http_code}" -s -o $LAST_RESPONSE)
+ORDER_ID=$(jq -e -r .order_id < "$LAST_RESPONSE")
+STATUS=$(curl
"http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+ -w "%{http_code}" \
+ -s \
+ -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
then
- exit_fail "Expected 200 ok. Got: $STATUS" $(cat $LAST_RESPONSE)
+ exit_fail "Expected 200 ok. Got: $STATUS" "$(cat "$LAST_RESPONSE")"
fi
-PAY_URL=$(jq -e -r .taler_pay_uri < $LAST_RESPONSE)
+PAY_URL=$(jq -e -r .taler_pay_uri < "$LAST_RESPONSE")
echo OK
NOW=$(date +%s)
echo -n "Pay first order ..."
taler-wallet-cli \
--no-throttle \
- --wallet-db=$WALLET_DB \
+ --wallet-db="$WALLET_DB" \
handle-uri "${PAY_URL}" \
-y 2> wallet-pay1.err > wallet-pay1.log
NOW2=$(date +%s)
-echo " OK (took $( echo -n $(($NOW2 - $NOW))) secs)"
+echo "OK. Took $(( NOW2 - NOW))s."
-STATUS=$(curl
"http://localhost:9966/instances/test/private/orders/${ORDER_ID}" \
- -w "%{http_code}" -s -o $LAST_RESPONSE)
+STATUS=$(curl
"http://localhost:9966/instances/default/private/orders/${ORDER_ID}" \
+ -w "%{http_code}" \
+ -s \
+ -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
then
- exit_fail "Expected 200 Ok. Got: $STATUS" $(cat $LAST_RESPONSE)
+ exit_fail "Expected 200 Ok. Got: $STATUS" "$(cat "$LAST_RESPONSE")"
fi
-ORDER_STATUS=$(jq -r .order_status < $LAST_RESPONSE)
-
+ORDER_STATUS=$(jq -r .order_status < "$LAST_RESPONSE")
if [ "$ORDER_STATUS" != "paid" ]
then
- exit_fail "Expected order status 'paid'. Got: $ORDER_STATUS" $(cat
$LAST_RESPONSE)
+ exit_fail "Expected order status 'paid'. Got: $ORDER_STATUS" "$(cat
"$LAST_RESPONSE")"
fi
#
# WIRE TRANSFER TO MERCHANT AND NOTIFY BACKEND
#
-PAY_DEADLINE=$(jq -r .contract_terms.pay_deadline.t_s < $LAST_RESPONSE)
-WIRE_DEADLINE=$(jq -r .contract_terms.wire_transfer_deadline.t_s <
$LAST_RESPONSE)
-
+WIRE_DEADLINE=$(jq -r .contract_terms.wire_transfer_deadline.t_s <
"$LAST_RESPONSE")
NOW=$(date +%s)
-TO_SLEEP=$(echo $(( $WIRE_DEADLINE - $NOW )) )
-echo "Waiting ${TO_SLEEP}s for wire transfer"
-
-echo -n "Perform wire transfers ..."
+TO_SLEEP="$(( 1 + WIRE_DEADLINE - NOW ))"
+echo -n "Perform wire transfers (with ${TO_SLEEP}s timeshift) ..."
taler-exchange-aggregator \
-y \
-c "$CONF" \
@@ -258,6 +242,11 @@ echo " DONE"
echo -n "Waiting for Nexus and Sandbox to settle the payment ..."
sleep 3
+libeufin-cli \
+ accounts \
+ fetch-transactions \
+ ${NEXUS_ACCOUNT_NAME} \
+ &> libeufin-transfer-fetch.out
echo " DONE"
echo -n "Obtaining wire transfer details from bank..."
@@ -269,50 +258,36 @@ echo " OK"
echo -n "Fetching wire transfers of DEFAULT instance ..."
STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
- -w "%{http_code}" -s -o $LAST_RESPONSE)
+ -w "%{http_code}" \
+ -s \
+ -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
then
- jq . < $LAST_RESPONSE
- exit_fail "Expected response 200 Ok. Got: $STATUS"
+ exit_fail "Expected response 200 Ok. Got: $STATUS" "$(jq . <
"$LAST_RESPONSE")"
fi
-TRANSFERS_LIST_SIZE=$(jq -r '.transfers | length' < $LAST_RESPONSE)
+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 "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" != "0" ]
-then
- jq . < $LAST_RESPONSE
- exit_fail "Expected response ok. got: $STATUS"
+ exit_fail "Expected one transfer. Got: $TRANSFERS_LIST_SIZE" "$(jq . <
"$LAST_RESPONSE")"
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)
+STATUS=$(curl
"http://localhost:9966/instances/default/private/orders/${ORDER_ID}?transfer=YES"
\
+ -w "%{http_code}" \
+ -s \
+ -o "$LAST_RESPONSE")
if [ "$STATUS" != "200" ]
then
- jq . < $LAST_RESPONSE
- exit_fail "Expected 200 ok. got: $STATUS" $(cat $LAST_RESPONSE)
+ jq . < "$LAST_RESPONSE"
+ exit_fail "Expected 200 ok. got: $STATUS" "$(cat "$LAST_RESPONSE")"
fi
-WAS_WIRED=$(jq -r .wired < $LAST_RESPONSE)
+WAS_WIRED=$(jq -r .wired < "$LAST_RESPONSE")
if [ "$WAS_WIRED" != "true" ]
then
- jq . < $LAST_RESPONSE
+ jq . < "$LAST_RESPONSE"
exit_fail "Got .wired 'false', expected 'true'"
fi
echo " OK"
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: -more style fixes,
gnunet <=