gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated (d6e8a195 -> d2b8019d)


From: gnunet
Subject: [taler-merchant] branch master updated (d6e8a195 -> d2b8019d)
Date: Sat, 06 Aug 2022 13:22:20 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a change to branch master
in repository merchant.

    from d6e8a195 move merchant database into its own schema
     new ba23a5ce towards libeufin based tests
     new 32deaf4b -fix rm call
     new d2b8019d rebase on master

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 contrib/merchant-backoffice                    |  2 +-
 src/testing/initialize_taler_system.sh         | 62 +++++++++++++++++++-------
 src/testing/test-merchant-walletharness.sh     |  6 ++-
 src/testing/test_merchant_order_creation.sh    | 57 +++++++++++++----------
 src/testing/test_merchant_product_creation.sh  |  3 +-
 src/testing/test_merchant_reserve_creation.sh  | 32 +++++++------
 src/testing/test_merchant_transfer_tracking.sh | 50 +++++++++++++--------
 src/testing/test_template.conf                 | 16 ++-----
 8 files changed, 140 insertions(+), 88 deletions(-)

diff --git a/contrib/merchant-backoffice b/contrib/merchant-backoffice
index 182cdfff..07df6b6b 160000
--- a/contrib/merchant-backoffice
+++ b/contrib/merchant-backoffice
@@ -1 +1 @@
-Subproject commit 182cdfffa1d4b6f2bb3543d30cfa7509e73bda03
+Subproject commit 07df6b6b872aa088b42d716323a208d41243317a
diff --git a/src/testing/initialize_taler_system.sh 
b/src/testing/initialize_taler_system.sh
index 3970fb8d..186a6e2a 100755
--- a/src/testing/initialize_taler_system.sh
+++ b/src/testing/initialize_taler_system.sh
@@ -43,9 +43,39 @@ function cleanup()
     do
         kill $n 2> /dev/null || true
     done
-    rm -rf $CONF $WALLET_DB $TMP_DIR $LAST_RESPONSE
     wait
+    rm -rf $CONF $WALLET_DB $TMP_DIR $LAST_RESPONSE
+    # kill euFin
+    kill `cat libeufin-sandbox.pid 2> /dev/null` &> /dev/null || true
+    kill `cat libeufin-nexus.pid 2> /dev/null` &> /dev/null || true
+}
+
+NEXUS_PORT=8082
+SANDBOX_URL=http://localhost:1$NEXUS_PORT/demobanks/default
+export BANK_URL=$SANDBOX_URL
+function get_payto_uri() {
+    export LIBEUFIN_SANDBOX_USERNAME=$1
+    export LIBEUFIN_SANDBOX_PASSWORD=$2
+    export LIBEUFIN_SANDBOX_URL=$SANDBOX_URL
+    libeufin-cli sandbox demobank info --bank-account $1 | jq --raw-output 
'.paytoUri'
+}
+export get_payto_uri
+
+function get_bankaccount_balance() {
+    export LIBEUFIN_SANDBOX_USERNAME=$1
+    export LIBEUFIN_SANDBOX_PASSWORD=$2
+    export LIBEUFIN_SANDBOX_URL=$SANDBOX_URL
+    libeufin-cli sandbox demobank info --bank-account $1 | jq --raw-output 
'.balance.amount'
+}
+export get_bankaccount_balance
+
+function get_bankaccount_transactions() {
+    export LIBEUFIN_SANDBOX_USERNAME=$1
+    export LIBEUFIN_SANDBOX_PASSWORD=$2
+    export LIBEUFIN_SANDBOX_URL=$SANDBOX_URL
+    libeufin-cli sandbox demobank list-transactions --bank-account $1
 }
+export get_bankaccount_transactions
 
 # Exchange configuration file will be edited, so we create one
 # from the template.
@@ -69,8 +99,8 @@ taler-exchange-httpd -h > /dev/null || exit_skip " 
taler-exchange required"
 taler-merchant-httpd -h > /dev/null || exit_skip " taler-merchant required"
 echo " FOUND"
 
-echo -n "Testing for taler-bank-manage"
-taler-bank-manage --help >/dev/null </dev/null || exit_skip " MISSING"
+echo -n "Testing for libeufin-cli"
+libeufin-cli --help >/dev/null </dev/null || exit_skip " MISSING"
 echo " FOUND"
 echo -n "Testing for taler-wallet-cli"
 taler-wallet-cli -v >/dev/null </dev/null 2> /dev/null || exit_skip " MISSING"
