summaryrefslogtreecommitdiff
path: root/bin/taler-deployment-top-reserve
blob: f4d2ed185f7803049aebb74c657e01b5ef6d66a7 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash

if test -z $TALER_ENV_NAME || test -z $TALER_CONFIG_CURRENCY; then
  echo "Please source ~/activate"
  exit 1
fi

# %N is current nanoseconds.
UUID=$(date +"uuid-%N")

RESERVE=$(gnunet-ecc -p $( \
  printf "%s%s" \
    $(taler-config -s PATHS -o TALER_DEPLOYMENT_SHARED -f) \
    /merchant/default-tip.priv))

taler-bank-transfer \
  --amount="$TALER_CONFIG_CURRENCY:100.00" \
  --bank="https://bank.$TALER_ENV_NAME.taler.net/" \
  --credit=2 \
  --debit=8 \
  --log="INFO" \
  --pass="x" \
  --subject=$RESERVE \
  --user="Survey"

if ! test 0 = $?; then
  echo Wire transfering failed!
  exit 1
fi

# note: account number (7) is hardcoded, as tipping
# is only being tested against the 'default' instance.

taler-merchant-tip-enable \
  --amount="$TALER_CONFIG_CURRENCY:100.00" \
  --backend="http://backend.$TALER_ENV_NAME.taler.net/" \
  --credit-uuid=$UUID \
  --instance=default \
  --expiration=$(date --date="2 weeks" +"%Y-%m-%d")

if ! test 0 = $?; then
  echo Enabling the tip reserve failed!
  exit 1
fi