anastasis-gtk

Demonstrator GUI for Anastasis
Log | Files | Refs | README | LICENSE

test_prepare.sh (19057B)


      1 #!/bin/bash
      2 # Shell script to launch Taler components
      3 # and Anastasis providers for local test
      4 # using TESTKUDOS.
      5 
      6 set -eu
      7 
      8 # Exit, with status code "skip" (no 'real' failure)
      9 function exit_skip() {
     10     echo " SKIP: $1"
     11     exit 77
     12 }
     13 
     14 # Exit, with error message (hard failure)
     15 function exit_fail() {
     16     echo " FAIL: $1"
     17     exit 1
     18 }
     19 
     20 # Cleanup to run whenever we exit
     21 function cleanup()
     22 {
     23     for n in `jobs -p`
     24     do
     25         kill -SIGCONT $n # in case one provider was suspended
     26         kill $n 2> /dev/null || true
     27     done
     28     rm -rf $CONF $CONF_4 $WALLET_DB $R1FILE $R2FILE $B1FILE $B2FILE $TMP_DIR
     29     wait
     30 }
     31 
     32 
     33 # $1=ebics username, $2=ebics partner name, $3=person name, $4=sandbox bank account name, $5=iban
     34 function prepare_sandbox_account() {
     35   echo -n "Activating ebics subscriber $1 at the sandbox ..."
     36   libeufin-cli \
     37     sandbox --sandbox-url=$SANDBOX_URL \
     38       ebicssubscriber create \
     39         --host-id=$EBICS_HOST \
     40         --partner-id=$2 \
     41         --user-id=$1
     42   echo " OK"
     43   echo -n "Giving a bank account ($4) to $1 ..."
     44   libeufin-cli \
     45     sandbox --sandbox-url=$SANDBOX_URL \
     46       ebicsbankaccount create \
     47         --iban=$5 \
     48         --bic="BCMAESM1XXX"\
     49         --person-name="$3" \
     50         --account-name=$4 \
     51         --ebics-user-id=$1 \
     52         --ebics-host-id=$EBICS_HOST \
     53         --ebics-partner-id=$2
     54   echo " OK"
     55 }
     56 
     57 
     58 # Transfer only from debit to credit/anastasis account.
     59 # This function moves funds directly at the Sandbox.  No need
     60 # to pass through the Nexus+Ebics layer to issue the payment
     61 # $1 = amount ($CURRENCY:X.Y), $2 = subject.
     62 function wire_transfer_to_anastasis() {
     63   libeufin-sandbox make-transaction \
     64     --debit-account=sandbox-account-debit \
     65     --credit-account=sandbox-account-credit "$1" "$2"
     66   # Sync nexus with sandbox
     67   export LIBEUFIN_NEXUS_USERNAME=$CREDIT_USERNAME
     68   export LIBEUFIN_NEXUS_PASSWORD=$CREDIT_PASSWORD
     69   libeufin-cli accounts fetch-transactions nexus-bankaccount-credit > /dev/null
     70   anastasis-helper-authorization-iban -c $CONF_4 -t -L INFO
     71 }
     72 
     73 # $1 = facade base URL.  Merely a debug utility.
     74 function see_anastasis_transactions_via_facade() {
     75   curl -s --user "$CREDIT_USERNAME:$CREDIT_PASSWORD" "${1}history/incoming?delta=5" | jq
     76 }
     77 
     78 # $1 = ebics user id, $2 = ebics partner, $3 = bank connection name
     79 # $4 = bank account name local to Nexus, $5 = bank account name as known
     80 # by Sandbox
     81 function prepare_nexus_account() {
     82   echo -n "Making bank connection $3 ..."
     83   libeufin-cli connections new-ebics-connection \
     84     --ebics-url="${SANDBOX_URL}ebicsweb" \
     85     --host-id=$EBICS_HOST \
     86     --partner-id=$2 \
     87     --ebics-user-id=$1 \
     88     $3 > /dev/null
     89   echo " OK"
     90   echo -n "Connecting $3 ..."
     91   libeufin-cli connections connect $3 > /dev/null
     92   echo " OK"
     93   echo -n "Importing Sandbox bank account ($5) to Nexus ($4) ..."
     94   libeufin-cli connections download-bank-accounts $3 > /dev/null
     95   libeufin-cli connections import-bank-account \
     96     --offered-account-id=$5 --nexus-bank-account-id=$4 $3 > /dev/null
     97   echo " OK"
     98 }
     99 
    100 # $1 = facade name, $2 = bank connection to use, $3 = bank account name
    101 # local to Nexus
    102 function prepare_anastasis_facade() {
    103   echo -n "Creating facade ..."
    104   libeufin-cli facades new-anastasis-facade \
    105     --currency=EUR \
    106     --facade-name=$1 \
    107     $2 $3
    108   echo " OK"
    109   # No need to setup facade permissions, as the anastasis client
    110   # is superuser at Nexus.
    111 }
    112 
    113 
    114 
    115 if test "${1:-}" != "free" -a "${1:-}" != "fees"
    116 then
    117     echo "Launch script with either 'free' or 'fees' argument to launch providers with/without fees."
    118     exit 1
    119 fi
    120 
    121 export CONF_1="test_anastasis_reducer_1.conf"
    122 export CONF_2="test_anastasis_reducer_2.conf"
    123 export CONF_3="test_anastasis_reducer_3.conf"
    124 if test $1 = 'free'
    125 then
    126     CONF4="test_anastasis_reducer_4_free.conf"
    127 else
    128     CONF4="test_anastasis_reducer_4.conf"
    129 fi
    130 
    131 # Exchange configuration file will be edited, so we create one
    132 # from the template.
    133 export CONF=`mktemp test_reducerXXXXXX.conf`
    134 export CONF_4=`mktemp test_reducer_4XXXXXX.conf`
    135 cp test_reducer.conf $CONF
    136 cp $CONF4 $CONF_4
    137 
    138 TMP_DIR=`mktemp -d keys-tmp-XXXXXX`
    139 WALLET_DB=`mktemp test_reducer_walletXXXXXX.json`
    140 B1FILE=`mktemp test_reducer_stateB1XXXXXX`
    141 B2FILE=`mktemp test_reducer_stateB2XXXXXX`
    142 R1FILE=`mktemp test_reducer_stateR1XXXXXX`
    143 R2FILE=`mktemp test_reducer_stateR2XXXXXX`
    144 IBAN_ACTIVE='false'
    145 
    146 # Install cleanup handler (except for kill -9)
    147 trap cleanup EXIT
    148 
    149 # Check we can actually run
    150 if test $1 = 'fees'
    151 then
    152     echo -n "Testing for taler"
    153     taler-exchange-httpd -h > /dev/null || exit_skip " taler-exchange required"
    154     taler-merchant-httpd -h > /dev/null || exit_skip " taler-merchant required"
    155     echo " FOUND"
    156 
    157     echo -n "Testing for taler-bank-manage"
    158     taler-bank-manage --help >/dev/null </dev/null || exit_skip " MISSING"
    159     echo " FOUND"
    160 
    161     echo -n "Testing for taler-wallet-cli"
    162     taler-wallet-cli -v >/dev/null </dev/null || exit_skip " MISSING"
    163     echo " FOUND"
    164 fi
    165 
    166 echo -n "Testing for libeufin-cli"
    167 if test $1 = 'fees' && libeufin-cli --version > /dev/null 2>/dev/null
    168 then
    169     echo " FOUND"
    170     IBAN_CREDIT=`anastasis-config -c $CONF_4 -s authorization-iban -o CREDIT_IBAN`
    171     CREDIT_BUSINESS_NAME=`anastasis-config -c $CONF_4 -s authorization-iban -o BUSINESS_NAME`
    172     echo -n "Setting up Nexus ..."
    173     export LIBEUFIN_NEXUS_DB_CONNECTION="postgres:///anastasischeck"
    174     export LIBEUFIN_SANDBOX_DB_CONNECTION="postgres:///anastasischeck"
    175     export NEXUS_URL="http://localhost:5001/"
    176     export SANDBOX_URL="http://localhost:5000/"
    177     libeufin-nexus serve &> nexus.log &
    178     nexus_pid=$!
    179     if ! curl -s --retry 5 --retry-connrefused $NEXUS_URL > /dev/null; then
    180         exit_skip "Could not launch Nexus"
    181     fi
    182     echo -n "."
    183     libeufin-sandbox serve --no-auth &> sandbox.log &
    184     sandbox_pid=$!
    185     if ! curl -s --retry 5 --retry-connrefused $SANDBOX_URL > /dev/null; then
    186         exit_skip "Could not launch Sandbox"
    187     fi
    188     export EBICS_HOST="ebicstesthost"
    189     export IBAN_DEBIT="FR1420041010050500013M02606"
    190     echo "OK"
    191 
    192     echo -n "Preparing Sandbox ..."
    193     libeufin-cli \
    194         sandbox --sandbox-url=$SANDBOX_URL \
    195         ebicshost create \
    196         --host-id=$EBICS_HOST
    197     echo " OK"
    198 
    199     export PERSON_CREDIT_NAME="Person Credit"
    200     echo -n "Preparing accounts ..."
    201     # note: Ebisc schema doesn't allow dashed names.
    202     prepare_sandbox_account \
    203         ebicsuserCredit \
    204         ebicspartnerCredit \
    205         "${PERSON_CREDIT_NAME}" \
    206         sandbox-account-credit \
    207         $IBAN_CREDIT
    208     prepare_sandbox_account \
    209         ebicsuserDebit \
    210         ebicspartnerDebit \
    211         "Person Debit" \
    212         sandbox-account-debit \
    213         $IBAN_DEBIT
    214     echo "Sandbox preparation done"
    215 
    216     echo -n "Preparing Nexus ..."
    217     export LIBEUFIN_NEXUS_URL=$NEXUS_URL
    218     # Make debit user, will buy Anastasis services.
    219     export DEBIT_USERNAME=anastasis-debit-user
    220     export DEBIT_PASSWORD=anastasis-debit-password
    221     libeufin-nexus superuser $DEBIT_USERNAME --password=$DEBIT_PASSWORD
    222     echo " OK"
    223     export LIBEUFIN_NEXUS_USERNAME=$DEBIT_USERNAME
    224     export LIBEUFIN_NEXUS_PASSWORD=$DEBIT_PASSWORD
    225 
    226     prepare_nexus_account \
    227         ebicsuserDebit \
    228         ebicspartnerDebit \
    229         bankconnection-debit \
    230         nexus-bankaccount-debit \
    231         sandbox-account-debit
    232 
    233     # Make credit user, will be Anastasis client.
    234     export CREDIT_USERNAME=anastasis-credit-user
    235     export CREDIT_PASSWORD=anastasis-credit-password
    236     echo -n "Create credit user (for anastasis) at Nexus ..."
    237     libeufin-nexus superuser $CREDIT_USERNAME --password=$CREDIT_PASSWORD
    238     echo " OK"
    239     export LIBEUFIN_NEXUS_USERNAME=$CREDIT_USERNAME
    240     export LIBEUFIN_NEXUS_PASSWORD=$CREDIT_PASSWORD
    241 
    242     prepare_nexus_account \
    243         ebicsuserCredit \
    244         ebicspartnerCredit \
    245         bankconnection-credit \
    246         nexus-bankaccount-credit \
    247         sandbox-account-credit
    248 
    249     echo -n "Create facade ..."
    250     libeufin-cli facades new-anastasis-facade \
    251                  --currency="EUR" \
    252                  --facade-name=facade-credit \
    253                  bankconnection-credit nexus-bankaccount-credit
    254     echo " OK"
    255     export FACADE_URL=$(libeufin-cli facades list | jq .facades[0].baseUrl | tr -d \")
    256 
    257     ## Reach facade with: $FACADE_URL + $CREDIT_USERNAME + $CREDIT_PASSWORD
    258 
    259     echo -n "Configuring Anastasis IBAN account ..."
    260     anastasis-config -c $CONF_4 \
    261                      -s authorization-iban \
    262                      -o CREDIT_IBAN \
    263                      -V "${IBAN_CREDIT}"
    264     anastasis-config -c $CONF_4 \
    265                      -s authorization-iban \
    266                      -o BUSINESS_NAME \
    267                      -V "${PERSON_CREDIT_NAME}"
    268     anastasis-config -c $CONF_4 \
    269                      -s authorization-iban \
    270                      -o WIRE_GATEWAY_URL \
    271                      -V "${FACADE_URL}"
    272     anastasis-config -c $CONF_4 \
    273                      -s authorization-iban \
    274                      -o WIRE_GATEWAY_AUTH_METHOD \
    275                      -V "basic"
    276     anastasis-config -c $CONF_4 \
    277                      -s authorization-iban \
    278                      -o USERNAME \
    279                      -V "${LIBEUFIN_NEXUS_USERNAME}"
    280     anastasis-config -c $CONF_4 \
    281                      -s authorization-iban \
    282                      -o PASSWORD \
    283                      -V "${LIBEUFIN_NEXUS_PASSWORD}"
    284     anastasis-config -c $CONF_4 \
    285                      -s authorization-iban \
    286                      -o ENABLED \
    287                      -V YES
    288     echo " OK"
    289     IBAN_ACTIVE='true'
    290 else
    291     echo " NOT FOUND (IBAN authentication not supported)"
    292     anastasis-config -c $CONF_4 \
    293                      -s authorization-iban \
    294                      -o ENABLED \
    295                      -V NO
    296 fi
    297 
    298 
    299 echo -n "Testing for anastasis-httpd"
    300 anastasis-httpd -h >/dev/null </dev/null || exit_skip " MISSING"
    301 echo " FOUND"
    302 
    303 echo -n "Initialize anastasis database ..."
    304 # Name of the Postgres database we will use for the script.
    305 # Will be dropped, do NOT use anything that might be used
    306 # elsewhere
    307 TARGET_DB_1=`anastasis-config -c $CONF_1 -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///"`
    308 TARGET_DB_2=`anastasis-config -c $CONF_2 -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///"`
    309 TARGET_DB_3=`anastasis-config -c $CONF_3 -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///"`
    310 TARGET_DB_4=`anastasis-config -c $CONF_4 -s stasis-postgres -o CONFIG | sed -e "s/^postgres:\/\/\///"`
    311 
    312 dropdb $TARGET_DB_1 >/dev/null 2>/dev/null || true
    313 createdb $TARGET_DB_1 || exit_skip "Could not create database $TARGET_DB_1"
    314 anastasis-dbinit -c $CONF_1 2> anastasis-dbinit_1.log
    315 dropdb $TARGET_DB_2 >/dev/null 2>/dev/null || true
    316 createdb $TARGET_DB_2 || exit_skip "Could not create database $TARGET_DB_2"
    317 anastasis-dbinit -c $CONF_2 2> anastasis-dbinit_2.log
    318 dropdb $TARGET_DB_3 >/dev/null 2>/dev/null || true
    319 createdb $TARGET_DB_3 || exit_skip "Could not create database $TARGET_DB_3"
    320 anastasis-dbinit -c $CONF_3 2> anastasis-dbinit_3.log
    321 dropdb $TARGET_DB_4 >/dev/null 2>/dev/null || true
    322 createdb $TARGET_DB_4 || exit_skip "Could not create database $TARGET_DB_4"
    323 anastasis-dbinit -c $CONF_4 2> anastasis-dbinit_4.log
    324 
    325 echo " OK"
    326 
    327 if test $1 = 'fees'
    328 then
    329 
    330     echo -n "Generating Taler auditor, exchange and merchant configurations ..."
    331 
    332     DATA_DIR=`taler-config -f -c $CONF -s PATHS -o TALER_HOME`
    333     rm -rf $DATA_DIR
    334 
    335     # obtain key configuration data
    336     MASTER_PRIV_FILE=`taler-config -f -c $CONF -s EXCHANGE-OFFLINE -o MASTER_PRIV_FILE`
    337     MASTER_PRIV_DIR=`dirname $MASTER_PRIV_FILE`
    338     mkdir -p $MASTER_PRIV_DIR
    339     gnunet-ecc -g1 $MASTER_PRIV_FILE > /dev/null 2> /dev/null
    340     MASTER_PUB=`gnunet-ecc -p $MASTER_PRIV_FILE`
    341     EXCHANGE_URL=`taler-config -c $CONF -s EXCHANGE -o BASE_URL`
    342     MERCHANT_PORT=`taler-config -c $CONF -s MERCHANT -o PORT`
    343     MERCHANT_URL=http://localhost:${MERCHANT_PORT}/
    344     BANK_PORT=`taler-config -c $CONF -s BANK -o HTTP_PORT`
    345     BANK_URL=http://localhost:${BANK_PORT}/
    346     AUDITOR_URL=http://localhost:8083/
    347     AUDITOR_PRIV_FILE=`taler-config -f -c $CONF -s AUDITOR -o AUDITOR_PRIV_FILE`
    348     AUDITOR_PRIV_DIR=`dirname $AUDITOR_PRIV_FILE`
    349     mkdir -p $AUDITOR_PRIV_DIR
    350     gnunet-ecc -g1 $AUDITOR_PRIV_FILE > /dev/null 2> /dev/null
    351     AUDITOR_PUB=`gnunet-ecc -p $AUDITOR_PRIV_FILE`
    352 
    353     # patch configuration
    354     TALER_DB=talercheck
    355     taler-config -c $CONF -s exchange -o MASTER_PUBLIC_KEY -V $MASTER_PUB
    356     taler-config -c $CONF -s merchant-exchange-default -o MASTER_KEY -V $MASTER_PUB
    357     taler-config -c $CONF -s exchangedb-postgres -o CONFIG -V postgres:///$TALER_DB
    358     taler-config -c $CONF -s auditordb-postgres -o CONFIG -V postgres:///$TALER_DB
    359     taler-config -c $CONF -s merchantdb-postgres -o CONFIG -V postgres:///$TALER_DB
    360     taler-config -c $CONF -s bank -o database -V postgres:///$TALER_DB
    361     taler-config -c $CONF -s exchange -o KEYDIR -V "${TMP_DIR}/keydir/"
    362     taler-config -c $CONF -s exchange -o REVOCATION_DIR -V "${TMP_DIR}/revdir/"
    363 
    364     echo " OK"
    365 
    366     echo -n "Setting up exchange ..."
    367 
    368     # reset database
    369     dropdb $TALER_DB >/dev/null 2>/dev/null || true
    370     createdb $TALER_DB || exit_skip "Could not create database $TALER_DB"
    371     taler-exchange-dbinit -c $CONF
    372     taler-merchant-dbinit -c $CONF
    373     taler-auditor-dbinit -c $CONF
    374     taler-auditor-exchange -c $CONF -m $MASTER_PUB -u $EXCHANGE_URL
    375 
    376     echo " OK"
    377 
    378     # Launch services
    379     echo -n "Launching taler services ..."
    380     taler-bank-manage-testing $CONF postgres:///$TALER_DB serve > taler-bank.log 2> taler-bank.err &
    381     taler-exchange-secmod-eddsa -c $CONF 2> taler-exchange-secmod-eddsa.log &
    382     taler-exchange-secmod-rsa -c $CONF 2> taler-exchange-secmod-rsa.log &
    383     taler-exchange-secmod-cs -c $CONF 2> taler-exchange-secmod-cs.log &
    384     taler-exchange-httpd -c $CONF 2> taler-exchange-httpd.log &
    385     taler-merchant-httpd -c $CONF -L INFO 2> taler-merchant-httpd.log &
    386     taler-exchange-wirewatch -c $CONF 2> taler-exchange-wirewatch.log &
    387     taler-auditor-httpd -L INFO -c $CONF 2> taler-auditor-httpd.log &
    388 
    389     echo " OK"
    390 
    391 fi
    392 
    393 
    394 echo -n "Launching anastasis services ..."
    395 # PREFIX="valgrind --log-file=anastasis-httpd.%p.log"
    396 PREFIX=""
    397 $PREFIX anastasis-httpd -L INFO -c $CONF_1 2> anastasis-httpd_1.log &
    398 PPID_1=$!
    399 $PREFIX anastasis-httpd -L INFO -c $CONF_2 2> anastasis-httpd_2.log &
    400 PPID_2=$!
    401 $PREFIX anastasis-httpd -L INFO -c $CONF_3 2> anastasis-httpd_3.log &
    402 PPID_3=$!
    403 $PREFIX anastasis-httpd -L INFO -c $CONF_4 2> anastasis-httpd_4.log &
    404 PPID_4=$!
    405 export PPID_1
    406 export PPID_2
    407 export PPID_3
    408 export PPID_4
    409 
    410 if test $1 = 'fees'
    411 then
    412 
    413     # Wait for bank to be available (usually the slowest)
    414     for n in `seq 1 50`
    415     do
    416         echo -n "."
    417         sleep 0.2
    418         OK=0
    419         # bank
    420         wget --tries=1 --timeout=1 http://localhost:8082/ -o /dev/null -O /dev/null >/dev/null || continue
    421         OK=1
    422         break
    423     done
    424 
    425     if [ 1 != $OK ]
    426     then
    427         exit_skip "Failed to launch services (bank)"
    428     fi
    429 
    430     # Wait for all other taler services to be available
    431     for n in `seq 1 50`
    432     do
    433         echo -n "."
    434         sleep 0.1
    435         OK=0
    436         # exchange
    437         wget --tries=1 --timeout=1 http://localhost:8081/seed -o /dev/null -O /dev/null >/dev/null || continue
    438         # merchant
    439         wget --tries=1 --timeout=1 http://localhost:9966/ -o /dev/null -O /dev/null >/dev/null || continue
    440         # auditor
    441         wget --tries=1 --timeout=1 http://localhost:8083/ -o /dev/null -O /dev/null >/dev/null || continue
    442         OK=1
    443         break
    444     done
    445 
    446     if [ 1 != $OK ]
    447     then
    448         exit_skip "Failed to launch taler services"
    449     fi
    450 
    451     echo "OK"
    452 
    453     echo -n "Setting up keys ..."
    454     taler-exchange-offline -c $CONF \
    455       download \
    456       sign \
    457       enable-account payto://x-taler-bank/localhost/Exchange \
    458       enable-auditor $AUDITOR_PUB $AUDITOR_URL "TESTKUDOS Auditor" \
    459       wire-fee now x-taler-bank TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 \
    460       global-fee now TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 TESTKUDOS:0.01 1h 1h 1year 5 \
    461       upload &> taler-exchange-offline.log
    462 
    463     echo -n "."
    464 
    465     for n in `seq 1 3`
    466     do
    467         echo -n "."
    468         OK=0
    469         wget --tries=1 --timeout=1 http://localhost:8081/keys -o /dev/null -O /dev/null >/dev/null || continue
    470         OK=1
    471         break
    472     done
    473 
    474     if [ 1 != $OK ]
    475     then
    476         exit_skip "Failed to setup keys"
    477     fi
    478 
    479     echo " OK"
    480 
    481     echo -n "Setting up auditor signatures ..."
    482     taler-auditor-offline -c $CONF \
    483                           download sign upload &> taler-auditor-offline.log
    484     echo " OK"
    485 
    486 fi
    487 echo " OK"
    488 
    489 echo -n "Waiting for anastasis services ..."
    490 
    491 # Wait for anastasis services to be available
    492 for n in `seq 1 50`
    493 do
    494     echo -n "."
    495     sleep 0.1
    496     OK=0
    497    # anastasis_01
    498     wget --tries=1 --timeout=1 http://localhost:8086/ -o /dev/null -O /dev/null >/dev/null || continue
    499     # anastasis_02
    500     wget --tries=1 --timeout=1 http://localhost:8087/ -o /dev/null -O /dev/null >/dev/null || continue
    501     # anastasis_03
    502     wget --tries=1 --timeout=1 http://localhost:8088/ -o /dev/null -O /dev/null >/dev/null || continue
    503     # anastasis_04
    504     wget --tries=1 --timeout=1 http://localhost:8089/ -o /dev/null -O /dev/null >/dev/null || continue
    505     OK=1
    506     break
    507 done
    508 
    509 if [ 1 != $OK ]
    510 then
    511     exit_skip "Failed to launch anastasis services"
    512 fi
    513 echo "OK"
    514 
    515 if test $1 = 'fees'
    516 then
    517 
    518     echo -n "Configuring merchant instance ..."
    519     # Setup merchant
    520 
    521     curl -H "Content-Type: application/json" -X POST -d '{"auth":{"method":"external"},"id":"admin","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" : 3600000},"default_pay_delay":{"d_ms": 3600000}}' http://localhost:9966/management/instances
    522 
    523     curl -H "Content-Type: application/json" -X POST -d '{"payto_uri":"payto://x-taler-bank/localhost/43"}' http://localhost:9966/private/accounts
    524     
    525     echo " OK"
    526 
    527     echo -n "Preparing wallet"
    528     rm $WALLET_DB
    529     taler-wallet-cli --no-throttle --wallet-db=$WALLET_DB api 'withdrawTestBalance' \
    530                      "$(jq -n '
    531     {
    532         amount: "TESTKUDOS:100",
    533         bankBaseUrl: $BANK_URL,
    534         exchangeBaseUrl: $EXCHANGE_URL
    535     }' \
    536     --arg BANK_URL "$BANK_URL" \
    537     --arg EXCHANGE_URL "$EXCHANGE_URL"
    538   )" 2> /dev/null >/dev/null
    539     taler-wallet-cli --wallet-db=$WALLET_DB run-until-done 2>/dev/null >/dev/null
    540     echo " OK"
    541 
    542 fi
    543 
    544 export -f wire_transfer_to_anastasis
    545 
    546 echo "You can now run anastasis-gtk in TESTLAND."
    547 echo " "
    548 echo "We will now start a sub-shell. Please note:"
    549 echo '- to terminate the test environment by leaving the sub-shell use: exit'
    550 if test $IBAN_ACTIVE = 'true'
    551 then
    552     echo '- for IBAN authentication use: wire_transfer_to_anastasis "$AMOUNT" "$SUBJECT"'
    553     echo "- for your customer IBAN, use: ${IBAN_DEBIT}"
    554 fi
    555 if test $1 = 'fees'
    556 then
    557     echo '- to pay, use: taler-wallet-cli --wallet-db=$WALLET_DB handle-uri $PAY_URI -y'
    558     export WALLET_DB
    559 fi
    560 
    561 echo '- use kill -SIGSTOP $PPID_$NUM ($NUM: 1-4) to suspend providers'
    562 
    563 bash
    564 
    565 exit 0