@@ -90,8 +120,6 @@ MASTER_PUB=`gnunet-ecc -p ${MASTER_PRIV_FILE}`
 EXCHANGE_URL=`taler-config -c $CONF -s EXCHANGE -o BASE_URL`
 MERCHANT_PORT=`taler-config -c $CONF -s MERCHANT -o PORT`
 MERCHANT_URL=http://localhost:${MERCHANT_PORT}/
-BANK_PORT=`taler-config -c $CONF -s BANK -o HTTP_PORT`
-BANK_URL=http://localhost:${BANK_PORT}/
 AUDITOR_URL=http://localhost:8083/
 AUDITOR_PRIV_FILE=`taler-config -f -c $CONF -s AUDITOR -o AUDITOR_PRIV_FILE`
 AUDITOR_PRIV_DIR=`dirname $AUDITOR_PRIV_FILE`
@@ -106,7 +134,7 @@ taler-config -c $CONF -s merchant-exchange-default -o 
MASTER_KEY -V $MASTER_PUB
 taler-config -c $CONF -s exchangedb-postgres -o CONFIG -V postgres:///$TALER_DB
 taler-config -c $CONF -s auditordb-postgres -o CONFIG -V postgres:///$TALER_DB
 taler-config -c $CONF -s merchantdb-postgres -o CONFIG -V postgres:///$TALER_DB
-taler-config -c $CONF -s bank -o database -V postgres:///$TALER_DB
+BANK_DB="jdbc:sqlite:$TMP_DIR/$TALER_DB"
 taler-config -c $CONF -s exchange -o KEYDIR -V "${TMP_DIR}/keydir/"
 taler-config -c $CONF -s exchange -o REVOCATION_DIR -V "${TMP_DIR}/revdir/"
 
@@ -118,9 +146,17 @@ echo -n "taler-wallet-cli "
 taler-wallet-cli --version
 taler-exchange-httpd --version
 taler-merchant-httpd --version
+libeufin-cli --version
+echo " OK"
 
+# euFin before the exchange, because must set
+# the PAYTO_URI config option (with unguessable IBAN)
+# before the exchange starts.
+echo "Setting up euFin ..."
+# reset eufin database
+rm -f $TALER_DB
+taler-bank-manage-testing $NEXUS_PORT $TALER_DB $EXCHANGE_URL $CONF
 echo -n "Setting up exchange ..."
-
 # reset database
 dropdb $TALER_DB >/dev/null 2>/dev/null || true
 createdb $TALER_DB || exit_skip "Could not create database $TALER_DB"
@@ -128,12 +164,6 @@ taler-exchange-dbinit -c $CONF
 taler-merchant-dbinit -c $CONF
 taler-auditor-dbinit -c $CONF
 taler-auditor-exchange -c $CONF -m $MASTER_PUB -u $EXCHANGE_URL
-
-echo " OK"
-
-# Launch services
-echo -n "Launching taler services ..."
-taler-bank-manage-testing $CONF postgres:///$TALER_DB serve > taler-bank.log 
2> taler-bank.err &
 taler-exchange-secmod-eddsa -c $CONF -L DEBUG 2> 
taler-exchange-secmod-eddsa.log &
 taler-exchange-secmod-rsa -c $CONF -L DEBUG 2> taler-exchange-secmod-rsa.log &
 taler-exchange-secmod-cs -c $CONF -L DEBUG 2> taler-exchange-secmod-cs.log &
@@ -144,8 +174,8 @@ MERCHANT_HTTPD_PID=$!
 taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log &
 WIREWATCH_PID=$!
 taler-auditor-httpd -L INFO -c $CONF 2> taler-auditor-httpd.log &
-
 echo " OK"
+# Launch services
 
 echo -n "Waiting for the bank"
 # Wait for bank to be available (usually the slowest)
@@ -218,9 +248,9 @@ echo -n "Setting up keys ..."
 taler-exchange-offline -c $CONF \
   download \
   sign \
-  enable-account payto://x-taler-bank/localhost/Exchange \
+  enable-account `taler-config -c $CONF -s exchange-account-1 -o PAYTO_URI` \
   enable-auditor $AUDITOR_PUB $AUDITOR_URL "TESTKUDOS Auditor" \
