gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [taler-exchange] branch master updated: update configuratio


From: gnunet
Subject: [GNUnet-SVN] [taler-exchange] branch master updated: update configuration generators to use new ENABLE option instead of WIREFORMATS, and to support wire fee generation
Date: Fri, 03 Mar 2017 19:43:28 +0100

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 243d8d1  update configuration generators to use new ENABLE option 
instead of WIREFORMATS, and to support wire fee generation
243d8d1 is described below

commit 243d8d18b1ea27a1160bc27a7334b41e87564257
Author: Christian Grothoff <address@hidden>
AuthorDate: Fri Mar 3 19:43:26 2017 +0100

    update configuration generators to use new ENABLE option instead of 
WIREFORMATS, and to support wire fee generation
---
 .../exchange-template/config/exchange-common.conf  | 19 +++---
 doc/taler-config-generate.1                        |  5 +-
 doc/taler.conf.5                                   |  8 +--
 src/exchange/taler-config-generate                 | 72 +++++++++++++++-------
 4 files changed, 68 insertions(+), 36 deletions(-)

diff --git a/contrib/exchange-template/config/exchange-common.conf 
b/contrib/exchange-template/config/exchange-common.conf
index eddde3c..d513b35 100644
--- a/contrib/exchange-template/config/exchange-common.conf
+++ b/contrib/exchange-template/config/exchange-common.conf
@@ -2,10 +2,6 @@
 # Currency supported by the exchange (can only be one)
 CURRENCY = EUR
 
-# Wire format supported by the exchange, case-insensitive.
-# Examples for formats include 'test' for testing and 'sepa' (for EU IBAN).
-WIREFORMAT = SEPA
-
 # HTTP port the exchange listens to
 PORT = 4241
 
@@ -21,21 +17,28 @@ TESTRUN = YES
 [exchangedb-postgres]
 DB_CONN_STR = "postgres:///talercheck"
 
-[wire-incoming-sepa]
+
+[exchange-wire-sepa]
+# Change here to enable SEPA wire transfers.
+ENABLE = NO
+
+[exchange-wire-incoming-sepa]
 SEPA_RESPONSE_FILE = "sepa.json"
 
-[wire-outgoing-sepa]
+[exchange-wire-outgoing-sepa]
 SEPA_RESPONSE_FILE = "sepa.json"
 
+[exchange-wire-sepa]
+ENABLE = YES
 
-[wire-incoming-test]
+[exchange-wire-incoming-test]
 # What is the main website of the bank?
 BANK_URI = "https://bank/";
 # Into which account at the 'bank' should incoming
 # wire transfers be made?
 BANK_ACCOUNT_NUMBER = 2
 
-[wire-outgoing-test]
+[exchange-wire-outgoing-test]
 # What is the main website of the bank?
 BANK_URI = "https://bank/";
 # From which account at the 'bank' should outgoing
diff --git a/doc/taler-config-generate.1 b/doc/taler-config-generate.1
index 7f69e55..8a72cdd 100644
--- a/doc/taler-config-generate.1
+++ b/doc/taler-config-generate.1
@@ -1,7 +1,7 @@
 .TH TALER\-CONFIG\-GENERATE 1 "May 5, 2016" "GNU Taler"
 
 .SH NAME
-taler\-config\-generate \- tool to simplfy Taler configuration generation
+taler\-config\-generate \- tool to simplify Taler configuration generation
 
 .SH SYNOPSIS
 .B taler\-config\-generate
@@ -22,6 +22,9 @@ Which currency should we use in the configuration.
 .IP "\-e, \-\-exchange"
 Generate configuration for a Taler exchange.
 .B
+.IP "\-f AMOUNT, \-\-wirefee=AMOUNT"
+Setup wire transfer fees for the next 5 years for the exchange (for all wire 
methods).
+.B
 .IP "\-m, \-\-merchant"
 Generate configuration for a Taler merchant.
 .B
