summaryrefslogtreecommitdiff
path: root/regional-currency/withdraw.sh
blob: c0896e566dee294d17d8f4f7b5b45434c15e5657 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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 & FIAT_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"
sudo -i -u libeufin-nexus libeufin-nexus testing fake-incoming -L DEBUG --subject "$RESERVE_PUB" --amount "$FIAT_CURRENCY:5" "payto://iban/$DEBTOR_IBAN"

taler-wallet-cli run-until-done