-  wire-fee now x-taler-bank TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 \
+  wire-fee now iban TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 \
   global-fee now TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 
1h 1h 1year 5 \
   upload &> taler-exchange-offline.log
 
diff --git a/src/testing/test-merchant-walletharness.sh 
b/src/testing/test-merchant-walletharness.sh
index 75f979eb..8ff36941 100755
--- a/src/testing/test-merchant-walletharness.sh
+++ b/src/testing/test-merchant-walletharness.sh
@@ -28,14 +28,16 @@ function exit_skip() {
     exit 77
 }
 
-echo -n "Testing for taler-bank-manage"
-taler-bank-manage --help >/dev/null </dev/null || exit_skip " MISSING"
+# If CLI is installed, assume all the suite is.
+echo -n "Testing for libeufin(-cli)"
+libeufin-cli --help >/dev/null </dev/null || exit_skip " MISSING"
 echo " FOUND"
 
 echo -n "Testing for taler-wallet-cli"
 taler-wallet-cli --help >/dev/null </dev/null || exit_skip " MISSING"
 echo " FOUND"
 
+export WALLET_HARNESS_WITH_EUFIN=1
 res=0
 taler-wallet-cli testing run-integrationtests --dry --suites merchant 
2&>/dev/null || res=$?
 
diff --git a/src/testing/test_merchant_order_creation.sh 
b/src/testing/test_merchant_order_creation.sh
index cf029714..dbe997cb 100755
--- a/src/testing/test_merchant_order_creation.sh
+++ b/src/testing/test_merchant_order_creation.sh
@@ -5,7 +5,15 @@ set -eu
 
 . initialize_taler_system.sh
 
-echo -n "First prepare wallet with coins..."
+# $1: sandbox username
+# $2: sandbox password
+# $3: payto with subject
+# $4: amount
+function wire_funds() {
+  libeufin-cli sandbox demobank new-transaction
+}
+
+echo -n "First prepare wallet with coins ..."
 rm $WALLET_DB
 taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api 
'withdrawTestBalance' \
   "$(jq -n '
@@ -14,7 +22,7 @@ taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api 
'withdrawTestBalance'
         bankBaseUrl: $BANK_URL,
         exchangeBaseUrl: $EXCHANGE_URL
     }' \
-    --arg BANK_URL "$BANK_URL" \
+    --arg BANK_URL "$BANK_URL/access-api/" \
     --arg EXCHANGE_URL "$EXCHANGE_URL"
   )" 2>wallet-withdraw-1.err >wallet-withdraw-1.out
 taler-wallet-cli --wallet-db=$WALLET_DB run-until-done 
2>wallet-withdraw-finish-1.err >wallet-withdraw-finish-1.out
@@ -34,6 +42,7 @@ fi
 echo -n "Configuring merchant instance ..."
 
 # create with 2 address
+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 \
@@ -50,7 +59,11 @@ fi
 STATUS=$(curl -H "Content-Type: application/json" -X PATCH \
     -H 'Authorization: Bearer secret-token:super_secret' \
     http://localhost:9966/instances/default/private/ \
+<<<<<<< HEAD
     -d 
'{"auth":{"method":"external"},"payto_uris":["payto://x-taler-bank/localhost:8082/43"],"id":"default","name":"default","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\":[\"$FORTYTHREE\"],\"id\":\"default\",\"name\":\"default\",\"address\":{},\"jurisdiction\":{},\"default_max_wire_fee\":\"TESTKUDOS:1\",
 
\"default_max_deposit_fee\":\"TESTKUDOS:1\",\"default_wire_fee_amortization\":1,\"default_wire_transfer_delay\":{\"d_ms\"
 : 50000},\"default_pay_delay\":{\"d_ms\": 60000}}" \
+>>>>>>> 0df2345 (towards libeufin based tests)
     -w "%{http_code}" -s -o /dev/null)
 
 if [ "$STATUS" != "204" ]
@@ -59,8 +72,6 @@ then
     exit 1
 fi
 
-
-
 echo OK
 RANDOM_IMG='data:image/png;base64,abcdefg'
 
@@ -327,27 +338,27 @@ echo -n "Perform wire transfers ..."
 taler-exchange-aggregator -y -c $CONF -T ${TO_SLEEP}000000 -t -L INFO &> 
