withdraw.sh (1145B)
1 #!/bin/bash 2 3 if test "$1" = "--help" || test "$1" = "-h"; then 4 echo "./withdraw [RESERVE_PUB]" 5 echo 6 echo "Injects one incoming CHF payment into nexus database" 7 echo "in order to trigger a Taler withdrawal. The reserve" 8 echo "pub can be passed either as the first parameter, or" 9 echo "it'll be generated by the CLI wallet. In both cases," 10 echo "the exchange to withdraw from is \$PROTO://exchange.\$DOMAIN" 11 12 exit 0 13 fi 14 15 RESERVE_PUB="$1" # maybe passed 16 set -eu 17 18 . config/user.conf 19 20 # TODO remove --wallet-db=db.json when taler-wallet-cli & sqlite3 is supported on ARM 21 22 NEXUS_CONFIG_FILE=/etc/libeufin/libeufin-nexus.conf 23 if test -z "$RESERVE_PUB"; then 24 RESERVE_PUB=$(taler-wallet-cli --wallet-db=db.json \ 25 api 'acceptManualWithdrawal' \ 26 '{"exchangeBaseUrl":"'${PROTO}'://exchange.'$DOMAIN_NAME'/", 27 "amount":"'$CURRENCY':5" 28 }' | jq -r .result.reservePub) 29 fi 30 DEBTOR_IBAN="CH8389144317421994586" 31 sudo -i -u libeufin-nexus libeufin-nexus testing fake-incoming -L DEBUG --subject "$RESERVE_PUB" --amount "$FIAT_CURRENCY:5" "payto://iban/$DEBTOR_IBAN" 32 33 taler-wallet-cli --wallet-db=db.json run-until-done