diff --git a/doc/taler.conf.5 b/doc/taler.conf.5
index 6e50c69..40a9506 100644
--- a/doc/taler.conf.5
+++ b/doc/taler.conf.5
@@ -16,8 +16,6 @@ The following options are from the "[exchange]" section and 
used by most exchang
 
 .IP CURRENCY
     Name of the currency, i.e. "EUR" for Euro.
-.IP WIREFORMAT
-    Format used for wire transfers to the merchant, i.e. "SEPA".
 .IP DB
     Plugin to use for the database, i.e. "postgres"
 .IP PORT
@@ -28,7 +26,8 @@ The following options are from the "[exchange]" section and 
used by most exchang
 
 .SH WIRE transfer details
 
-The following options must be in section "[wire\-incoming\-test]" and 
"[wire\-outgoing\-test]":
+To enable the "test" wire transfer method, you must set "ENABLE = YES" in 
"[exchange\-wire\-test]".
+Then, the following options must be in section 
"[exchange\-wire\-incoming\-test]" and "[exchange\-wire\-outgoing\-test]":
 
 .IP BANK_URI
     URL of the Taler bank.
@@ -36,7 +35,8 @@ The following options must be in section 
"[wire\-incoming\-test]" and "[wire\-ou
 .IP BANK_ACCOUNT_NUMBER
     Number of the bank account of the exchange.
 
-The following options must be in section "[wire\-incoming\-sepa]" and 
"[wire\-outgoing\-sepa]":
+To enable the "sepa" wire transfer method, you must set "ENABLE = YES" in 
"[exchange\-wire\-sepa]".
+Then, the following options must be in section 
"[exchange\-wire\-incoming\-sepa]" and "[exchange\-wire\-outgoing\-sepa]":
 
 .IP SEPA_RESPONSE_FILE
     Filename with the JSON body for the /wire response, signed using the 
exchange\'s long-term offline master key.  Use taler\-exchange\-sepa to create 
the SEPA_RESPONSE_FILE.
diff --git a/src/exchange/taler-config-generate 
b/src/exchange/taler-config-generate
index cc77d47..b2e2229 100755
--- a/src/exchange/taler-config-generate
+++ b/src/exchange/taler-config-generate
@@ -6,6 +6,7 @@
 # -c FILENAME, --config=FILENAME (where to write config, defaults to 
~/.config/taler.conf)
 # -C CURRENCY, --currency=CURRENCY (name of the currency)
 # -e, --exchange (generate configuration for the exchange)
+# -f AMOUNT, --wirefee=AMOUNT (wire transfer fees charged to merchant, 
generated for next 5 years)
 # -j WIREJSON, --wire-json-merchant=WIREJSON (wire plugin details in JSON)
 # -J WIREJSON, --wire-json-exchange=WIREJSON (wire plugin details in JSON)
 # -m, --merchant (generate configuration for the merchant)
@@ -32,7 +33,7 @@ ARG_MERCHANT_BANK_ACCOUNT=
 
 ##################################
 # read the options
-TEMP=`getopt -o c:C:ehj:J:mtw: --long 
config:,currency:,exchange,help,wire-json-exchange:,wire-json-merchant:,merchant,trusted,wire:,bank-uri:,exchange-bank-account:,merchant-bank-account:
 -n 'taler-config-generate' -- "$@"`
+TEMP=`getopt -o c:C:ef:hj:J:mtw: --long 
config:,currency:,exchange,wirefee:,help,wire-json-exchange:,wire-json-merchant:,merchant,trusted,wire:,bank-uri:,exchange-bank-account:,merchant-bank-account:
 -n 'taler-config-generate' -- "$@"`
 eval set -- "$TEMP"
 
 ####################################################
@@ -48,6 +49,9 @@ while true ; do
         -e|--exchange)
             ARG_E=1
             shift ;;
+        -f|--wirefee)
+            ARG_WIRE_FEE="$2"
+            shift 2 ;;
         -h|--help)
             ARG_H=1
             shift ;;