aggregator.log
 taler-exchange-transfer -c $CONF -t -L INFO &> transfer.log
 echo " DONE"
+echo -n "Give time to Nexus to route the payment to Sandbox..."
+sleep 3
+echo " DONE"
 
 echo -n "Obtaining wire transfer details from bank..."
-
-# First, extract the wire transfer data from the bank.
-# As there is no "nice" API, we do this by dumping the
-# bank database and grabbing the 'right' wire transfer,
-# which is the one outgoing from the exchange (account 2).
-BANKDATA=`taler-bank-manage -c $CONF django dumpdata 2>/dev/null | tail -n1 | 
jq '.[] | select(.model=="app.banktransaction")' | jq 
'select(.fields.debit_account==2)'`
-SUBJECT=`echo $BANKDATA | jq -r .fields.subject`
+# Emulating the previous pybank-based logic of getting
+# the wire transfer information _via the exchange_ bank
+# account.  NOTE: grabbing tx == 0, since the latest
+# transaction appear first in the bank's history.
+BANKDATA=`get_bankaccount_transactions exchange x | jq '.transactions[0]'`
+SUBJECT=`echo $BANKDATA | jq -r .subject`
 WTID=`echo $SUBJECT | awk '{print $1}'`
 WURL=`echo $SUBJECT | awk '{print $2}'`
