summaryrefslogtreecommitdiff
path: root/bin/taler-deployment-top-reserve
blob: cfc00569a8c8ad7abcfe0a82f59a36c6b76db8c1 (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
#!/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")

# Obtain reserve public key from file
RESERVE=`gnunet-ecc -P ${TALER_DEPLOYMENT_SHARED}/merchant/default.priv`

# Tell the exchange about the 'incoming' wire transfer
# (TODO: shouldn't we rather tell the *bank* (bank/admin/add/incoming)
#  to execute the wire transfer, and have the bank tell the exchange?
#  This ought to cause the wire auditor to fail!)
taler-exchange-reservemod \
  --add="$TALER_CONFIG_CURRENCY:100.0" \
  --reserve=$RESERVE \
  --sender='{"bank_uri":"https://bank.$TALER_ENV_NAME.taler.net/","account_number":7,"type":"test"}' \
  --transfer="{\"uuid\":\"$UUID\"}"

if ! test 0 = $?; then
  echo Topping reserve 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")