@@ -172,33 +176,55 @@ then
 # Obtain public master key of exchange
   MASTER_PUB=`gnunet-ecc -p "$MASTER_KEY"`
 
-# Setup wire format
-  $CS -s exchange -o WIREFORMAT -V "$ARG_W" || exit 1
 # Setup master public key
   $CS -s exchange -o MASTER_PUBLIC_KEY -V "$MASTER_PUB" || exit 1
+
+# Setup wire transfer methods
+  for $WMETHOD in $ARG_W
+  do
+    $CS -s exchange-wire-$WMETHOD -o ENABLE -V YES || exit 1
+
 # If possible, initialize outgoing wire account details ('test' method only)
-  if (test "test" = "$ARG_W" -a ! -z "$ARG_BANK_URI")
-  then
-    $CS -s exchange-wire-outgoing-test -o BANK_URI -V "$ARG_BANK_URI" || exit 1
-  else
-    echo "Skipped generating outgoing wire account details for exchange"
-  fi
-  if (test "test" = "$ARG_W" -a ! -z "$ARG_EXCHANGE_BANK_ACCOUNT")
-  then
-    $CS -s exchange-wire-outgoing-test -o BANK_ACCOUNT_NUMBER -V 
"$ARG_EXCHANGE_BANK_ACCOUNT" || exit 1
-  else
-    echo "Skipped generating outgoing wire account details for exchange"
-  fi
+    if (test "test" = "$WMETHOD" -a ! -z "$ARG_BANK_URI")
+    then
+      $CS -s exchange-wire-outgoing-test -o BANK_URI -V "$ARG_BANK_URI" || 
exit 1
+    else
+      echo "Skipped generating outgoing wire account details for exchange"
+    fi
+    if (test "test" = "$ARG_W" -a ! -z "$ARG_EXCHANGE_BANK_ACCOUNT")
+    then
+      $CS -s exchange-wire-outgoing-test -o BANK_ACCOUNT_NUMBER -V 
"$ARG_EXCHANGE_BANK_ACCOUNT" || exit 1
+    else
+      echo "Skipped generating outgoing wire account details for exchange"
+    fi
+
 # If possible, initialize /wire response from JSON (with signature)
-  if (test ! -z $ARG_JE)
-  then
-    JSONF=`$CS -s exchange-wire-incoming-${ARG_W} -o ${ARG_W}_RESPONSE_FILE -f`
+    if (test ! -z $ARG_JE)
+    then
+      JSONF=`$CS -s exchange-wire-incoming-${ARG_W} -o ${ARG_W}_RESPONSE_FILE 
-f`
 #    echo "Generating /wire response at $JSONF"
-    mkdir -p `dirname $JSONF`
-    taler-exchange-wire -c "$ARG_CONFIG" -t "$ARG_W" -j "$ARG_JE" -m 
"$MASTER_KEY" -o "$JSONF" || exit 1
-  else
-    echo "Skipped generating /wire response for exchange"
-  fi
+      mkdir -p `dirname $JSONF`
+      taler-exchange-wire -c "$ARG_CONFIG" -t "$ARG_W" -j "$ARG_JE" -m 
"$MASTER_KEY" -o "$JSONF" || exit 1
+    else
+      echo "Skipped generating /wire response for exchange"
+    fi
+
+# Setup wire transfer fee structure.
+    if (test -z "$ARG_WIRE_FEE")
+    then
+      today=`date '+%Y'`
+      future=`expr $today + 5`
+      for YEAR in `seq $today $future`
+      do
+        $CS -s exchange-wire-$WMETHOD -o wire-fee-$YEAR -V $ARG_WIRE_FEE
+      done
+    else
+      echo "Skipped generating wire fee structure for exchange"
+    fi
+
+# End of for loop over all wire transfer methods
+  done
+
 else
   echo "Skipped exchange setup"
 fi

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]