-CREDIT_AMOUNT=`echo $BANKDATA | jq -r .fields.amount`
-TARGET=`echo $BANKDATA | jq -r .fields.credit_account`
-# 'TARGET' is now the numeric value of the account, we need to get the actual 
account *name*:
-BANKADATA=`taler-bank-manage -c $CONF django dumpdata 2>/dev/null | tail -n1 | 
jq '.[] | select(.model=="auth.user")' | jq 'select(.pk=='$TARGET')'`
-ACCOUNT_NAME=`echo $BANKADATA | jq -r .fields.username`
-TARGET_PAYTO="payto://x-taler-bank/localhost:8082/$ACCOUNT_NAME"
+CREDIT_AMOUNT="`echo $BANKDATA | jq -r .currency`:`echo $BANKDATA | jq -r 
.amount`"
+TARGET=`echo $BANKDATA | jq -r .creditorIban`
+# 'TARGET' is now the IBAN.
+TARGET_PAYTO="payto://iban/SANDBOXX/$TARGET?receiver-name=Forty+Three"
 
 if [ "$EXCHANGE_URL" != "$WURL" ]
 then
-    exit_fail "Wrong exchange URL in subject '$SUBJECT', expected 
$EXCHANGE_URL"
+    exit_fail "Wrong exchange URL in subject '$SUBJECT', expected 
'$EXCHANGE_URL'"
 fi
 
 echo " OK"
@@ -533,13 +544,11 @@ fi
 
 echo " OK"
 
-echo -n "Removing password from account 43 ..."
-taler-bank-manage -c $CONF --with-db postgres:///$TALER_DB django 
changepassword_unsafe 43 x >/dev/null 2>/dev/null
-
-ACCOUNT_PASSWORD="43:x"
-BANK_HOST="localhost:8082"
+ACCOUNT_PASSWORD="fortythree:x"
+BANK_HOST="localhost:18082"
 
-STATUS=$(curl "http://$ACCOUNT_PASSWORD@$BANK_HOST/accounts/43"; \
+# Can be replaced by the libeufin-cli way.
+STATUS=$(curl 
"http://$ACCOUNT_PASSWORD@$BANK_HOST/demobanks/default/access-api/accounts/fortythree";
 \
     -w "%{http_code}" -s -o $LAST_RESPONSE)
 
 if [ "$STATUS" != "200" ]
diff --git a/src/testing/test_merchant_product_creation.sh 
b/src/testing/test_merchant_product_creation.sh
index b7264118..fb2f3b1e 100755
--- a/src/testing/test_merchant_product_creation.sh
+++ b/src/testing/test_merchant_product_creation.sh
@@ -20,6 +20,7 @@
 . initialize_taler_system.sh
 
 echo -n "Configuring merchant 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 \
@@ -179,7 +180,7 @@ taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api 
'withdrawTestBalance'
         bankBaseUrl: $BANK_URL,
         exchangeBaseUrl: $EXCHANGE_URL
     }' \
-    --arg BANK_URL "$BANK_URL" \
+    --arg BANK_URL "$BANK_URL/access-api/" \
     --arg EXCHANGE_URL "$EXCHANGE_URL"
   )" 2>wallet-withdraw-1.err >wallet-withdraw-1.out
 taler-wallet-cli --wallet-db=$WALLET_DB run-until-done 
2>wallet-withdraw-finish-1.err >wallet-withdraw-finish-1.out
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" ]
diff --git a/src/testing/test_merchant_transfer_tracking.sh 
b/src/testing/test_merchant_transfer_tracking.sh
index 4f8cf2c5..0fee9096 100755
--- a/src/testing/test_merchant_transfer_tracking.sh
+++ b/src/testing/test_merchant_transfer_tracking.sh
@@ -29,7 +29,7 @@ taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api 
'withdrawTestBalance'
         bankBaseUrl: $BANK_URL,
         exchangeBaseUrl: $EXCHANGE_URL
     }' \
-    --arg BANK_URL "$BANK_URL" \
+    --arg BANK_URL "$BANK_URL/access-api/" \
     --arg EXCHANGE_URL "$EXCHANGE_URL"
   )" 2>wallet-withdraw-1.err >wallet-withdraw-1.out
 taler-wallet-cli --wallet-db=$WALLET_DB run-until-done 
2>wallet-withdraw-finish-1.err >wallet-withdraw-finish-1.out
@@ -40,7 +40,8 @@ echo " OK"
 #
 
 echo -n "Configuring merchant default instance ..."
-
+TOR_PAYTO=`get_payto_uri tor x`
+GNUNET_PAYTO=`get_payto_uri gnunet x`
 # create with 2 address
 STATUS=$(curl -H "Content-Type: application/json" -X POST \
     -H 'Authorization: Bearer secret-token:super_secret' \
@@ -58,12 +59,17 @@ 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 \
+<<<<<<< HEAD
     -d 
'{"auth":{"method":"external"},"payto_uris":["payto://x-taler-bank/localhost:8082/Survey","payto://x-taler-bank/localhost:8082/Tutorial"],"id":"test","name":"default","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\":[\"$SURVEY_PAYTO\",\"$TUTORIAL_PAYTO\"],\"id\":\"test\",\"name\":\"default\",\"address\":{},\"jurisdiction\":{},\"default_max_wire_fee\":\"TESTKUDOS:1\",
 
\"default_max_deposit_fee\":\"TESTKUDOS:1\",\"default_wire_fee_amortization\":1,\"default_wire_transfer_delay\":{\"d_ms\"
 : 50000},\"default_pay_delay\":{\"d_ms\": 60000}}" \
+>>>>>>> 0df2345 (towards libeufin based tests)
     -w "%{http_code}" -s -o /dev/null)
 
 if [ "$STATUS" != "204" ]
@@ -141,23 +147,31 @@ taler-exchange-aggregator -y -c $CONF -T 
${TO_SLEEP}000000 -t -L INFO &> aggrega
 taler-exchange-transfer -c $CONF -t -L INFO &> transfer.log
 echo " DONE"
 
-echo -n "Obtaining wire transfer details from bank..."
+echo -n "waiting for Nexus and Sandbox to settle the payment .."
+sleep 3
+echo " DONE"
 
-# First, extract the wire transfer data from the bank.
-# As there is no "nice" API, we do this by dumping the
-# bank database and grabbing the 'right' wire transfer,
-# which is the one outgoing from the exchange (account 2).
-export BANKDATA=`taler-bank-manage -c $CONF django dumpdata 2>/dev/null | tail 
-n1 | jq '.[] | select(.model=="app.banktransaction")' | jq 
'select(.fields.debit_account==2)'`
-export SUBJECT=`echo $BANKDATA | jq -r .fields.subject`
+echo -n "Obtaining wire transfer details from bank..."
+# Emulating the previous pybank-based logic of getting
+# the wire transfer information _via the exchange_ bank
+# account.  NOTE: grabbing tx == 0, since the latest
+# transaction appear first in the bank's history.
+export BANKDATA=`get_bankaccount_transactions exchange x | jq 
'.transactions[0]'`
+export SUBJECT=`echo $BANKDATA | jq -r .subject`
 export WTID=`echo $SUBJECT | awk '{print $1}'`
 export WURL=`echo $SUBJECT | awk '{print $2}'`
-export CREDIT_AMOUNT=`echo $BANKDATA | jq -r .fields.amount`
-export TARGET=`echo $BANKDATA | jq -r .fields.credit_account`
-# 'TARGET' is now the numeric value of the account, we need to get the actual 
account *name*:
-BANKADATA=`taler-bank-manage -c $CONF django dumpdata 2>/dev/null | tail -n1 | 
jq '.[] | select(.model=="auth.user")' | jq 'select(.pk=='$TARGET')'`
-ACCOUNT_NAME=`echo $BANKADATA | jq -r .fields.username`
-TARGET_PAYTO="payto://x-taler-bank/localhost:8082/$ACCOUNT_NAME"
-
+export CREDIT_AMOUNT="`echo $BANKDATA | jq -r .currency`:`echo $BANKDATA | jq 
-r .amount`"
+export TARGET=`echo $BANKDATA | jq -r .creditorIban`
+# Figure out which account got payed, in order to
+# resort the right (and complete: including the receiver-name)
+# TARGET_PAYTO
+if `echo $SURVEY_PAYTO | grep -q $TARGET`; then
+  export TARGET_PAYTO=$SURVEY_PAYTO;
+fi
+if `echo $TUTORIAL_PAYTO | grep -q $TARGET`; then
+  export TARGET_PAYTO=$TUTORIAL_PAYTO;
+fi
+echo " DONE"
 if [ "$EXCHANGE_URL" != "$WURL" ]
 then
     exit_fail "Wrong exchange URL in subject '$SUBJECT', expected 
$EXCHANGE_URL"
@@ -178,7 +192,7 @@ echo -n "Notifying merchant of correct wire transfer, but 
on wrong instance..."
 #issue 6912
 #here we are notifying the transfer into a wrong instance (default) and the 
payto_uri of the default instance
 STATUS=$(curl 'http://localhost:9966/instances/default/private/transfers' \
-    -d 
'{"credit_amount":"'$CREDIT_AMOUNT'","wtid":"'$WTID'","payto_uri":"payto://x-taler-bank/localhost:8082/Tor","exchange_url":"'$WURL'"}'
 \
+    -d 
"{\"credit_amount\":\"$CREDIT_AMOUNT\",\"wtid\":\"$WTID\",\"payto_uri\":\"$TOR_PAYTO\",\"exchange_url\":\"$WURL\"}"
 \
     -m 3 \
     -w "%{http_code}" -s -o $LAST_RESPONSE)
 
diff --git a/src/testing/test_template.conf b/src/testing/test_template.conf
index e9b94761..21bb6186 100644
--- a/src/testing/test_template.conf
+++ b/src/testing/test_template.conf
@@ -57,29 +57,19 @@ TINY_AMOUNT = TESTKUDOS:0.01
 AUDITOR_PRIV_FILE = ${TALER_DATA_HOME}/auditor/offline-keys/auditor.priv
 BASE_URL = "http://localhost:8083/";
 
-[bank]
-DATABASE = postgres:///taler-auditor-basedb
-MAX_DEBT = TESTKUDOS:50.0
-MAX_DEBT_BANK = TESTKUDOS:100000.0
-HTTP_PORT = 8082
-SUGGESTED_EXCHANGE = http://localhost:8081/
-SUGGESTED_EXCHANGE_PAYTO = "payto://x-taler-bank/localhost/2?receiver-name=2"
-ALLOW_REGISTRATIONS = YES
-SERVE = http
-
 [exchangedb]
 IDLE_RESERVE_EXPIRATION_TIME = 4 weeks
 LEGAL_RESERVE_EXPIRATION_TIME = 7 years
 
 [exchange-account-1]
-PAYTO_URI = "payto://x-taler-bank/localhost/Exchange?receiver-name=Exchange"
+# PAYTO_URI comes by patching.
 enable_debit = yes
 enable_credit = yes
 
 [exchange-accountcredentials-1]
-WIRE_GATEWAY_URL = "http://localhost:8082/taler-wire-gateway/Exchange/";
+WIRE_GATEWAY_URL = 
"http://localhost:8082/facades/test-facade/taler-wire-gateway/";
 WIRE_GATEWAY_AUTH_METHOD = basic
-USERNAME = Exchange
+USERNAME = exchange
 PASSWORD = x
 
 [merchant-exchange-default]

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]