diff options
Diffstat (limited to 'netzbon/setup-merchants.sh')
-rwxr-xr-x | netzbon/setup-merchants.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/netzbon/setup-merchants.sh b/netzbon/setup-merchants.sh new file mode 100755 index 0000000..7fa1d3b --- /dev/null +++ b/netzbon/setup-merchants.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# This script is in the public domain. +# +# You must export +# +# export BASE_URL=e.netzbon-basel.ch +# export MERCHANT_TOKEN=password +# export BANK_TOKEN=password +# +# before running this script! +# +# Call with the JSON file (like test.json) with +# an array of merchants to set up as the first argument! +# +# FIXME: nice error handling is non-existent... +# +set -eu +LENGTH=$(jq length < $1) +echo "Setting up $LENGTH merchants at ${BASE_URL}" + +for n in $(seq 1 $LENGTH) +do + echo "Processing merchant $n" + INDEX=$(expr $n - 1 || true) + NAME=$(jq ".[$INDEX].name" < $1) + ID=$(jq .[$INDEX].id < $1) + PW=$(jq .[$INDEX].pass < $1) + + taler-harness deployment provision-bank-and-merchant \ + "merchant.${BASE_URL}" \ + "bank.${BASE_URL}" \ + "--merchant-management-token=${MERCHANT_TOKEN}" \ + "--bank-admin-token=${BANK_ADMIN_TOKEN}" \ + "--id=${ID}" \ + "--legal-name=${NAME}" \ + "--password=${PW}" + + echo "Done with ${ID}" +done |