diff options
-rwxr-xr-x | regional-currency/functions.sh | 13 | ||||
-rwxr-xr-x | regional-currency/setup-libeufin.sh | 22 |
2 files changed, 19 insertions, 16 deletions
diff --git a/regional-currency/functions.sh b/regional-currency/functions.sh index 9e18afd..875a064 100755 --- a/regional-currency/functions.sh +++ b/regional-currency/functions.sh @@ -84,11 +84,14 @@ function ask_questions() { read -r -p "- Enter a phone number to test your API key (e.g. '+447911123456'): " TELESIGN_PHONE TELESIGN_AUTH_TOKEN=$(echo "$TELESIGN_CUSTOMER_ID:$TELESIGN_API_KEY" | base64 -w 0) export AUTH_TOKEN=$TELESIGN_AUTH_TOKEN - RANDOM_CODE=$RANDOM - echo "$RANDOM_CODE" | libeufin-tan-sms.sh $TELESIGN_PHONE - read -r -s "- Enter the code received by $TELESIGN_PHONE : " TELESIGN_TEST_CODE - if test "${TELESIGN_TEST_CODE:-y}" != "$RANDOM_CODE"; then - say "Wrong code got '$TELESIGN_TEST_CODE' expected '$RANDOM_CODE', rerun this script to enter the right Telesign auth info" + if test -z "${TELESIGN_CODE:-}"; then + TELESIGN_CODE=$RANDOM + echo "TELESIGN_CODE=\"${TELESIGN_CODE}\"" >>config/internal.conf + fi + echo "$TELESIGN_CODE" | libeufin-tan-sms.sh $TELESIGN_PHONE + read -r -p "- Enter the code received by $TELESIGN_PHONE : " TELESIGN_TEST_CODE + if test "${TELESIGN_TEST_CODE:-y}" != "$TELESIGN_CODE"; then + say "Wrong code got '$TELESIGN_TEST_CODE' expected '$TELESIGN_CODE', rerun this script to enter the right Telesign auth info" exit 1 fi echo "TELESIGN_AUTH_TOKEN=\"${TELESIGN_AUTH_TOKEN}\"" >>config/user.conf diff --git a/regional-currency/setup-libeufin.sh b/regional-currency/setup-libeufin.sh index b62cc58..ba2bf5b 100755 --- a/regional-currency/setup-libeufin.sh +++ b/regional-currency/setup-libeufin.sh @@ -52,7 +52,7 @@ EOF if test -n "${TELESIGN_AUTH_TOKEN:-}"; then cat >>/etc/libeufin/libeufin-bank.conf <<EOF TAN_SMS=libeufin-tan-sms.sh -TAN_SMS_ENV="AUTH_TOKEN=$TELESIGN_AUTH_TOKEN" +TAN_SMS_ENV={"AUTH_TOKEN":"$TELESIGN_AUTH_TOKEN"} EOF fi @@ -106,16 +106,16 @@ curl -sS -u "admin:${BANK_ADMIN_PASSWORD}" \ ${PROTO}://bank.${DOMAIN_NAME}/conversion-info/conversion-rate \ --data-binary @- &>> setup.log << EOF { - "cashin_ratio": "1", - "cashin_fee": "${CURRENCY}:0", - "cashin_tiny_amount": "${CURRENCY}:0.01", - "cashin_rounding_mode": "nearest", - "cashin_min_amount": "${FIAT_CURRENCY}:1", - "cashout_ratio": "1", - "cashout_fee": "${FIAT_CURRENCY}:0", - "cashout_tiny_amount": "${FIAT_CURRENCY}:0.01", - "cashout_rounding_mode": "nearest", - "cashout_min_amount": "${CURRENCY}:1" + "cashin_ratio": "1", + "cashin_fee": "${CURRENCY}:0", + "cashin_tiny_amount": "${CURRENCY}:0.01", + "cashin_rounding_mode": "nearest", + "cashin_min_amount": "${FIAT_CURRENCY}:1", + "cashout_ratio": "1", + "cashout_fee": "${FIAT_CURRENCY}:0", + "cashout_tiny_amount": "${FIAT_CURRENCY}:0.01", + "cashout_rounding_mode": "nearest", + "cashout_min_amount": "${CURRENCY}:1" } EOF |