[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [taler-merchant] branch master updated (d880b37 -> c2e039b)
From: |
gnunet |
Subject: |
[GNUnet-SVN] [taler-merchant] branch master updated (d880b37 -> c2e039b) |
Date: |
Sun, 15 Apr 2018 12:26:17 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a change to branch master
in repository merchant.
from d880b37 put twister tests behind --enable-experimental
new 0bf748c pre-merge changes towards #4939 patch
new 7c4621d Towards enabling multiple wire accounts per merchant.
new 202e130 fix more of config files, fix testing_api_helpers logic to
deal with merchant ports that are not 8082
new 84036f0 fix misc issues with tests after latest refactoring
new 9873cea get tests to pass (again)
new 490ff03 update manual to reflect current options
new afcdab4 update manual
new c2e039b fix possible test errors in configure.ac
The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
configure.ac | 9 +-
doc/manual.texi | 314 +++++++++------
src/backend/Makefile.am | 1 +
src/backend/merchant.conf | 23 +-
src/backend/taler-merchant-httpd.c | 448 +++++++++++++--------
src/backend/taler-merchant-httpd.h | 17 +-
src/backend/taler-merchant-httpd_auditors.c | 26 +-
src/backend/taler-merchant-httpd_exchanges.c | 103 ++++-
src/backend/taler-merchant-httpd_track-transfer.c | 4 +-
src/backenddb/test_merchantdb.c | 4 +-
src/lib/Makefile.am | 3 +-
src/lib/test_merchant_api.c | 74 ++--
src/lib/test_merchant_api.conf | 205 ++++++----
.../.config/taler/exchange/account-2.json | 5 +
.../.config/taler/merchant/account-3.json | 1 +
.../.config/taler/merchant/default.priv | 1 +
.../.config/taler/merchant/dtip.priv | 1 +
.../.config/taler/merchant/reserve/dtip.priv | Bin 0 -> 32 bytes
.../.config/taler/merchant/reserve/tip.priv | 1 +
.../.config/taler/merchant/tip.priv | 1 +
.../.config/taler/merchant/tor.priv | 1 +
.../.local/share/taler/merchant/merchant.priv | 1 +
src/lib/test_merchant_api_new.c | 74 ++--
src/lib/test_merchant_api_proxy_merchant.conf | 2 +-
src/lib/test_merchant_api_twisted.c | 29 +-
src/lib/test_merchant_api_twisted.conf | 221 +---------
src/lib/testing_api_cmd_track.c | 6 +-
src/lib/testing_api_helpers.c | 77 ++--
.../taler-merchant-generate-payments.c | 1 -
29 files changed, 912 insertions(+), 741 deletions(-)
create mode 100644
src/lib/test_merchant_api_home/.config/taler/exchange/account-2.json
create mode 100644
src/lib/test_merchant_api_home/.config/taler/merchant/account-3.json
create mode 100644
src/lib/test_merchant_api_home/.config/taler/merchant/default.priv
create mode 100644
src/lib/test_merchant_api_home/.config/taler/merchant/dtip.priv
create mode 100644
src/lib/test_merchant_api_home/.config/taler/merchant/reserve/dtip.priv
create mode 100644
src/lib/test_merchant_api_home/.config/taler/merchant/reserve/tip.priv
create mode 100644
src/lib/test_merchant_api_home/.config/taler/merchant/tip.priv
create mode 100644
src/lib/test_merchant_api_home/.config/taler/merchant/tor.priv
create mode 100644
src/lib/test_merchant_api_home/.local/share/taler/merchant/merchant.priv
diff --git a/configure.ac b/configure.ac
index fc046d8..5fee56d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,7 @@ AC_ARG_ENABLE([only-doc],
AC_MSG_RESULT($doc_only)
AM_CONDITIONAL([DOC_ONLY], [test "$doc_only" = "yes"])
-if test "$doc_only" != yes
+if test "x$doc_only" != xyes
then
@@ -74,7 +74,8 @@ AS_IF([test $libgnunetutil != 1],
# test for postgres
AX_LIB_POSTGRESQL([9.3])
-if test "$found_postgresql" = "yes"; then
+if test "x$found_postgresql" = "xyes"
+then
postgres=true
fi
AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue)
@@ -164,7 +165,7 @@ PKG_CHECK_MODULES([JANSSON], [jansson >= 2.3],
# check for libgnurl
# libgnurl
LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0)
-if test "$gnurl" = 1
+if test "x$gnurl" = x1
then
AM_CONDITIONAL(HAVE_LIBGNURL, true)
AC_DEFINE([HAVE_LIBGNURL],[1],[Have libgnurl])
@@ -187,7 +188,7 @@ fi
if test x$curl = xfalse
then
AM_CONDITIONAL(HAVE_LIBCURL, false)
-if test "$gnurl" = 0
+if test "x$gnurl" = "x0"
then
AC_MSG_WARN([GNUnet requires libcurl-gnutls >= 7.34])
fi
diff --git a/doc/manual.texi b/doc/manual.texi
index 677f7de..0fabb69 100644
--- a/doc/manual.texi
+++ b/doc/manual.texi
@@ -363,10 +363,6 @@ GNUnet to @code{/usr/local} in the previous steps.
@c This section has not yet been written.
address@hidden @node Installing Taler using Docker
address@hidden @section Installing Taler using Docker
-
address@hidden This section has not yet been written.
@node Installing Taler on Debian GNU/Linux
@@ -445,7 +441,6 @@ Debian wheezy instructions above, you need to pass
@c This section has not yet been written.
-
@node Configuration
@chapter How to configure the merchant's backend
@@ -478,14 +473,14 @@ The following option sets the transport layer address
used by the merchant backe
@cindex UNIX domain socket
@cindex TCP
@example
-[merchant]/serve = TCP | UNIX
+[MERCHANT]/SERVE = TCP | UNIX
@end example
If given,
@itemize
address@hidden @code{TCP}, then we need to set the TCP port in
@code{[merchant]/port}
address@hidden @code{TCP}, then we need to set the TCP port in
@code{[MERCHANT]/PORT}
@item @code{UNIX}, then we need to set the unix domain socket path and mode in
address@hidden/unixpath} and @code{[merchant]/unixpath_mode}. The latter takes
address@hidden/UNIXPATH} and @code{[MERCHANT]/UNIXPATH_MODE}. The latter takes
the usual permission mask given as a number, e.g. 660 for user/group
read-write access.
@end itemize
@@ -499,8 +494,8 @@ to the network.
@cindex port
To run the Taler backend on TCP port 8888, use:
@example
-$ taler-config -s merchant -o serve -V TCP
-$ taler-config -s merchant -o port -V 8888
+$ taler-config -s MERCHANT -o SERVE -V TCP
+$ taler-config -s MERCHANT -o PORT -V 8888
@end example
@@ -510,23 +505,24 @@ Which currency the Web shop deals in, i.e. ``EUR'' or
``USD'', is specified usin
@cindex currency
@cindex KUDOS
@example
-[taler]/currency
+[TALER]/CURRENCY
@end example
For testing purposes, the currency MUST match ``KUDOS'' so that tests will work
with the Taler demonstration exchange at
@url{https://exchange.demo.taler.net/}:
@example
-$ taler-config -s taler -o currency -V KUDOS
+$ taler-config -s TALER -o CURRENCY -V KUDOS
@end example
+
@item Database
@cindex DBMS
In principle is possible for the backend to support different DBMSs.
The option
@example
-[merchant]/db
+[MERCHANT]/DB
@end example
specifies which DBMS is to be used. However, currently only the value
"postgres" is supported. This is also
@@ -563,7 +559,7 @@ given in the configuration file.
To configure the Taler backend to use this database, run:
@example
-$ taler-config -s merchantdb-postgres -o CONFIG \
+$ taler-config -s MERCHANTDB-postgres -o CONFIG \
-V postgres:///$DBNAME
@end example
@@ -571,7 +567,7 @@ $ taler-config -s merchantdb-postgres -o CONFIG \
@item Exchange
@cindex exchange
To add an exchange to the list of trusted payment service providers,
-you create a section with a name that starts with ``merchant-exchange-''.
+you create a section with a name that starts with ``exchange-''.
In that section, the following options need to be configured:
@itemize
@@ -581,7 +577,7 @@ The ``url'' option specifies the exchange's base URL. For
example,
to use the Taler demonstrator use:
@example
-$ taler-config -s merchant-exchange-demo -o URL \
+$ taler-config -s EXCHANGE-demo -o URL \
-V https://exchange.demo.taler.net/
@end example
@@ -591,7 +587,7 @@ The ``master_key'' option specifies the exchange's master
public key in base32 e
For the Taler demonstrator, use:
@example
-$ taler-config -s merchant-exchange-demo -o master_key \
+$ taler-config -s EXCHANGE-demo -o master_key \
-V CQQZ9DY3MZ1ARMN5K1VKDETS04Y2QCKMMCFHZSWJWWVN82BTTH00
@end example
@@ -605,100 +601,162 @@ multiple currencies, you need to configure a backend
per currency.
@c FIXME: In the future, we need to describe specifying auditors here.
@c @item Auditors
address@hidden Wireformat
+
address@hidden Instances
address@hidden instance
+The backend allows the user to run multiple instances of shops with
+distinct business entities against a single backend. Each instance
+uses its own bank accounts and key for signing contracts. It is
+mandatory to configure a "default" instance.
+
address@hidden
+
address@hidden
+The ``KEYFILE'' option specifies the file containing the instance's
+private signing key. For example, use:
+
address@hidden
+$ taler-config -s INSTANCE-default -o KEYFILE \
+ -V 'address@hidden@}/merchant/instace/default.key'
address@hidden example
+
address@hidden
+The ``NAME'' option specifies a human-readable name for the instance.
+For example, use:
+
address@hidden
+$ taler-config -s INSTANCE-default -o NAME \
+ -V 'Kudos Inc.'
address@hidden example
+
+
address@hidden
+The optional ``TIP_EXCHANGE'' and ``TIP_EXCHANGE_PRIV_FILENAME''
+options are discussed in @cite{Tipping visitors}
address@hidden itemize
+
+
+
address@hidden Accounts
@cindex wire format
In order to receive payments, the merchant backend needs to communicate bank
-account details to the exchange. The banking system used is specified using
the
-following global option:
+account details to the exchange. For this, the configuration must
+include one or more sections named ``ACCOUNT-name'' where @code{name} can be
+replaced by some human-readable word identifying the account. For
+each section, the following options should be provided:
+
+
address@hidden
address@hidden
+The ``URL'' option specifies a @code{payto://}-URL for the account of
+the merchant. For example, use:
@example
-[merchant]/wireformat
+$ taler-config -s ACCOUNT-bank -o NAME \
+ -V 'payto://x-taler-bank/bank.demo.taler.net/4'
@end example
-The value @code{test} can be used to interact with the Taler
-demonstrator at @url{https://bank.demo.taler.net/}:
address@hidden
+The ``WIRE_RESPONSE'' option specifies where Taler should store the
+(salted) JSON encoding of the wire account. The file given will be
+created if it does not exist. For example, use:
@example
-$ taler-config -s merchant -o wireformat -V test
+$ taler-config -s ACCOUNT-bank -o WIRE_RESPONSE \
+ -V '@address@hidden/merchant/bank.json'
@end example
-Other wireformats will be supported in the future to interact with
-actual banks.
address@hidden Instances
address@hidden instance
-The backend allows the user to run multiple instances of shops with
-distinct business entities against a single backend. Each instance
-uses its own bank account and key for signing contracts. It is
-mandatory to configure a "default" instance. The specific
-configuration format depends slightly on the banking system selected
-via the @code{wireformat} option.
address@hidden
+The ``PLUGIN'' option specifies which wire plugin should be used for
+this account. The plugin must support the wire method used by the
+URL. For example, use:
+
address@hidden
+$ taler-config -s ACCOUNT-bank -o PLUGIN \
+ -V taler_bank
address@hidden example
address@hidden
@item
-For the @code{test} wire format, a sample specification looks as follows:
-
address@hidden
-{
- "type": "test",
- "bank_url": "https://bank.demo.taler.net/",
- "account_number": 5,
- "salt": "RANDOMSALT"
-}
address@hidden verbatim
-
-These bank details are included in the contract in their hashed
-form. Hence, the random @code{salt} is necessary to make it difficult
-for customers to invert the hash by brute-force.
-
-You should substitute the account number with your actual account
-number. In order to get an account number, register at our
-demonstration bank at @url{https://bank.demo.taler.net/} using your
-browser.
-
-The option ``test_response_file'' in the section
-``merchant-instance-wireformat-default'' specifies the path to this
-file. Assuming this JSON specification is stored in a file
address@hidden, then run:
+For each @code{instance} that should use this account, you should set
address@hidden and @code{ACTIVE_instance} to YES. The first
+option will cause the instance to accept payments to the account (for
+existing contracts), while the second will cause the backend to
+include the account as a possible option for new contracts.
+
+For example, use:
@example
-$ taler-config -s merchant-instance-wireformat-default \
- -o test_response_file -V $TEST.json
+$ taler-config -s ACCOUNT-bank -o HONOR_default \
+ -V YES
+$ taler-config -s ACCOUNT-bank -o ACTIVE_default \
+ -V YES
@end example
address@hidden Document SEPA here once supported.
+to use ``account-bank'' for the ``default'' instance.
+
@end itemize
+Depending on which PLUGIN you configured, you may additionally specfiy
+authentication options to enable the plugin to use the account.
+
+For example, with @code{taler_bank} plugin, use:
+
address@hidden
+$ taler-config -s ACCOUNT-bank -o TALER_BANK_AUTH_METHOD \
+ -V basic
+$ taler-config -s ACCOUNT-bank -o USERNAME \
+ -V user42
+$ taler-config -s ACCOUNT-bank -o PASSWORD \
+ -V pass42
address@hidden example
+
+
+
address@hidden Document EBICS here once supported.
+
Note that additional instances can be specified using different tokens
in the section name instead of @code{default}.
@end table
+
@section Sample backend configuration
@cindex configuration
The following is an example for a complete backend configuration:
@smallexample
-[merchant]
-wireformat = TEST
-serve = TCP
-port = 8888
-currency = EUR
-database = postgres
-
-[merchant-instance-default]
-KEYFILE = $DATADIR/key.priv
+[TALER]
+CURRENCY = KUDOS
-[merchant-instance-wireformat-default]
-TEST_RESPONSE_FILE = $DATADIR/test.json
+[MERCHANT]
+SERVE = TCP
+PORT = 8888
+DATABASE = postgres
-[merchantdb-postgres]
-config = postgres:///donations
+[MERCHANTDB-postgres]
+CONFIG = postgres:///donations
+
+[INSTANCE-default]
+KEYFILE = $DATADIR/key.priv
+NAME = "Kudos Inc."
+
+[ACCOUNT-bank]
+URL = payto://x-taler-bank/bank.demo.taler.net/4
+WIRE_RESPONSE = $DATADIR/bank.json
+PLUGIN = taler_bank
+HONOR_default = YES
+ACTIVE_default = YES
+TALER_BANK_AUTH_METHOD = basic
+USERNAME = my_user
+PASSWORD = 1234pass
+
+[EXCHANGE-trusted]
+URL = https://exchange.demo.taler.net/
+MASTER_KEY = CQQZ9DY3MZ1ARMN5K1VKDETS04Y2QCKMMCFHZSWJWWVN82BTTH00
+CURRENCY = KUDOS
-[merchant-demoexchange]
-url = https://exchange.demo.taler.net/
-master_key = CQQZ9DY3MZ1ARMN5K1VKDETS04Y2QCKMMCFHZSWJWWVN82BTTH00
@end smallexample
@@ -743,6 +801,7 @@ reachable. Production systems should be configured to bind
to a UNIX domain socket or properly restrict access to the
port.
+
@node Testing
@chapter Testing
@@ -755,34 +814,35 @@ This tool gets configured by a config file, that must
have the following
layout:
@example
-[payments-generator]
+[PAYMENTS-GENERATOR]
# The exchange used during the test: make sure the merchant backend
# being tested accpets this exchange.
# If the sysadmin wants, she can also install a local exchange
# and test against it.
-exchange = https://exchange.demo.taler.net/
+EXCHANGE = https://exchange.demo.taler.net/
# This value must indicate some URL where the backend
# to be tested is listening; it doesn't have to be the
# "official" one, though.
-merchant = http://localbackend/
+MERCHANT = http://localbackend/
# This value is used when the tool tries to withdraw coins,
# and must match the bank used by the exchange. If the test is
# done against the exchange at https://exchange.demo.taler.net/,
# then this value can be "https://bank.demo.taler.net/".
-bank = https://bank.demo.taler.net/
+BANK = https://bank.demo.taler.net/
# The merchant instance in charge of serving the payment.
# Make sure this instance has a bank account at the same bank
# indicated by the 'bank' option above.
-instance = default
+INSTANCE = default
# The currency used during the test. Must match the one used
# by merchant backend and exchange.
-currency = KUDOS
+CURRENCY = KUDOS
@end example
address@hidden FIXME: the last option should be removed and [taler]/CURRENCY
used instead!
Run the test in the following way:
@@ -823,7 +883,7 @@ The following example shows a 5 EURO coin configuration -
needed by the
used exchange - which is compatible with the hardcoded example above.
@example
-[coin_eur_5]
+[COIN_eur_5]
value = EUR:5
duration_overlap = 5 minutes
duration_withdraw = 7 days
@@ -847,6 +907,7 @@ issue the following command:
$ taler-merchant-dbinit -r
@end example
+
@node Advanced topics
@chapter Advanced topics
@@ -963,10 +1024,10 @@ within their value. To expand the @code{$DATADIR} or
other $-variables
in the configuration, pass the @code{-f} option to
@code{taler-config}. For example, compare:
@example
-$ taler-config -s merchant-instance-wireformat-default \
- -o test_response_file
-$ taler-config -f -s merchant-instance-wireformat-default \
- -o test_response_file
+$ taler-config -s ACCOUNT-bank \
+ -o WIRE_RESPONSE
+$ taler-config -f -s ACCOUNT-bank \
+ -o WIRE_RESPONSE
@end example
While the configuration file is typically located at
@@ -980,7 +1041,7 @@ the @code{-c} option.
@cindex merchant key
@cindex KEYFILE
-The option ``KEYFILE'' in the section ``merchant-instance-default''
+The option ``KEYFILE'' in the section ``INSTANCE-default''
specifies the path to the instance's private key. You do not need to
create a key manually, the backend will generate it automatically if
it is missing. While generally unnecessary, it is possible to display
@@ -989,8 +1050,8 @@ tool:
@example
$ gnunet-ecc -p \
- $(taler-config -f -s merchant-instance-default \
- -o keyfile)
+ $(taler-config -f -s INSTANCE-default \
+ -o KEYFILE)
@end example
@c Add more on how to add that key to X.509 CSRs once we can do that.
@@ -998,32 +1059,24 @@ $ gnunet-ecc -p \
@node SEPA configuration
@section Using the SEPA wire transfer method
@cindex SEPA
address@hidden EBICS
The following is a sample configuration for the SEPA wire transfer
method:@footnote{Supporting SEPA is still
work in progress; the backend will accept this configuration, but the
exchange will not work with SEPA today.}.
address@hidden
-{
- "type": "SEPA",
- "IBAN": "XY00 1111 2222 3333 4444 5555 6666",
- "name": "Taler charity program",
- "BIC": "XXXXAB99",
- "salt": "RANDOMSALT"
-}
-
address@hidden verbatim
-
-We will now assume that this information is stored in file
@address@hidden@}/sepa.json}.
-Then, to configure the backend for SEPA payments in EUR, the following
configuration
+Then, to configure the EBICS backend for SEPA payments in EUR,
+the following configuration
options need to be set:
@example
-$ taler-config -s merchant -o currency -V EUR
-$ taler-config -s merchant -o wireformat -V sepa
-$ taler-config -s merchant-instance-wireformat-default \
- -o sepa_response_file -V address@hidden@}/sepa.json
+$ taler-config -s TALER -o CURRENCY -V EUR
+$ taler-config -s ACCOUNT-e -o PLUGIN -V ebics
+$ taler-config -s ACCOUNT-e -o URL \
+ -V payto://sepa/XY00111122223333444455556666
+$ taler-config -s ACCOUNT-e -o WIRE_RESPONSE
+ -V 'address@hidden@}/b.json'
@end example
Please note that you will also have to configure an exchange and/or
@@ -1057,23 +1110,15 @@ There are four basic steps that must happen to tip a
visitor.
To tip users, you first need to create a reserve. A reserve is a pool
of money held in escrow at the Taler exchange. This is the source of
the funds for the tips. Tipping will fail (resulting in disappointed
-visitors) if you do not have enough funds in your reserve! To create a
-reserve for tipping, you need to first create a tipping key. Use
-
address@hidden
-$ gnunet-ecc -g 1 tip.priv
address@hidden example
+visitors) if you do not have enough funds in your reserve!
-to create a file with the private key that will be used to identify the
-reserve.
-
-Now you can configure your backend. You need to enable tipping for
-each instance separately, or you can use an instance only for
-tipping. To configure the ``default'' instance for tipping, use
-the following configuration:
+First, we configure the backend. You need to enable tipping for each
+instance separately, or you can use an instance only for tipping. To
+configure the ``default'' instance for tipping, use the following
+configuration:
@example
-[merchant-instance-default]
+[INSTANCE-default]
# this is NOT the tip.priv
KEYFILE = signing_key.priv
# replace the URL with the URL of the exchange you will use
@@ -1089,16 +1134,31 @@ created above, and you should probably use a different
file here.
Instead of manually editing the configuration, you could also run:
@example
-$ taler-config -s merchant-instance-default \
+$ taler-config -s INSTANCE-default \
-o TIP_RESERVE_PRIV_FILENAME \
-V tip.priv
-$ taler-config -s merchant-instance-default \
+$ taler-config -s INSTANCE-default \
-o TIP_EXCHANGE \
-V https://exchange:443/
@end example
+
+Next, to create the @code{TIP_RESERVE_PRIV_FILENAME} file, use:
+
address@hidden
+$ gnunet-ecc -g 1 \
+ $(taler-config -f -s INSTANCE-default \
+ -o TIP-RESERVE_PRIV_FILENAME)
address@hidden example
+
+This will create a file with the private key that will be used to
+identify the reserve. You need to do this once for each instance that
+is configured to tip.
+
+
Now you can (re)start the backend with the new configuration.
+
@subsection Fund the reserve
@cindex reserve
@cindex close
@@ -1106,7 +1166,9 @@ Now you can (re)start the backend with the new
configuration.
To fund the reserve, you must first extract the public key from ``tip.priv'':
@example
-$ gnunet-ecc --print-public-key tip.priv
+$ gnunet-ecc --print-public-key \
+ $(taler-config -f -s INSTANCE-default \
+ -o TIP-RESERVE_PRIV_FILENAME)
@end example
In our example, the output for the public key is:
diff --git a/src/backend/Makefile.am b/src/backend/Makefile.am
index a83a185..960dc46 100644
--- a/src/backend/Makefile.am
+++ b/src/backend/Makefile.am
@@ -35,6 +35,7 @@ taler_merchant_httpd_SOURCES = \
taler_merchant_httpd_LDADD = \
$(top_builddir)/src/backenddb/libtalermerchantdb.la \
-ltalerexchange \
+ -ltalerwire \
-ltalerjson \
-ltalerutil \
-ltalerpq \
diff --git a/src/backend/merchant.conf b/src/backend/merchant.conf
index 45a13cf..1ac3a2c 100644
--- a/src/backend/merchant.conf
+++ b/src/backend/merchant.conf
@@ -57,5 +57,24 @@ CONFIG = postgres:///talermerchant
[merchant-instance-default]
KEYFILE = ${TALER_DATA_HOME}/merchant/merchant.priv
-[merchant-instance-wireformat-default]
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/tutorial.json
+# [account-merchant]
+
+# payto://-URL of the merchant's bank account. Required.
+# URL = payto://x-taler-bank/bank/42
+
+# File where this account's salted wire address is provided.
+# File does not have to exist, will be generated from
+# BANK_URL if it is missing. File must match BANK_URL.
+#WIRE_RESPONSE = ${TALER_CONFIG_HOME}/merchant/accounts/default.json
+
+# Can this address be used in previous offers for
+# instance "default"? Must be set to YES if ACTIVE_default is YES.
+# Note that "default" here must match the instance's section name.
+# The same account may be enabled/active in multiple instances.
+#ENABLE_default = YES
+
+# Should this address be used in offers we create right now for
+# instance "default"?
+# Inactive addresses (NO) will be supported for legacy contracts
+# but not used for new contracts.
+#ACTIVE_default = YES
diff --git a/src/backend/taler-merchant-httpd.c
b/src/backend/taler-merchant-httpd.c
index 017d6a1..213e115 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -28,6 +28,7 @@
#include <taler/taler_json_lib.h>
#include <taler/taler_exchange_service.h>
#include <taler/taler_wire_plugin.h>
+#include <taler/taler_wire_lib.h>
#include "taler-merchant-httpd_responses.h"
#include "taler_merchantdb_lib.h"
#include "taler-merchant-httpd.h"
@@ -113,6 +114,11 @@ unsigned long long default_wire_fee_amortization;
int TMH_merchant_connection_close;
/**
+ * Which currency do we use?
+ */
+char *TMH_currency;
+
+/**
* Task running the HTTP server.
*/
static struct GNUNET_SCHEDULER_Task *mhd_task;
@@ -328,6 +334,7 @@ hashmap_free (void *cls,
mi->wm_tail,
wm);
json_decref (wm->j_wire);
+ GNUNET_free (wm->wire_method);
GNUNET_free (wm);
}
@@ -596,11 +603,16 @@ struct WireFormatIteratorContext
* The merchant instance we are currently building.
*/
struct MerchantInstance *mi;
+
+ /**
+ * Set to #GNUNET_YES if the default instance was found.
+ */
+ int default_instance;
};
/**
- * Callback that looks for 'merchant-instance-wireformat-*' sections,
+ * Callback that looks for 'account-*' sections,
* and populates our wire method according to the data
*
* @param cls closure with a `struct WireFormatIteratorContext *`
@@ -613,79 +625,216 @@ wireformat_iterator_cb (void *cls,
struct WireFormatIteratorContext *wfic = cls;
struct MerchantInstance *mi = wfic->mi;
struct IterateInstancesCls *iic = wfic->iic;
- char *instance_wiresection;
+ char *instance_option;
struct WireMethod *wm;
- json_t *type;
- char *emsg;
-
- GNUNET_asprintf (&instance_wiresection,
- "merchant-instance-wireformat-%s",
+ char *payto;
+ char *fn;
+ char *plugin_name;
+ struct TALER_WIRE_Plugin *plugin;
+ json_t *j;
+ enum TALER_ErrorCode ec;
+ struct GNUNET_HashCode h_wire;
+
+ if (0 != strncasecmp (section,
+ "account-",
+ strlen ("account-")))
+ return;
+ GNUNET_asprintf (&instance_option,
+ "HONOR_%s",
mi->id);
- if (0 != strncmp (section,
- instance_wiresection,
- strlen (instance_wiresection)))
+ if (GNUNET_YES !=
+ GNUNET_CONFIGURATION_get_value_yesno (iic->config,
+ section,
+ instance_option))
+ {
+ GNUNET_free (instance_option);
+ return;
+ }
+ GNUNET_free (instance_option);
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (iic->config,
+ section,
+ "URL",
+ &payto))
{
- GNUNET_free (instance_wiresection);
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ section,
+ "URL");
+ iic->ret = GNUNET_SYSERR;
return;
}
- GNUNET_free (instance_wiresection);
- wm = GNUNET_new (struct WireMethod);
- /* FIXME: maybe use sorting to address #4939-12806? */
- GNUNET_CONTAINER_DLL_insert (mi->wm_head,
- mi->wm_tail,
- wm);
- wm->j_wire = iic->plugin->get_wire_details (iic->plugin->cls,
- iic->config,
- section);
- if ( (NULL == (type = json_object_get (wm->j_wire,
- "type"))) ||
- (! json_is_string (type)) )
+ /* check payto://-URL is well-formed and matches plugin */
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (iic->config,
+ section,
+ "PLUGIN",
+ &plugin_name))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ section,
+ "PLUGIN");
+ GNUNET_free (payto);
+ GNUNET_free (instance_option);
+ iic->ret = GNUNET_SYSERR;
+ return;
+ }
+ if (NULL ==
+ (plugin = TALER_WIRE_plugin_load (iic->config,
+ plugin_name)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Malformed wireformat: lacks type\n");
- iic->ret |= GNUNET_SYSERR;
+ "Failed to load wire plugin `%s'\n",
+ plugin_name);
+ GNUNET_free (plugin_name);
+ GNUNET_free (instance_option);
+ GNUNET_free (payto);
+ iic->ret = GNUNET_SYSERR;
return;
}
- wm->wire_method = json_string_value (type);
-
if (TALER_EC_NONE !=
- iic->plugin->wire_validate (iic->plugin->cls,
- wm->j_wire,
- NULL,
- &emsg))
+ (ec = plugin->wire_validate (plugin->cls,
+ payto)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Malformed wireformat: %s\n",
- emsg);
- GNUNET_free (emsg);
- iic->ret |= GNUNET_SYSERR;
+ "payto:// URL `%s' not supported by plugin `%s'\n",
+ payto,
+ plugin_name);
+ GNUNET_free (plugin_name);
+ GNUNET_free (instance_option);
+ GNUNET_free (payto);
+ TALER_WIRE_plugin_unload (plugin);
+ iic->ret = GNUNET_SYSERR;
return;
}
+ TALER_WIRE_plugin_unload (plugin);
+ GNUNET_free (plugin_name);
if (GNUNET_OK !=
- TALER_JSON_hash (wm->j_wire,
- &wm->h_wire))
+ GNUNET_CONFIGURATION_get_value_filename (iic->config,
+ section,
+ "WIRE_RESPONSE",
+ &fn))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ section,
+ "WIRE_RESPONSE");
+ GNUNET_free (payto);
+ iic->ret = GNUNET_SYSERR;
+ return;
+ }
+
+ /* Try loading existing JSON from file */
+ if (GNUNET_YES ==
+ GNUNET_DISK_file_test (fn))
+ {
+ json_error_t err;
+ char *url;
+
+ if (NULL ==
+ (j = json_load_file (fn,
+ JSON_REJECT_DUPLICATES,
+ &err)))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to load JSON from `%s': %s at %d:%d\n",
+ fn,
+ err.text,
+ err.line,
+ err.column);
+ GNUNET_free (fn);
+ GNUNET_free (payto);
+ iic->ret = GNUNET_SYSERR;
+ return;
+ }
+ url = TALER_JSON_wire_to_payto (j);
+ if (NULL == url)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "URL missing in `%s', disabling account `%s'\n",
+ fn,
+ section);
+ GNUNET_free (fn);
+ GNUNET_free (payto);
+ iic->ret = GNUNET_SYSERR;
+ return;
+ }
+ if (0 != strcasecmp (url,
+ payto))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "URL `%s' does not match configuration `%s', disabling
account `%s'\n",
+ url,
+ payto,
+ section);
+ GNUNET_free (fn);
+ GNUNET_free (payto);
+ GNUNET_free (url);
+ iic->ret = GNUNET_SYSERR;
+ return;
+ }
+ GNUNET_free (url);
+ }
+ else /* need to generate JSON */
+ {
+ j = TALER_JSON_wire_signature_make (payto,
+ NULL);
+ if (0 != json_dump_file (j,
+ fn,
+ JSON_COMPACT | JSON_SORT_KEYS))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to write hashed wire details to `%s'\n",
+ fn);
+ GNUNET_free (fn);
+ GNUNET_free (payto);
+ json_decref (j);
+ iic->ret = GNUNET_SYSERR;
+ return;
+ }
+ }
+ GNUNET_free (fn);
+
+ if (GNUNET_OK !=
+ TALER_JSON_wire_signature_hash (j,
+ &h_wire))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to hash wireformat\n");
- iic->ret |= GNUNET_SYSERR;
+ "Failed to hash wire input\n");
+ GNUNET_free (fn);
+ GNUNET_free (payto);
+ json_decref (j);
+ iic->ret = GNUNET_SYSERR;
+ return;
}
-#define EXTRADEBUG
-#ifdef EXTRADEBUGG
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Found wireformat instance:\n");
- json_dumpf (wm->j_wire,
- stdout,
- 0);
- printf ("\n");
-#endif
+
+ wm = GNUNET_new (struct WireMethod);
+ wm->wire_method = TALER_WIRE_payto_get_method (payto);
+ GNUNET_free (payto);
+ GNUNET_asprintf (&instance_option,
+ "ACTIVE_%s",
+ mi->id);
+ wm->active = GNUNET_CONFIGURATION_get_value_yesno (iic->config,
+ section,
+ instance_option);
+ GNUNET_free (instance_option);
+ if (GNUNET_YES == wm->active)
+ GNUNET_CONTAINER_DLL_insert (mi->wm_head,
+ mi->wm_tail,
+ wm);
+ else
+ GNUNET_CONTAINER_DLL_insert_tail (mi->wm_head,
+ mi->wm_tail,
+ wm);
+
+ wm->j_wire = j;
+ wm->h_wire = h_wire;
}
/**
- * Callback that looks for 'merchant-instance-*' sections,
+ * Callback that looks for 'instance-*' sections,
* and populates accordingly each instance's data
*
* @param cls closure of type `struct IterateInstancesCls`
@@ -702,24 +851,11 @@ instances_iterator_cb (void *cls,
/* used as hashmap keys */
struct GNUNET_HashCode h_pk;
struct GNUNET_HashCode h_id;
- const char *substr;
-
- substr = strstr (section,
- "merchant-instance-");
- if ( (NULL == substr) ||
- (NULL != strstr (section,
- "merchant-instance-wireformat-")) )
- return;
-
- if (substr != section)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to specify a merchant instance\n");
- GNUNET_SCHEDULER_shutdown ();
+ if (0 != strncasecmp (section,
+ "instance-",
+ strlen ("instance-")))
return;
- }
-
/** Get id **/
token = strrchr (section, '-');
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -736,7 +872,7 @@ instances_iterator_cb (void *cls,
section,
"NAME");
GNUNET_free (mi);
- GNUNET_SCHEDULER_shutdown ();
+ iic->ret = GNUNET_SYSERR;
return;
}
@@ -751,7 +887,7 @@ instances_iterator_cb (void *cls,
"KEYFILE");
GNUNET_free (mi->name);
GNUNET_free (mi);
- GNUNET_SCHEDULER_shutdown ();
+ iic->ret = GNUNET_SYSERR;
return;
}
if (GNUNET_OK ==
@@ -775,7 +911,7 @@ instances_iterator_cb (void *cls,
GNUNET_free (mi->keyfile);
GNUNET_free (mi->name);
GNUNET_free (mi);
- GNUNET_SCHEDULER_shutdown ();
+ iic->ret = GNUNET_SYSERR;
return;
}
pk = GNUNET_CRYPTO_eddsa_key_create_from_file (tip_reserves);
@@ -789,7 +925,7 @@ instances_iterator_cb (void *cls,
GNUNET_free (mi->keyfile);
GNUNET_free (mi->name);
GNUNET_free (mi);
- GNUNET_SCHEDULER_shutdown ();
+ iic->ret = GNUNET_SYSERR;
return;
}
mi->tip_reserve.eddsa_priv = *pk;
@@ -803,13 +939,13 @@ instances_iterator_cb (void *cls,
"Merchant private key `%s' does not exist yet, creating it!\n",
mi->keyfile);
if (NULL ==
- (pk = GNUNET_CRYPTO_eddsa_key_create_from_file (mi->keyfile)))
+ (pk = GNUNET_CRYPTO_eddsa_key_create_from_file (mi->keyfile)))
{
GNUNET_break (0);
GNUNET_free (mi->keyfile);
GNUNET_free (mi->name);
GNUNET_free (mi);
- GNUNET_SCHEDULER_shutdown ();
+ iic->ret = GNUNET_SYSERR;
return;
}
mi->privkey.eddsa_priv = *pk;
@@ -822,26 +958,6 @@ instances_iterator_cb (void *cls,
mi->id))
iic->default_instance = GNUNET_YES;
- /* Initialize wireformats */
- {
- struct WireFormatIteratorContext wfic = {
- .iic = iic,
- .mi = mi
- };
-
- GNUNET_CONFIGURATION_iterate_sections (iic->config,
- &wireformat_iterator_cb,
- &wfic);
- }
-
- if (NULL == mi->wm_head)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to load wire formats for instance `%s'\n",
- mi->id);
- iic->ret |= GNUNET_SYSERR;
- }
-
GNUNET_CRYPTO_hash (mi->id,
strlen (mi->id),
&h_id);
@@ -853,7 +969,11 @@ instances_iterator_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to put an entry into the 'by_id' hashmap\n");
- iic->ret |= GNUNET_SYSERR;
+ iic->ret = GNUNET_SYSERR;
+ GNUNET_free (mi->keyfile);
+ GNUNET_free (mi->name);
+ GNUNET_free (mi);
+ return;
}
GNUNET_CRYPTO_hash (&mi->pubkey.eddsa_pub,
sizeof (struct GNUNET_CRYPTO_EddsaPublicKey),
@@ -866,8 +986,36 @@ instances_iterator_cb (void *cls,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to put an entry into the 'by_kpub_map' hashmap\n");
- iic->ret |= GNUNET_SYSERR;
+ GNUNET_assert (GNUNET_OK ==
+ GNUNET_CONTAINER_multihashmap_remove (by_id_map,
+ &h_id,
+ mi));
+ iic->ret = GNUNET_SYSERR;
+ GNUNET_free (mi->keyfile);
+ GNUNET_free (mi->name);
+ GNUNET_free (mi);
+ return;
+ }
+
+ /* Initialize wireformats */
+ {
+ struct WireFormatIteratorContext wfic = {
+ .iic = iic,
+ .mi = mi
+ };
+
+ GNUNET_CONFIGURATION_iterate_sections (iic->config,
+ &wireformat_iterator_cb,
+ &wfic);
+ }
+ if (NULL == mi->wm_head)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to load wire formats for instance `%s'\n",
+ mi->id);
+ iic->ret = GNUNET_SYSERR;
}
+
}
@@ -940,73 +1088,40 @@ iterate_locations (const struct
GNUNET_CONFIGURATION_Handle *config)
(void *) config);
}
+
/**
* Iterate over each merchant instance, in order to populate
* each instance's own data
*
* @param config configuration handle
- * @param allowed which wire format is allowed/expected?
* @return #GNUNET_OK if successful, #GNUNET_SYSERR upon errors
- * (for example, if no "default" instance is defined)
+ * (for example, if no "default" instance is defined)
*/
static int
-iterate_instances (const struct GNUNET_CONFIGURATION_Handle *config,
- const char *allowed)
+iterate_instances (const struct GNUNET_CONFIGURATION_Handle *config)
{
- struct IterateInstancesCls *iic;
- char *lib_name;
-
- (void) GNUNET_asprintf (&lib_name,
- "libtaler_plugin_wire_%s",
- allowed);
- iic = GNUNET_new (struct IterateInstancesCls);
- iic->current_index = 0;
- iic->config = config;
- iic->default_instance = GNUNET_NO;
- iic->plugin = GNUNET_PLUGIN_load (lib_name,
- NULL);
- if (NULL == iic->plugin)
- {
- GNUNET_free (lib_name);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Wire transfer method `%s' not supported\n",
- allowed);
- return GNUNET_SYSERR;
- }
- iic->plugin->library_name = lib_name;
+ struct IterateInstancesCls iic;
+
+ iic.config = config;
+ iic.default_instance = GNUNET_NO;
+ iic.ret = GNUNET_OK;
GNUNET_CONFIGURATION_iterate_sections (config,
&instances_iterator_cb,
- iic);
+ &iic);
- if (GNUNET_NO == iic->default_instance)
+ if (GNUNET_NO == iic.default_instance)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No default merchant instance found\n");
- goto fail;
+ return GNUNET_SYSERR;
}
- else
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Congratulations, you have a default instance\n");
-
- if (0 != (GNUNET_SYSERR & iic->ret))
+ if (GNUNET_OK != iic.ret)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "At least one instance has not been successfully parsed\n");
- goto fail;
+ "At least one instance was not successfully parsed\n");
+ return GNUNET_SYSERR;
}
-
- GNUNET_PLUGIN_unload (lib_name,
- iic->plugin);
- GNUNET_free (lib_name);
- GNUNET_free (iic);
return GNUNET_OK;
-
- fail:
- GNUNET_PLUGIN_unload (lib_name,
- iic->plugin);
- GNUNET_free (lib_name);
- GNUNET_free (iic);
- return GNUNET_SYSERR;
}
@@ -1025,10 +1140,10 @@ run (void *cls,
const char *cfgfile,
const struct GNUNET_CONFIGURATION_Handle *config)
{
- char *wireformat;
int fh;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "running taler-merchant-httpd\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Starting taler-merchant-httpd\n");
result = GNUNET_SYSERR;
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
@@ -1038,6 +1153,19 @@ run (void *cls,
"WARNING",
NULL));
if (GNUNET_SYSERR ==
+ GNUNET_CONFIGURATION_get_value_string (config,
+ "taler",
+ "CURRENCY",
+ &TMH_currency))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "taler",
+ "CURRENCY");
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+
+ if (GNUNET_SYSERR ==
TMH_EXCHANGES_init (config))
{
GNUNET_SCHEDULER_shutdown ();
@@ -1051,14 +1179,16 @@ run (void *cls,
}
if (NULL ==
- (by_id_map = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO)))
+ (by_id_map = GNUNET_CONTAINER_multihashmap_create (1,
+ GNUNET_NO)))
{
GNUNET_SCHEDULER_shutdown ();
return;
}
if (NULL ==
- (by_kpub_map = GNUNET_CONTAINER_multihashmap_create(1, GNUNET_NO)))
+ (by_kpub_map = GNUNET_CONTAINER_multihashmap_create (1,
+ GNUNET_NO)))
{
GNUNET_SCHEDULER_shutdown ();
return;
@@ -1129,29 +1259,12 @@ run (void *cls,
return;
}
- wireformat = NULL;
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (config,
- "merchant",
- "WIREFORMAT",
- &wireformat))
+ iterate_instances (config))
{
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "merchant",
- "WIREFORMAT");
GNUNET_SCHEDULER_shutdown ();
return;
}
- if (GNUNET_OK !=
- iterate_instances (config,
- wireformat))
- {
- GNUNET_free (wireformat);
- GNUNET_SCHEDULER_shutdown ();
- return;
- }
- GNUNET_free (wireformat);
-
iterate_locations (config);
if (NULL ==
@@ -1219,13 +1332,12 @@ run (void *cls,
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (config,
"merchant",
- "unixpath_mode",
+ "UNIXPATH_MODE",
&mode))
{
- GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"merchant",
- "unixpath_mode",
- "unixpath_mode required");
+ "UNIXPATH_MODE");
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -1235,8 +1347,8 @@ run (void *cls,
{
GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
"merchant",
- "unixpath_mode",
- "unixpath_mode must be octal number");
+ "UNIXPATH_MODE",
+ "must be octal number");
GNUNET_free (mode);
GNUNET_SCHEDULER_shutdown ();
return;
diff --git a/src/backend/taler-merchant-httpd.h
b/src/backend/taler-merchant-httpd.h
index 726dc62..9d494db 100644
--- a/src/backend/taler-merchant-httpd.h
+++ b/src/backend/taler-merchant-httpd.h
@@ -59,11 +59,6 @@ struct IterateInstancesCls
unsigned int default_instance;
/**
- * Wire plugin
- */
- struct TALER_WIRE_Plugin *plugin;
-
- /**
* Tells if the parsing encountered any error. We need this
* field since the iterator must return void
*/
@@ -89,7 +84,7 @@ struct WireMethod
/**
* Which wire method is @e j_wire using? Points into @e j_wire.
*/
- const char *wire_method;
+ char *wire_method;
/**
* Wire details for this instance
@@ -101,6 +96,11 @@ struct WireMethod
*/
struct GNUNET_HashCode h_wire;
+ /**
+ * Is this wire method active (should it be included in new contracts)?
+ */
+ int active;
+
};
@@ -285,6 +285,11 @@ extern struct TALER_Amount default_max_deposit_fee;
extern unsigned long long default_wire_fee_amortization;
/**
+ * Which currency do we use?
+ */
+extern char *TMH_currency;
+
+/**
* Hash of our wire format details as given in #j_wire.
*/
extern struct GNUNET_HashCode h_wire;
diff --git a/src/backend/taler-merchant-httpd_auditors.c
b/src/backend/taler-merchant-httpd_auditors.c
index 8b620e0..735d0df 100644
--- a/src/backend/taler-merchant-httpd_auditors.c
+++ b/src/backend/taler-merchant-httpd_auditors.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2014, 2015, 2016 GNUnet e.V. and INRIA
+ (C) 2014, 2015, 2016, 2018 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
Software
@@ -136,15 +136,35 @@ parse_auditors (void *cls,
{
const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
char *pks;
+ char *currency;
struct Auditor auditor;
if (0 != strncasecmp (section,
- "merchant-auditor-",
- strlen ("merchant-auditor-")))
+ "auditor-",
+ strlen ("auditor-")))
return;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
section,
+ "CURRENCY",
+ ¤cy))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ section,
+ "CURRENCY");
+ return;
+ }
+ if (0 != strcasecmp (currency,
+ TMH_currency))
+ {
+ /* trusted exchange, but for a different currency; ignore */
+ GNUNET_free (currency);
+ return;
+ }
+ GNUNET_free (currency);
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ section,
"NAME",
&auditor.name))
{
diff --git a/src/backend/taler-merchant-httpd_exchanges.c
b/src/backend/taler-merchant-httpd_exchanges.c
index 1c90f00..65eccab 100644
--- a/src/backend/taler-merchant-httpd_exchanges.c
+++ b/src/backend/taler-merchant-httpd_exchanges.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- (C) 2014-2017 INRIA
+ (C) 2014-2018 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU Affero General Public License as published by the Free
Software
@@ -21,6 +21,7 @@
*/
#include "platform.h"
#include <taler/taler_json_lib.h>
+#include <taler/taler_wire_lib.h>
#include "taler-merchant-httpd_exchanges.h"
@@ -302,22 +303,18 @@ retry_exchange (void *cls)
* @param cls closure
* @param wire_method name of the wire method (i.e. "sepa")
* @param fees fee structure for this method
+ * @return #GNUNET_OK on success
*/
-static void
-process_wire_fees (void *cls,
+static int
+process_wire_fees (struct Exchange *exchange,
+ const struct TALER_MasterPublicKeyP *master_pub,
const char *wire_method,
const struct TALER_EXCHANGE_WireAggregateFees *fees)
{
- struct Exchange *exchange = cls;
struct FeesByWireMethod *f;
struct TALER_EXCHANGE_WireAggregateFees *endp;
struct TALER_EXCHANGE_WireAggregateFees *af;
- const struct TALER_EXCHANGE_Keys *keys;
- const struct TALER_MasterPublicKeyP *master_pub;
- keys = TALER_EXCHANGE_get_keys (exchange->conn);
- GNUNET_assert (NULL != keys);
- master_pub = &keys->master_pub;
for (f = exchange->wire_fees_head; NULL != f; f = f->next)
if (0 == strcasecmp (wire_method,
f->wire_method))
@@ -342,7 +339,7 @@ process_wire_fees (void *cls,
{
/* Hole in the fee structure, not allowed! */
GNUNET_break_op (0);
- return;
+ return GNUNET_SYSERR;
}
while (NULL != fees)
{
@@ -368,7 +365,7 @@ process_wire_fees (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n");
GNUNET_free (af);
- break;
+ return GNUNET_SYSERR;
}
qs = db->store_wire_fee_by_exchange (db->cls,
master_pub,
@@ -416,6 +413,46 @@ process_wire_fees (void *cls,
endp = af;
fees = fees->next;
}
+ return GNUNET_OK;
+}
+
+
+/**
+ * Function called with information about the wire accounts
+ * of the exchanage. Stores the wire fees with the
+ * exchange for laster use.
+ *
+ * @param exchange the exchange
+ * @param master_pub public key of the exchange
+ * @param accounts_len length of the @a accounts array
+ * @param accounts list of wire accounts of the exchange
+ * @return #GNUNET_OK on success
+ */
+static int
+process_wire_accounts (struct Exchange *exchange,
+ const struct TALER_MasterPublicKeyP *master_pub,
+ unsigned int accounts_len,
+ const struct TALER_EXCHANGE_WireAccount *accounts)
+{
+ for (unsigned int i=0;i<accounts_len;i++)
+ {
+ char *method;
+
+ method = TALER_WIRE_payto_get_method (accounts[i].url);
+ if (NULL == method)
+ return GNUNET_SYSERR;
+ if (GNUNET_OK !=
+ process_wire_fees (exchange,
+ master_pub,
+ method,
+ accounts[i].fees))
+ {
+ GNUNET_free (method);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (method);
+ }
+ return GNUNET_OK;
}
@@ -549,15 +586,15 @@ wire_task_cb (void *cls);
* @param http_status HTTP response code, #MHD_HTTP_OK (200) for successful
request;
* 0 if the exchange's reply is bogus (fails to follow the
protocol)
* @param ec taler-specific error code, #TALER_EC_NONE on success
- * @param obj the received JSON reply, if successful this should be the wire
- * format details as provided by /wire, or NULL if the
- * reply was not in JSON format.
+ * @param accounts_len length of the @a accounts array
+ * @param accounts list of wire accounts of the exchange, NULL on error
*/
static void
handle_wire_data (void *cls,
unsigned int http_status,
enum TALER_ErrorCode ec,
- const json_t *obj)
+ unsigned int accounts_len,
+ const struct TALER_EXCHANGE_WireAccount *accounts)
{
struct Exchange *exchange = cls;
const struct TALER_EXCHANGE_Keys *keys;
@@ -574,10 +611,10 @@ handle_wire_data (void *cls,
keys = TALER_EXCHANGE_get_keys (exchange->conn);
if ( (NULL == keys) ||
(GNUNET_OK !=
- TALER_EXCHANGE_wire_get_fees (&keys->master_pub,
- obj,
- &process_wire_fees,
- exchange)) )
+ process_wire_accounts (exchange,
+ &keys->master_pub,
+ accounts_len,
+ accounts)) )
{
/* Report hard failure to all callbacks! */
struct TMH_EXCHANGES_FindOperation *fo;
@@ -918,18 +955,19 @@ accept_exchanges (void *cls,
const char *section)
{
const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+ char *currency;
char *url;
char *mks;
struct Exchange *exchange;
if (0 != strncasecmp (section,
- "merchant-exchange-",
- strlen ("merchant-exchange-")))
+ "exchange-",
+ strlen ("exchange-")))
return;
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
section,
- "URL",
+ "BASE_URL",
&url))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
@@ -937,6 +975,27 @@ accept_exchanges (void *cls,
"URL");
return;
}
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ section,
+ "CURRENCY",
+ ¤cy))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ section,
+ "CURRENCY");
+ GNUNET_free (url);
+ return;
+ }
+ if (0 != strcasecmp (currency,
+ TMH_currency))
+ {
+ /* trusted exchange, but for a different currency; ignore */
+ GNUNET_free (url);
+ GNUNET_free (currency);
+ return;
+ }
+ GNUNET_free (currency);
exchange = GNUNET_new (struct Exchange);
exchange->url = url;
if (GNUNET_OK ==
diff --git a/src/backend/taler-merchant-httpd_track-transfer.c
b/src/backend/taler-merchant-httpd_track-transfer.c
index 4ce2e59..108d39a 100644
--- a/src/backend/taler-merchant-httpd_track-transfer.c
+++ b/src/backend/taler-merchant-httpd_track-transfer.c
@@ -946,6 +946,8 @@ MH_handler_track_transfer (struct TMH_RequestHandler *rh,
"exchange");
rctx->url = GNUNET_strdup (url);
+ /* FIXME: change again: we probably don't want the wire_method
+ but rather the _account_ (section) here! */
wire_method = MHD_lookup_connection_value (connection,
MHD_GET_ARGUMENT_KIND,
"wire_method");
@@ -955,7 +957,7 @@ MH_handler_track_transfer (struct TMH_RequestHandler *rh,
{
/* temporary work-around until demo is adjusted... */
GNUNET_break (0);
- wire_method = "test";
+ wire_method = "x-taler-bank";
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Client needs fixing, see API change for #4943!\n");
}
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 33a05dd..36d9f75 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -807,12 +807,12 @@ run (void *cls)
deposit_proof = json_object ();
GNUNET_assert (0 ==
json_object_set_new (deposit_proof,
- "test",
+ "x-taler-bank",
json_string ("backenddb test A")));
transfer_proof = json_object ();
GNUNET_assert (0 ==
json_object_set_new (transfer_proof,
- "test",
+ "x-taler-bank",
json_string ("backenddb test B")));
contract = json_object ();
contract_terms = json_object ();
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 1189abe..39acd3a 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -80,7 +80,8 @@ check_PROGRAMS = \
if HAVE_EXPERIMENTAL
if HAVE_TWISTER
- check_PROGRAMS += test_merchant_api_twisted
+# See FIXME_MARCELLO -- had some issues (FTBFS, etc.)
+# check_PROGRAMS += test_merchant_api_twisted
endif
endif
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index b552648..cb2b884 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -35,7 +35,7 @@
/**
* URL under which the merchant is reachable during the testcase.
*/
-#define MERCHANT_URL "http://localhost:8082"
+#define MERCHANT_URL "http://localhost:8080"
/**
* URL under which the exchange is reachable during the testcase.
@@ -48,14 +48,29 @@
#define EXCHANGE_ACCOUNT_NO 2
/**
+ * Account number of the merchant at the bank.
+ */
+#define MERCHANT_ACCOUNT_NO 3
+
+/**
+ * Customer account number.
+ */
+#define TIP_ACCOUNT_NO 62
+
+/**
+ * Customer account number.
+ */
+#define USER_ACCOUNT_NO 63
+
+/**
* URL of the bank.
*/
-#define BANK_URL "http://localhost:8083/"
+#define BANK_URL "http://localhost:8082/"
/**
* On which port do we run the (fake) bank?
*/
-#define BANK_PORT 8083
+#define BANK_PORT 8082
/**
* Max size allowed for an order.
@@ -1072,7 +1087,7 @@ get_instance_priv (struct GNUNET_CONFIGURATION_Handle
*config,
struct GNUNET_CRYPTO_EddsaPrivateKey *ret;
(void) GNUNET_asprintf (&config_section,
- "merchant-instance-%s",
+ "instance-%s",
instance);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_filename (config,
@@ -3159,13 +3174,13 @@ interpreter_run (void *cls)
struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
GNUNET_asprintf (§ion,
- "merchant-instance-%s",
+ "instance-%s",
cmd->details.admin_add_incoming.instance);
if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg,
- section,
-
"TIP_RESERVE_PRIV_FILENAME",
- &keys))
+ GNUNET_CONFIGURATION_get_value_filename (cfg,
+ section,
+
"TIP_RESERVE_PRIV_FILENAME",
+ &keys))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Configuration fails to specify reserve private key
filename in section %s\n",
@@ -3737,7 +3752,6 @@ interpreter_run (void *cls)
"taler-exchange-wirewatch",
"taler-exchange-wirewatch",
"-c", "test_merchant_api.conf",
- "-t", "test", /* use Taler's bank/fakebank
*/
"-T", /* exit when done */
(0 == once ? "-r" : NULL),
NULL);
@@ -3807,7 +3821,7 @@ interpreter_run (void *cls)
= TALER_MERCHANT_track_transfer (ctx,
MERCHANT_URL,
instance,
- "test",
+ "x-taler-bank",
&wtid,
EXCHANGE_URL,
&track_transfer_cb,
@@ -4396,10 +4410,8 @@ run (void *cls)
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-498c",
.details.check_bank_transfer.amount = "EUR:4.98",
- /* exchange-outgoing */
- .details.check_bank_transfer.account_debit = 2,
- /* merchant */
- .details.check_bank_transfer.account_credit = 62
+ .details.check_bank_transfer.account_debit = EXCHANGE_ACCOUNT_NO,
+ .details.check_bank_transfer.account_credit = MERCHANT_ACCOUNT_NO
},
/* Check that there are no other unusual transfers */
@@ -4449,10 +4461,8 @@ run (void *cls)
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-498c-2",
.details.check_bank_transfer.amount = "EUR:4.98",
- /* exchange-outgoing */
- .details.check_bank_transfer.account_debit = 2,
- /* merchant */
- .details.check_bank_transfer.account_credit = 62
+ .details.check_bank_transfer.account_debit = EXCHANGE_ACCOUNT_NO,
+ .details.check_bank_transfer.account_credit = MERCHANT_ACCOUNT_NO
},
/* Check that there are no other unusual transfers */
@@ -4529,7 +4539,7 @@ run (void *cls)
.label = "create-reserve-tip-1",
.expected_response_code = MHD_HTTP_OK,
.details.admin_add_incoming.instance = "tip",
- .details.admin_add_incoming.debit_account_no = 62,
+ .details.admin_add_incoming.debit_account_no = TIP_ACCOUNT_NO,
.details.admin_add_incoming.credit_account_no = EXCHANGE_ACCOUNT_NO,
.details.admin_add_incoming.auth_username = "user62",
.details.admin_add_incoming.auth_password = "pass62",
@@ -4544,7 +4554,7 @@ run (void *cls)
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-tip-1",
.details.check_bank_transfer.amount = "EUR:20.04",
- .details.check_bank_transfer.account_debit = 62,
+ .details.check_bank_transfer.account_debit = TIP_ACCOUNT_NO,
.details.check_bank_transfer.account_credit = EXCHANGE_ACCOUNT_NO
},
/* Authorize two tips */
@@ -4667,10 +4677,8 @@ run (void *cls)
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-tip-498c",
.details.check_bank_transfer.amount = "EUR:4.98",
- /* exchange-outgoing */
- .details.check_bank_transfer.account_debit = 2,
- /* merchant */
- .details.check_bank_transfer.account_credit = 62
+ .details.check_bank_transfer.account_debit = EXCHANGE_ACCOUNT_NO,
+ .details.check_bank_transfer.account_credit = MERCHANT_ACCOUNT_NO
},
/* Check that there are no other unusual transfers */
@@ -4685,7 +4693,7 @@ run (void *cls)
{ .oc = OC_ADMIN_ADD_INCOMING,
.label = "create-reserve-10",
.expected_response_code = MHD_HTTP_OK,
- .details.admin_add_incoming.debit_account_no = 62,
+ .details.admin_add_incoming.debit_account_no = USER_ACCOUNT_NO,
.details.admin_add_incoming.credit_account_no = EXCHANGE_ACCOUNT_NO,
.details.admin_add_incoming.auth_username = "user62",
.details.admin_add_incoming.auth_password = "pass62",
@@ -4696,7 +4704,7 @@ run (void *cls)
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-10",
.details.check_bank_transfer.amount = "EUR:10.02",
- .details.check_bank_transfer.account_debit = 62,
+ .details.check_bank_transfer.account_debit = USER_ACCOUNT_NO,
.details.check_bank_transfer.account_credit = EXCHANGE_ACCOUNT_NO
},
@@ -4774,10 +4782,8 @@ run (void *cls)
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-9.97-10",
.details.check_bank_transfer.amount = "EUR:9.97",
- /* exchange-outgoing */
- .details.check_bank_transfer.account_debit = 2,
- /* merchant */
- .details.check_bank_transfer.account_credit = 62
+ .details.check_bank_transfer.account_debit = EXCHANGE_ACCOUNT_NO,
+ .details.check_bank_transfer.account_credit = MERCHANT_ACCOUNT_NO
},
/* Check that there are no other unusual transfers */
@@ -4792,7 +4798,7 @@ run (void *cls)
{ .oc = OC_ADMIN_ADD_INCOMING,
.label = "create-reserve-11",
.expected_response_code = MHD_HTTP_OK,
- .details.admin_add_incoming.debit_account_no = 62,
+ .details.admin_add_incoming.debit_account_no = USER_ACCOUNT_NO,
.details.admin_add_incoming.credit_account_no = EXCHANGE_ACCOUNT_NO,
.details.admin_add_incoming.auth_username = "user62",
.details.admin_add_incoming.auth_password = "pass62",
@@ -4803,7 +4809,7 @@ run (void *cls)
{ .oc = OC_CHECK_BANK_TRANSFER,
.label = "check_bank_transfer-11",
.details.check_bank_transfer.amount = "EUR:10.02",
- .details.check_bank_transfer.account_debit = 62,
+ .details.check_bank_transfer.account_debit = USER_ACCOUNT_NO,
.details.check_bank_transfer.account_credit = EXCHANGE_ACCOUNT_NO
},
@@ -4949,7 +4955,7 @@ main (int argc,
"test_merchant_api.conf"));
GNUNET_assert (GNUNET_OK ==
GNUNET_CONFIGURATION_get_value_string (cfg,
- "merchant",
+ "TEST",
"INSTANCES",
&_instances));
diff --git a/src/lib/test_merchant_api.conf b/src/lib/test_merchant_api.conf
index ef819e4..dd3cbdb 100644
--- a/src/lib/test_merchant_api.conf
+++ b/src/lib/test_merchant_api.conf
@@ -13,11 +13,13 @@ CURRENCY = EUR
# Configuration for the merchant backend #
##########################################
+[test]
+INSTANCES = default tor
[merchant]
# Which port do we run the backend on? (HTTP server)
-PORT = 8082
+PORT = 8080
# How quickly do we want the exchange to send us our money?
# Used only if the frontend does not specify a value.
@@ -26,91 +28,97 @@ WIRE_TRANSFER_DELAY = 0 s
# Which plugin (backend) do we use for the DB.
DB = postgres
-# Wire format supported by the merchant.
-WIREFORMAT = test
-
-# This option is a list of instances which are to be used
-# during the tests. 'default' instance should explicitly be given.
-# The instance "token" X must match the corresponding substring in
-# section like X-wireformat and merchant-instance-X
-INSTANCES = tor default
-
# Default choice for maximum wire fee.
DEFAULT_MAX_WIRE_FEE = EUR:0.10
-# Default choice for maximum wire fee.
+# Default choice for maximum deposit fee.
DEFAULT_MAX_DEPOSIT_FEE = EUR:0.10
-[exchange-wire-test]
-# Enable 'test' for testing of the actual coin operations.
-ENABLE = YES
-BANK_URL = http://localhost:8083/
-
-# Fees for the forseeable future...
-# If you see this after 2017, update to match the next 10 years...
-WIRE-FEE-2017 = EUR:0.01
-WIRE-FEE-2018 = EUR:0.01
-WIRE-FEE-2019 = EUR:0.01
-WIRE-FEE-2020 = EUR:0.01
-WIRE-FEE-2021 = EUR:0.01
-WIRE-FEE-2022 = EUR:0.01
-WIRE-FEE-2023 = EUR:0.01
-WIRE-FEE-2024 = EUR:0.01
-WIRE-FEE-2025 = EUR:0.01
-WIRE-FEE-2026 = EUR:0.01
-CLOSING-FEE-2017 = EUR:0.01
-CLOSING-FEE-2018 = EUR:0.01
-CLOSING-FEE-2019 = EUR:0.01
-CLOSING-FEE-2020 = EUR:0.01
-CLOSING-FEE-2021 = EUR:0.01
-CLOSING-FEE-2022 = EUR:0.01
-CLOSING-FEE-2023 = EUR:0.01
-CLOSING-FEE-2024 = EUR:0.01
-CLOSING-FEE-2025 = EUR:0.01
-CLOSING-FEE-2026 = EUR:0.01
-
-
-[merchant-exchange-test]
-URL = http://localhost:8081/
-MASTER_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
+# This specifies which database the postgres backend uses.
+[merchantdb-postgres]
+CONFIG = postgres:///talercheck
-[merchant-instance-default]
-KEYFILE = test_merchant.priv
+# Different instances operated by this merchant:
+[instance-default]
+KEYFILE = ${TALER_CONFIG_HOME}/merchant/default.priv
NAME = Kudos Inc.
-[merchant-instance-wireformat-default]
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json
-
-[merchant-instance-tor]
-KEYFILE = tor_merchant.priv
+[instance-tor]
+KEYFILE = ${TALER_CONFIG_HOME}/merchant/tor.priv
NAME = The Tor Project
-[merchant-instance-tip]
-KEYFILE = reserve_tip.priv
+
+[instance-tip]
+KEYFILE = ${TALER_CONFIG_HOME}/merchant/tip.priv
TIP_EXCHANGE = http://localhost:8081/
-TIP_RESERVE_PRIV_FILENAME = reserve_key.priv
+TIP_RESERVE_PRIV_FILENAME = ${TALER_CONFIG_HOME}/merchant/reserve/tip.priv
NAME = Test Tipping Merchant
-[merchant-instance-dtip]
-KEYFILE = reserve_dtip.priv
+
+[instance-dtip]
+KEYFILE = ${TALER_CONFIG_HOME}/merchant/dtip.priv
TIP_EXCHANGE = http://localhost:8081/
-TIP_RESERVE_PRIV_FILENAME = reserve_dkey.priv
+TIP_RESERVE_PRIV_FILENAME = ${TALER_CONFIG_HOME}/merchant/reserve/dtip.priv
NAME = Test Tipping Merchant 2
-[merchant-instance-wireformat-tor]
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json
+# Account of the MERCHANT
+[account-merchant]
+# What is the merchant's bank account?
+URL = "payto://x-taler-bank/localhost:8082/3"
+
+# This is the *salted* response we give out for /contract requests.
+# File is generated on first use, no need for merchants to generate
+# the salt!
+WIRE_RESPONSE = ${TALER_CONFIG_HOME}/merchant/account-3.json
+
+# Which wire plugin should we used to access the account?
+# (use to validate payto://-URL and for back office)
+PLUGIN = taler_bank
+
+# Authentication information for basic authentication
+TALER_BANK_AUTH_METHOD = "basic"
+USERNAME = user
+PASSWORD = pass
+
+# Accept payments to this account in instance-default
+HONOR_default = YES
+
+# Accept payments to this account in instance-tor
+HONOR_tor = YES
+
+# Accept payments to this account in instance-tip
+HONOR_tip = YES
+
+# Accept payments to this account in instance-dtip
+HONOR_dtip = YES
+
+# Advertise in new contracts of instance-default
+ACTIVE_default = YES
-[merchant-instance-wireformat-tip]
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json
+# Advertise in new contracts of instance-default
+ACTIVE_tor = YES
+
+# Advertise in new contracts of instance-default
+ACTIVE_tip = YES
+
+# Advertise in new contracts of instance-default
+ACTIVE_dtip = YES
+
+
+
+# Sections starting with "exchange-" specify trusted exchanges
+# (by the merchant)
+[exchange-kudos]
+MASTER_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
+BASE_URL = "http://localhost:8081/"
+CURRENCY = KUDOS
-[merchant-instance-wireformat-dtip]
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json
# Auditors must be in sections "auditor-", the rest of the section
# name could be anything.
-[merchant-auditor-ezb]
+[auditor-ezb]
# Informal name of the auditor. Just for the user.
NAME = European Central Bank
@@ -122,17 +130,8 @@ URL = http://taler.ezb.eu/
# This is the important bit: the signing key of the auditor.
PUBLIC_KEY = 9QXF7XY7E9VPV47B5Z806NDFSX2VJ79SVHHD29QEQ3BG31ANHZ60
-# This specifies which database we use.
-[merchantdb-postgres]
-CONFIG = postgres:///talercheck
-
-# "wire-" sections include wire details, here for SEPA.
-[wire-sepa]
-IBAN = DE67830654080004822650
-NAME = GNUNET E.V
-BIC = GENODEF1SRL
-SALT = 17919252168512238964
-ADDRESS = "Garching"
+# Which currency is this auditor trusted for?
+CURRENCY = EUR
###################################################
@@ -153,19 +152,57 @@ MASTER_PUBLIC_KEY =
T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG
BASE_URL = "http://localhost:8081/"
[exchangedb-postgres]
-DB_CONN_STR = "postgres:///talercheck"
+CONFIG = "postgres:///talercheck"
+
+[auditordb-postgres]
+CONFIG = postgres:///talercheck
+
+# Account of the EXCHANGE
+[account-exchange]
+# What is the exchange's bank account (with the "Taler Bank" demo system)?
+URL = "payto://x-taler-bank/localhost:8082/2"
-[exchange-wire-test]
# This is the response we give out for the /wire request. It provides
# wallets with the bank information for transfers to the exchange.
-# Note that the _incoming_ account is #3, while the
-# outgoing account of the exchange (see below) is #2.
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/test.json
-
-# What is the main website of the bank?
-BANK_URL = "http://localhost:8083/"
-# From which account at the 'bank' should outgoing wire transfers be made?
-BANK_ACCOUNT_NUMBER = 2
+WIRE_RESPONSE = ${TALER_CONFIG_HOME}/exchange/account-2.json
+
+# Which wire plugin should we used to access the account?
+PLUGIN = taler_bank
+
+# Authentication information for basic authentication
+TALER_BANK_AUTH_METHOD = "basic"
+USERNAME = user
+PASSWORD = pass
+
+ENABLE_DEBIT = YES
+ENABLE_CREDIT = YES
+
+
+# wire fees
+[fees-x-taler-bank]
+
+# Fees for the forseeable future...
+# If you see this after 2018, update to match the next 10 years...
+WIRE-FEE-2018 = EUR:0.01
+WIRE-FEE-2019 = EUR:0.01
+WIRE-FEE-2020 = EUR:0.01
+WIRE-FEE-2021 = EUR:0.01
+WIRE-FEE-2022 = EUR:0.01
+WIRE-FEE-2023 = EUR:0.01
+WIRE-FEE-2024 = EUR:0.01
+WIRE-FEE-2025 = EUR:0.01
+WIRE-FEE-2026 = EUR:0.01
+WIRE-FEE-2027 = EUR:0.01
+CLOSING-FEE-2018 = EUR:0.01
+CLOSING-FEE-2019 = EUR:0.01
+CLOSING-FEE-2020 = EUR:0.01
+CLOSING-FEE-2021 = EUR:0.01
+CLOSING-FEE-2022 = EUR:0.01
+CLOSING-FEE-2023 = EUR:0.01
+CLOSING-FEE-2024 = EUR:0.01
+CLOSING-FEE-2025 = EUR:0.01
+CLOSING-FEE-2026 = EUR:0.01
+CLOSING-FEE-2027 = EUR:0.01
[coin_eur_ct_1]
diff --git
a/src/lib/test_merchant_api_home/.config/taler/exchange/account-2.json
b/src/lib/test_merchant_api_home/.config/taler/exchange/account-2.json
new file mode 100644
index 0000000..ec23ade
--- /dev/null
+++ b/src/lib/test_merchant_api_home/.config/taler/exchange/account-2.json
@@ -0,0 +1,5 @@
+{
+ "url": "payto://x-taler-bank/localhost:8082/2",
+ "salt":
"AX69JV6JVW31AHK24RFH5907T1MVTB901TQD7E9ATFKVM1J734MN62GA3TMSRMCYKJPB7A7G2R5S658216EVM90CNNM7V7V2K6BDR3R",
+ "master_sig":
"C9NT2J22X2Q33FH8GT04ASQSDB60TGZQP61J0D2HDJ52J4X0N7T5K2ZGPTYKGF48XA729CJ8BZ84E006DK15691XXFRF0THNMQSZP0G"
+}
\ No newline at end of file
diff --git
a/src/lib/test_merchant_api_home/.config/taler/merchant/account-3.json
b/src/lib/test_merchant_api_home/.config/taler/merchant/account-3.json
new file mode 100644
index 0000000..2b8a81d
--- /dev/null
+++ b/src/lib/test_merchant_api_home/.config/taler/merchant/account-3.json
@@ -0,0 +1 @@
+{"salt":"NEHC5SP52WZRSZR8CTE3SV2JSZX2C1XFSA75YNRT6YJARRR2ERM32PMTHP16CT6TV7G2CX7T3J28YFP0PJP1PAMAQVT6J76RF3AE34R","url":"payto://x-taler-bank/localhost:8082/3"}
\ No newline at end of file
diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/default.priv
b/src/lib/test_merchant_api_home/.config/taler/merchant/default.priv
new file mode 100644
index 0000000..8299ad2
--- /dev/null
+++ b/src/lib/test_merchant_api_home/.config/taler/merchant/default.priv
@@ -0,0 +1 @@
+~�~j�&i�4q���l�BM:ƾ��Oߪ�#
\ No newline at end of file
diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/dtip.priv
b/src/lib/test_merchant_api_home/.config/taler/merchant/dtip.priv
new file mode 100644
index 0000000..ff3842b
--- /dev/null
+++ b/src/lib/test_merchant_api_home/.config/taler/merchant/dtip.priv
@@ -0,0 +1 @@
+�����47%T������ҟ�\�v}�"hP!��.
\ No newline at end of file
diff --git
a/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/dtip.priv
b/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/dtip.priv
new file mode 100644
index 0000000..c586db1
Binary files /dev/null and
b/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/dtip.priv differ
diff --git
a/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/tip.priv
b/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/tip.priv
new file mode 100644
index 0000000..5ee3bce
--- /dev/null
+++ b/src/lib/test_merchant_api_home/.config/taler/merchant/reserve/tip.priv
@@ -0,0 +1 @@
+��V���<���g�Jΰ�Xc;�K���i�"
\ No newline at end of file
diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/tip.priv
b/src/lib/test_merchant_api_home/.config/taler/merchant/tip.priv
new file mode 100644
index 0000000..ba92072
--- /dev/null
+++ b/src/lib/test_merchant_api_home/.config/taler/merchant/tip.priv
@@ -0,0 +1 @@
+-�ylx;�b�~2�.�l��8P��ĕ���b�
\ No newline at end of file
diff --git a/src/lib/test_merchant_api_home/.config/taler/merchant/tor.priv
b/src/lib/test_merchant_api_home/.config/taler/merchant/tor.priv
new file mode 100644
index 0000000..5d94c71
--- /dev/null
+++ b/src/lib/test_merchant_api_home/.config/taler/merchant/tor.priv
@@ -0,0 +1 @@
+d�\���2��ȈaK���#�+Nf/Fs�lG��
\ No newline at end of file
diff --git
a/src/lib/test_merchant_api_home/.local/share/taler/merchant/merchant.priv
b/src/lib/test_merchant_api_home/.local/share/taler/merchant/merchant.priv
new file mode 100644
index 0000000..fd6e5f7
--- /dev/null
+++ b/src/lib/test_merchant_api_home/.local/share/taler/merchant/merchant.priv
@@ -0,0 +1 @@
+��,�Y%�FF<��R��9ϳ5��v\���k4�6
\ No newline at end of file
diff --git a/src/lib/test_merchant_api_new.c b/src/lib/test_merchant_api_new.c
index d063491..0559a63 100644
--- a/src/lib/test_merchant_api_new.c
+++ b/src/lib/test_merchant_api_new.c
@@ -52,8 +52,7 @@
static const char *pickup_amounts_1[] = {"EUR:5", NULL};
/**
- * URL of the fakebank. Obtained from CONFIG_FILE's
- * "exchange-wire-test:BANK_URI" option.
+ * URL of the fakebank.
*/
static char *fakebank_url;
@@ -83,6 +82,11 @@ static char *exchange_url;
#define USER_ACCOUNT_NO 62
/**
+ * Account number used by the merchant
+ */
+#define MERCHANT_ACCOUNT_NO 3
+
+/**
* User name. Never checked by fakebank.
*/
#define USER_LOGIN_NAME "user42"
@@ -165,7 +169,7 @@ run (void *cls,
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-2",
- "http://localhost:8081/",
+ EXCHANGE_URL,
"EUR:10.02", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1",
@@ -304,31 +308,31 @@ run (void *cls,
TALER_TESTING_cmd_fakebank_transfer ("create-reserve-2",
"EUR:1",
fakebank_url,
- 63, 2,
- "user63",
- "pass63",
+ USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO,
+ "user62",
+ "pass62",
EXCHANGE_URL),
TALER_TESTING_cmd_fakebank_transfer_with_ref
("create-reserve-2b",
"EUR:4.01",
fakebank_url,
- 63, 2,
- "user63",
- "pass63",
+ USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO,
+ "user62",
+ "pass62",
"create-reserve-2",
EXCHANGE_URL),
CMD_EXEC_WIREWATCH ("wirewatch-2"),
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-2",
- "http://localhost:8081/",
- "EUR:1", 63, 2),
+ EXCHANGE_URL,
+ "EUR:1", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO),
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-2",
- "http://localhost:8081/",
- "EUR:4.01", 63, 2),
+ EXCHANGE_URL,
+ "EUR:4.01", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-2",
is->exchange,
@@ -346,12 +350,12 @@ run (void *cls,
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-1"),
CMD_EXEC_AGGREGATOR ("run-aggregator"),
-
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-498c",
- "http://localhost:8081/",
- "EUR:4.98", 2, 62),
-
+ EXCHANGE_URL,
+ "EUR:4.98",
+ EXCHANGE_ACCOUNT_NO,
+ MERCHANT_ACCOUNT_NO),
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-2"),
TALER_TESTING_cmd_merchant_track_transaction
@@ -390,13 +394,12 @@ run (void *cls,
"EUR:0.01"),
CMD_EXEC_AGGREGATOR ("run-aggregator-2"),
-
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-498c-2",
- "http://localhost:8081/",
+ EXCHANGE_URL,
"EUR:4.98",
EXCHANGE_ACCOUNT_NO,
- USER_ACCOUNT_NO),
+ MERCHANT_ACCOUNT_NO),
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty"),
@@ -484,7 +487,7 @@ run (void *cls,
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-tip-1",
- "http://localhost:8081/",
+ EXCHANGE_URL,
"EUR:20.04", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO),
TALER_TESTING_cmd_tip_authorize ("authorize-tip-1",
@@ -632,10 +635,12 @@ run (void *cls,
CMD_EXEC_AGGREGATOR ("aggregator-tip-1"),
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-tip-498c",
- "http://localhost:8081/",
- "EUR:4.98", EXCHANGE_ACCOUNT_NO, USER_ACCOUNT_NO),
+ EXCHANGE_URL,
+ "EUR:4.98",
+ EXCHANGE_ACCOUNT_NO,
+ MERCHANT_ACCOUNT_NO),
TALER_TESTING_cmd_check_bank_empty
- ("check_bank_empty-at-tips"),
+ ("check_bank_empty-at-tips"),
/* pay again logic. */
TALER_TESTING_cmd_fakebank_transfer
@@ -652,7 +657,7 @@ run (void *cls,
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-10",
- "http://localhost:8081/",
+ EXCHANGE_URL,
"EUR:10.02", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-10a",
@@ -717,10 +722,10 @@ run (void *cls,
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-9.97-10",
- "http://localhost:8081/",
+ EXCHANGE_URL,
"EUR:9.97",
EXCHANGE_ACCOUNT_NO,
- USER_ACCOUNT_NO),
+ MERCHANT_ACCOUNT_NO),
TALER_TESTING_cmd_check_bank_empty ("check_bank_empty-10"),
@@ -732,7 +737,7 @@ run (void *cls,
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-11",
- "http://localhost:8081/",
+ EXCHANGE_URL,
"EUR:10.02", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-11a",
@@ -829,16 +834,15 @@ main (int argc,
NULL);
if (NULL ==
- (fakebank_url = TALER_TESTING_prepare_fakebank (CONFIG_FILE)))
+ (fakebank_url = TALER_TESTING_prepare_fakebank (CONFIG_FILE,
+ "account-exchange")))
return 77;
-
if (NULL ==
- (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE)))
+ (merchant_url = TALER_TESTING_prepare_merchant (CONFIG_FILE)))
return 77;
TALER_TESTING_cleanup_files (CONFIG_FILE);
-
switch (TALER_TESTING_prepare_exchange (CONFIG_FILE,
&exchange_url))
{
@@ -858,9 +862,9 @@ main (int argc,
NULL,
CONFIG_FILE);
- GNUNET_OS_process_kill (merchantd, SIGTERM);
- GNUNET_OS_process_wait (merchantd);
- GNUNET_OS_process_destroy (merchantd);
+ GNUNET_OS_process_kill (merchantd, SIGTERM);
+ GNUNET_OS_process_wait (merchantd);
+ GNUNET_OS_process_destroy (merchantd);
GNUNET_free (merchant_url);
if (GNUNET_OK != ret)
diff --git a/src/lib/test_merchant_api_proxy_merchant.conf
b/src/lib/test_merchant_api_proxy_merchant.conf
index 706ac29..065d384 100644
--- a/src/lib/test_merchant_api_proxy_merchant.conf
+++ b/src/lib/test_merchant_api_proxy_merchant.conf
@@ -11,7 +11,7 @@ HTTP_PORT = 8889
# HTTP Destination for twister, so the real
# merchant URL. Note: no trailing '/'!
-DESTINATION_BASE_URL = "http://localhost:8082"
+DESTINATION_BASE_URL = "http://localhost:8080"
# Control port for TCP
# PORT = 8889
diff --git a/src/lib/test_merchant_api_twisted.c
b/src/lib/test_merchant_api_twisted.c
index c2b9a67..e17a4d2 100644
--- a/src/lib/test_merchant_api_twisted.c
+++ b/src/lib/test_merchant_api_twisted.c
@@ -18,7 +18,7 @@
*/
/**
- * @file exchange/test_merchant_api_new.c
+ * @file exchange/test_merchant_api_twisted.c
* @brief testcase to test exchange's HTTP API interface
* @author Sree Harsha Totakura <address@hidden>
* @author Christian Grothoff
@@ -111,6 +111,11 @@ static struct GNUNET_OS_Process *twistermerchantd;
#define EXCHANGE_ACCOUNT_NO 2
/**
+ * Account number of the merchant at the bank.
+ */
+#define MERCHANT_ACCOUNT_NO 3
+
+/**
* Account number of some user.
*/
#define USER_ACCOUNT_NO 62
@@ -476,7 +481,7 @@ run (void *cls,
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-2",
- "http://localhost:8081/",
+ EXCHANGE_URL,
"EUR:2.02", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-1",
@@ -552,7 +557,9 @@ run (void *cls,
deposit fee 0.01 * 2 -
wire fee 0.01
*/
- "EUR:1.97", 2, 62),
+ "EUR:1.97",
+ EXCHANGE_ACCOUNT_NO,
+ MERCHANT_ACCOUNT_NO),
/* Should instead change the response body somehow! */
TALER_TESTING_cmd_modify_object ("hack-0",
@@ -589,7 +596,7 @@ run (void *cls,
TALER_TESTING_cmd_check_bank_transfer
("check_bank_transfer-abort-1",
- "http://localhost:8081/",
+ EXCHANGE_URL,
"EUR:1.01", USER_ACCOUNT_NO, EXCHANGE_ACCOUNT_NO),
TALER_TESTING_cmd_withdraw_amount ("withdraw-coin-abort-1",
@@ -671,11 +678,12 @@ run (void *cls,
"deposit-simple-for-abort",
is->ctx,
0),
+#if FIXME_MARCELLO
TALER_TESTING_cmd_flip_object
("hack-abort-4",
PROXY_MERCHANT_CONFIG_FILE,
"refund_permissions.0.merchant_sig"),
-
+#endif
TALER_TESTING_cmd_pay_abort ("pay-abort-4",
twister_merchant_url,
"deposit-simple-for-abort",
@@ -758,11 +766,12 @@ run (void *cls,
"EUR:1.99", // no sense now
"EUR:0.01"), // no sense now
+#if FIXME_MARCELLO
TALER_TESTING_cmd_flip_object
("hack-coin-history",
PROXY_MERCHANT_CONFIG_FILE,
"history.0.coin_sig"),
-
+#endif
/* Coin history check will fail, due to coin's bad signature. */
TALER_TESTING_cmd_pay ("deposit-simple-fail",
twister_merchant_url,
@@ -802,6 +811,7 @@ purge_process (struct GNUNET_OS_Process *process)
GNUNET_OS_process_destroy (process);
}
+
int
main (int argc,
char * const *argv)
@@ -810,11 +820,12 @@ main (int argc,
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");
- GNUNET_log_setup ("test-merchant-api-new-twisted",
+ GNUNET_log_setup ("test-merchant-api-twisted",
"DEBUG", NULL);
if (NULL == (fakebank_url = TALER_TESTING_prepare_fakebank
- (CONFIG_FILE)))
+ (CONFIG_FILE,
+ "account-exchange")))
return 77;
if (NULL == (merchant_url = TALER_TESTING_prepare_merchant
@@ -876,4 +887,4 @@ main (int argc,
return 0;
}
-/* end of test_merchant_api_new.c */
+/* end of test_merchant_api_twisted.c */
diff --git a/src/lib/test_merchant_api_twisted.conf
b/src/lib/test_merchant_api_twisted.conf
index 3bd9cea..f08fc12 100644
--- a/src/lib/test_merchant_api_twisted.conf
+++ b/src/lib/test_merchant_api_twisted.conf
@@ -1,219 +1,12 @@
# This file is in the public domain.
address@hidden@ test_merchant_api.conf
-[PATHS]
-# Persistant data storage for the testcase
-TALER_TEST_HOME = test_merchant_api_home/
-
-
-[taler]
-# What currency do we use?
-CURRENCY = EUR
-
-##########################################
-# Configuration for the merchant backend #
-##########################################
-
-[merchant]
-
-# Which port do we run the backend on? (HTTP server)
-PORT = 8082
-
-# How quickly do we want the exchange to send us our money?
-# Used only if the frontend does not specify a value.
-WIRE_TRANSFER_DELAY = 0 s
-
-# Which plugin (backend) do we use for the DB.
-DB = postgres
-
-# Wire format supported by the merchant.
-WIREFORMAT = test
-
-# This option is a list of instances which are to be used
-# during the tests. 'default' instance should explicitly be given.
-# The instance "token" X must match the corresponding substring in
-# section like X-wireformat and merchant-instance-X
-INSTANCES = tor default
-
-# Default choice for maximum wire fee.
-DEFAULT_MAX_WIRE_FEE = EUR:0.10
-
-# Default choice for maximum wire fee.
-DEFAULT_MAX_DEPOSIT_FEE = EUR:0.10
-
-[exchange-wire-test]
-# Enable 'test' for testing of the actual coin operations.
-ENABLE = YES
-
-BANK_URL = http://localhost:8083/
-
-# Fees for the forseeable future...
-# If you see this after 2017, update to match the next 10 years...
-WIRE-FEE-2017 = EUR:0.01
-WIRE-FEE-2018 = EUR:0.01
-WIRE-FEE-2019 = EUR:0.01
-WIRE-FEE-2020 = EUR:0.01
-WIRE-FEE-2021 = EUR:0.01
-WIRE-FEE-2022 = EUR:0.01
-WIRE-FEE-2023 = EUR:0.01
-WIRE-FEE-2024 = EUR:0.01
-WIRE-FEE-2025 = EUR:0.01
-WIRE-FEE-2026 = EUR:0.01
-CLOSING-FEE-2017 = EUR:0.01
-CLOSING-FEE-2018 = EUR:0.01
-CLOSING-FEE-2019 = EUR:0.01
-CLOSING-FEE-2020 = EUR:0.01
-CLOSING-FEE-2021 = EUR:0.01
-CLOSING-FEE-2022 = EUR:0.01
-CLOSING-FEE-2023 = EUR:0.01
-CLOSING-FEE-2024 = EUR:0.01
-CLOSING-FEE-2025 = EUR:0.01
-CLOSING-FEE-2026 = EUR:0.01
-
-
-[merchant-exchange-test]
+[exchange-kudos]
# must target the twister's http port.
URL = http://localhost:8888/
-MASTER_KEY = 98NJW3CQHZQGQXTY3K85K531XKPAPAVV4Q5V8PYYRR00NJGZWNVG
-
-[merchant-instance-default]
-KEYFILE = test_merchant.priv
-NAME = Kudos Inc.
-
-[merchant-instance-wireformat-default]
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json
-
-[merchant-instance-tor]
-KEYFILE = tor_merchant.priv
-NAME = The Tor Project
-
-[merchant-instance-tip]
-KEYFILE = reserve_tip.priv
-TIP_EXCHANGE = http://localhost:8081/
-TIP_RESERVE_PRIV_FILENAME = reserve_key.priv
-NAME = Test Tipping Merchant
-
-[merchant-instance-dtip]
-KEYFILE = reserve_dtip.priv
-TIP_EXCHANGE = http://localhost:8088/
-TIP_RESERVE_PRIV_FILENAME = reserve_dkey.priv
-NAME = Test Tipping Merchant 2
-
-[merchant-instance-wireformat-tor]
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json
-
-[merchant-instance-wireformat-tip]
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json
-
-[merchant-instance-wireformat-dtip]
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json
-
-# Auditors must be in sections "auditor-", the rest of the section
-# name could be anything.
-[merchant-auditor-ezb]
-# Informal name of the auditor. Just for the user.
-NAME = European Central Bank
-
-# URL of the auditor (especially for in the future, when the
-# auditor offers an automated issue reporting system).
-# Not really used today.
-URL = http://taler.ezb.eu/
-
-# This is the important bit: the signing key of the auditor.
-PUBLIC_KEY = 9QXF7XY7E9VPV47B5Z806NDFSX2VJ79SVHHD29QEQ3BG31ANHZ60
-
-# This specifies which database we use.
-[merchantdb-postgres]
-CONFIG = postgres:///talercheck
-
-# "wire-" sections include wire details, here for SEPA.
-[wire-sepa]
-IBAN = DE67830654080004822650
-NAME = GNUNET E.V
-BIC = GENODEF1SRL
-SALT = 17919252168512238964
-ADDRESS = "Garching"
-
-##########################
-# Exchange configuration #
-##########################
-
-[exchange]
-# How to access our database
-DB = postgres
-
-# HTTP port the exchange listens to
-PORT = 8081
-
-# Our public key
-MASTER_PUBLIC_KEY = T1VVFQZZARQ1CMF4BN58EE7SKTW5AV2BS18S87ZEGYS4S29J6DNG
-
-# Base URL of the (PROXIED) exchange. This URL is where the
-# twister listens at, so that it will be able to get all the
-# connection addressed to the exchange. In fact, the presence
-# of the twister is 100% transparent to the test case, as it
-# only seeks the exchange/BASE_URL URL to connect to the exchange.
-BASE_URL = "http://localhost:8888/"
-
-[exchangedb-postgres]
-DB_CONN_STR = "postgres:///talercheck"
-
-[exchange-wire-test]
-# This is the response we give out for the /wire request. It provides
-# wallets with the bank information for transfers to the exchange.
-# Note that the _incoming_ account is #3, while the
-# outgoing account of the exchange (see below) is #2.
-TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/test.json
-
-# What is the main website of the bank?
-BANK_URL = "http://localhost:8083/"
-# From which account at the 'bank' should outgoing wire transfers be made?
-BANK_ACCOUNT_NUMBER = 2
-
-
-[coin_eur_ct_1]
-value = EUR:0.01
-duration_overlap = 5 minutes
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.00
-fee_deposit = EUR:0.00
-fee_refresh = EUR:0.01
-fee_refund = EUR:0.01
-rsa_keysize = 1024
-
-[coin_eur_ct_10]
-value = EUR:0.10
-duration_overlap = 5 minutes
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-rsa_keysize = 1024
-
-[coin_eur_1]
-value = EUR:1
-duration_overlap = 5 minutes
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-rsa_keysize = 1024
-[coin_eur_5]
-value = EUR:5
-duration_overlap = 5 minutes
-duration_withdraw = 7 days
-duration_spend = 2 years
-duration_legal = 3 years
-fee_withdraw = EUR:0.01
-fee_deposit = EUR:0.01
-fee_refresh = EUR:0.03
-fee_refund = EUR:0.01
-rsa_keysize = 1024
+# merchant: 8080
+# exchange: 8081
+# bank: 8082
+# twisted-merchant: 8888
+# twisted-control: 8889
diff --git a/src/lib/testing_api_cmd_track.c b/src/lib/testing_api_cmd_track.c
index f3d6338..afcaf83 100644
--- a/src/lib/testing_api_cmd_track.c
+++ b/src/lib/testing_api_cmd_track.c
@@ -199,12 +199,12 @@ track_transfer_run (void *cls,
tts->tth = TALER_MERCHANT_track_transfer (tts->ctx,
tts->merchant_url,
"default",
- "test",
+ "x-taler-bank",
wtid,
exchange_url,
&track_transfer_cb,
tts);
- GNUNET_assert (NULL != tts->tth);
+ GNUNET_assert (NULL != tts->tth);
}
/**
@@ -244,7 +244,7 @@ track_transaction_run (void *cls,
order_id,
&track_transaction_cb,
tts);
-
+
GNUNET_assert (NULL != tts->tth);
}
diff --git a/src/lib/testing_api_helpers.c b/src/lib/testing_api_helpers.c
index bca193c..4213dbc 100644
--- a/src/lib/testing_api_helpers.c
+++ b/src/lib/testing_api_helpers.c
@@ -43,8 +43,30 @@
struct GNUNET_OS_Process *
TALER_TESTING_run_merchant (const char *config_filename)
{
+ struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_OS_Process *merchant_proc;
unsigned int iter;
+ unsigned long long port;
+ char *wget_cmd;
+
+ cfg = GNUNET_CONFIGURATION_create ();
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_load (cfg,
+ config_filename))
+ MERCHANT_FAIL ();
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg,
+ "merchant",
+ "PORT",
+ &port))
+ {
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "merchant",
+ "PORT");
+ GNUNET_CONFIGURATION_destroy (cfg);
+ MERCHANT_FAIL ();
+ }
+ GNUNET_CONFIGURATION_destroy (cfg);
merchant_proc
= GNUNET_OS_start_process (GNUNET_NO,
@@ -57,6 +79,11 @@ TALER_TESTING_run_merchant (const char *config_filename)
if (NULL == merchant_proc)
MERCHANT_FAIL ();
+ GNUNET_asprintf (&wget_cmd,
+ "wget -q -t 1 -T 1 http://127.0.0.1:%llu/"
+ " -o /dev/null -O /dev/null",
+ port);
+
/* give child time to start and bind against the socket */
fprintf (stderr,
"Waiting for `taler-merchant-httpd' to be ready\n");
@@ -65,9 +92,8 @@ TALER_TESTING_run_merchant (const char *config_filename)
{
if (10 == iter)
{
- fprintf (
- stderr,
- "Failed to launch `taler-merchant-httpd' (or `wget')\n");
+ fprintf (stderr,
+ "Failed to launch `taler-merchant-httpd' (or `wget')\n");
GNUNET_OS_process_kill (merchant_proc,
SIGTERM);
GNUNET_OS_process_wait (merchant_proc);
@@ -78,9 +104,8 @@ TALER_TESTING_run_merchant (const char *config_filename)
sleep (1);
iter++;
}
- while (0 != system (
- "wget -q -t 1 -T 1 http://127.0.0.1:8082/" \
- " -o /dev/null -O /dev/null"));
+ while (0 != system (wget_cmd));
+ GNUNET_free (wget_cmd);
fprintf (stderr, "\n");
return merchant_proc;
@@ -99,7 +124,6 @@ TALER_TESTING_run_merchant (const char *config_filename)
char *
TALER_TESTING_prepare_merchant (const char *config_filename)
{
-
struct GNUNET_CONFIGURATION_Handle *cfg;
unsigned long long port;
struct GNUNET_OS_Process *dbinit_proc;
@@ -108,14 +132,15 @@ TALER_TESTING_prepare_merchant (const char
*config_filename)
char *base_url;
cfg = GNUNET_CONFIGURATION_create ();
-
- if (GNUNET_OK != GNUNET_CONFIGURATION_load
- (cfg, config_filename))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_load (cfg,
+ config_filename))
MERCHANT_FAIL ();
-
- if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number
- (cfg, "merchant",
- "PORT", &port))
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_number (cfg,
+ "merchant",
+ "PORT",
+ &port))
{
GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
"merchant",
@@ -126,8 +151,9 @@ TALER_TESTING_prepare_merchant (const char *config_filename)
GNUNET_CONFIGURATION_destroy (cfg);
- if (GNUNET_OK != GNUNET_NETWORK_test_port_free
- (IPPROTO_TCP, (uint16_t) port))
+ if (GNUNET_OK !=
+ GNUNET_NETWORK_test_port_free (IPPROTO_TCP,
+ (uint16_t) port))
{
fprintf (stderr,
"Required port %llu not available, skipping.\n",
@@ -137,14 +163,14 @@ TALER_TESTING_prepare_merchant (const char
*config_filename)
/* DB preparation */
if (NULL ==
- (dbinit_proc = GNUNET_OS_start_process (
- GNUNET_NO,
- GNUNET_OS_INHERIT_STD_ALL,
- NULL, NULL, NULL,
- "taler-merchant-dbinit",
- "taler-merchant-dbinit",
- "-c", "test_merchant_api.conf",
- "-r", NULL)))
+ (dbinit_proc = GNUNET_OS_start_process (GNUNET_NO,
+ GNUNET_OS_INHERIT_STD_ALL,
+ NULL, NULL, NULL,
+ "taler-merchant-dbinit",
+ "taler-merchant-dbinit",
+ "-c", "test_merchant_api.conf",
+ "-r",
+ NULL)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to run taler-merchant-dbinit."
@@ -175,9 +201,10 @@ TALER_TESTING_prepare_merchant (const char
*config_filename)
" `taler-merchant-dbinit'!\n");
MERCHANT_FAIL ();
}
-
GNUNET_OS_process_destroy (dbinit_proc);
+
+
GNUNET_asprintf (&base_url,
"http://localhost:%llu/",
port);
diff --git a/src/merchant-tools/taler-merchant-generate-payments.c
b/src/merchant-tools/taler-merchant-generate-payments.c
index 7d40473..33716b9 100644
--- a/src/merchant-tools/taler-merchant-generate-payments.c
+++ b/src/merchant-tools/taler-merchant-generate-payments.c
@@ -1399,7 +1399,6 @@ interpreter_run (void *cls)
"taler-exchange-wirewatch",
"taler-exchange-wirewatch",
"-c", cfgfilename,
- "-t", "test", /* use Taler's bank/fakebank
*/
"-T", /* exit when done */
NULL);
if (NULL == cmd->details.run_wirewatch.wirewatch_proc)
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [taler-merchant] branch master updated (d880b37 -> c2e039b),
gnunet <=
- [GNUnet-SVN] [taler-merchant] 07/08: update manual, gnunet, 2018/04/15
- [GNUnet-SVN] [taler-merchant] 08/08: fix possible test errors in configure.ac, gnunet, 2018/04/15
- [GNUnet-SVN] [taler-merchant] 04/08: fix misc issues with tests after latest refactoring, gnunet, 2018/04/15
- [GNUnet-SVN] [taler-merchant] 01/08: pre-merge changes towards #4939 patch, gnunet, 2018/04/15
- [GNUnet-SVN] [taler-merchant] 05/08: get tests to pass (again), gnunet, 2018/04/15
- [GNUnet-SVN] [taler-merchant] 06/08: update manual to reflect current options, gnunet, 2018/04/15
- [GNUnet-SVN] [taler-merchant] 03/08: fix more of config files, fix testing_api_helpers logic to deal with merchant ports that are not 8082, gnunet, 2018/04/15
- [GNUnet-SVN] [taler-merchant] 02/08: Towards enabling multiple wire accounts per merchant., gnunet, 2018/04/15