#!/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