diff options
author | MS <ms@taler.net> | 2023-12-11 19:57:47 +0100 |
---|---|---|
committer | MS <ms@taler.net> | 2023-12-11 19:57:47 +0100 |
commit | 579d93541d44ef63ef036c565d7626c76cd80d8b (patch) | |
tree | efb6cf61bfdfc10a1e861a23e4cf47934f80ff3c /regional-currency/withdraw.sh | |
parent | 29918880f335aff089a91b52716e24cea1199c9d (diff) | |
download | deployment-579d93541d44ef63ef036c565d7626c76cd80d8b.tar.gz deployment-579d93541d44ef63ef036c565d7626c76cd80d8b.tar.bz2 deployment-579d93541d44ef63ef036c565d7626c76cd80d8b.zip |
regional setup: rename to address any currency
Diffstat (limited to 'regional-currency/withdraw.sh')
-rwxr-xr-x | regional-currency/withdraw.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/regional-currency/withdraw.sh b/regional-currency/withdraw.sh new file mode 100755 index 0000000..850d343 --- /dev/null +++ b/regional-currency/withdraw.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +if test "$1" = "--help" || test "$1" = "-h"; then + echo "./withdraw [RESERVE_PUB]" + echo + echo "Injects one incoming CHF payment into nexus database" + echo "in order to trigger a Taler withdrawal. The reserve" + echo "pub can be passed either as the first parameter, or" + echo "it'll be generated by the CLI wallet. In both cases," + echo "the exchange to withdraw from is \$PROTO://exchange.\$DOMAIN" + + exit 0 +fi + +RESERVE_PUB="$1" # maybe passed +set -eu + +. config/user.conf # DOMAIN_NAME & CURRENCY +. config/internal.conf # PROTO + +NEXUS_CONFIG_FILE=/etc/libeufin/libeufin-nexus.conf +if test -z "$RESERVE_PUB"; then + RESERVE_PUB=$(taler-wallet-cli \ + api 'acceptManualWithdrawal' \ + '{"exchangeBaseUrl":"'${PROTO}'://exchange.'$DOMAIN_NAME'", + "amount":"'$CURRENCY':5" + }' | jq -r .result.reservePub) +fi +DEBTOR_IBAN="CH8389144317421994586" +CAMT_054=$(sed \ + -e "s/RESERVE_PUB/$RESERVE_PUB/" \ + -e "s/BANK_ID/$(uuidgen | cut -c-34)/" \ + -e "s/DEBTOR_IBAN/$DEBTOR_IBAN/" \ + incoming_template.xml) + +echo "$CAMT_054" | sudo -i -u libeufin-nexus \ + libeufin-nexus ebics-fetch -c $NEXUS_CONFIG_FILE --import + +taler-wallet-cli run-until-done |