merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit c62753b28a034787d6920cfec40bda817ace4b54
parent eb2726fe3875db34bb459ab0010efd5e944a7451
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Thu,  9 Mar 2017 12:07:15 +0100

Up to the point where payments generator launches
exchange and merchant.

Diffstat:
Msrc/samples/generate_payments.c | 72+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
Asrc/samples/generate_payments_home/.config/taler/merchant/wire/test.json | 5+++++
Msrc/samples/merchant_generate_payments.conf | 32++++++++++++++++++++++++++++++++
Asrc/samples/test_merchant.priv | 2++
4 files changed, 108 insertions(+), 3 deletions(-)

diff --git a/src/samples/generate_payments.c b/src/samples/generate_payments.c @@ -26,6 +26,9 @@ #include <gnunet/gnunet_curl_lib.h> #include <microhttpd.h> +#define EXCHANGE_URI "http://localhost:8081/" + +#define MERCHANT_URI "http://localhost:8082" /** * Configuration handle. @@ -108,8 +111,71 @@ main () return 77; } - /*Remove this!*/ - GNUNET_OS_process_wait (exchanged); - GNUNET_OS_process_destroy (exchanged); + fprintf (stderr, + "Waiting for taler-exchange-httpd to be ready\n"); + cnt = 0; + do + { + fprintf (stderr, "."); + sleep (1); + cnt++; + if (cnt > 60) + { + fprintf (stderr, + "\nFailed to start taler-exchange-httpd\n"); + GNUNET_OS_process_kill (exchanged, + SIGKILL); + GNUNET_OS_process_wait (exchanged); + GNUNET_OS_process_destroy (exchanged); + return 77; + } + } + while (0 != system ("wget -q -t 1 -T 1 " EXCHANGE_URI "keys -o /dev/null -O /dev/null")); + fprintf (stderr, "\n"); + + merchantd = GNUNET_OS_start_process (GNUNET_NO, + GNUNET_OS_INHERIT_STD_ALL, + NULL, NULL, NULL, + "taler-merchant-httpd", + "taler-merchant-httpd", + "-c", "merchant_generate_payments.conf", + "-L", "DEBUG", + NULL); + if (NULL == merchantd) + { + fprintf (stderr, + "Failed to run taler-merchant-httpd. Check your PATH.\n"); + GNUNET_OS_process_kill (exchanged, + SIGKILL); + GNUNET_OS_process_wait (exchanged); + GNUNET_OS_process_destroy (exchanged); + return 77; + } + /* give child time to start and bind against the socket */ + fprintf (stderr, + "Waiting for taler-merchant-httpd to be ready\n"); + cnt = 0; + do + { + fprintf (stderr, "."); + sleep (1); + cnt++; + if (cnt > 60) + { + fprintf (stderr, + "\nFailed to start taler-merchant-httpd\n"); + GNUNET_OS_process_kill (merchantd, + SIGKILL); + GNUNET_OS_process_wait (merchantd); + GNUNET_OS_process_destroy (merchantd); + GNUNET_OS_process_kill (exchanged, + SIGKILL); + GNUNET_OS_process_wait (exchanged); + GNUNET_OS_process_destroy (exchanged); + return 77; + } + } + while (0 != system ("wget -q -t 1 -T 1 " MERCHANT_URI " -o /dev/null -O /dev/null")); + fprintf (stderr, "\n"); } diff --git a/src/samples/generate_payments_home/.config/taler/merchant/wire/test.json b/src/samples/generate_payments_home/.config/taler/merchant/wire/test.json @@ -0,0 +1,5 @@ +{ + "type":"test", + "bank_uri":"http://localhost:8083/", + "account_number":62 +} diff --git a/src/samples/merchant_generate_payments.conf b/src/samples/merchant_generate_payments.conf @@ -98,3 +98,35 @@ fee_deposit = EUR:0.01 fee_refresh = EUR:0.03 fee_refund = EUR:0.01 rsa_keysize = 1024 + + +[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. +# FIXME: EDATE is a bit short, 'execution_delay'? +EDATE = 3 week + +# Which plugin (backend) do we use for the DB. +DB = postgres + +# Wire format supported by the merchant. +WIREFORMAT = test + +INSTANCES = default + +[merchant-exchange-test] +URI = http://localhost:8081/ +MASTER_KEY = BNFX90SBRFRMFW7E598BKVH6CTM83YD2AAKRZ0ADGH15M1XXJGBG + +[merchant-instance-default] +KEYFILE = test_merchant.priv + +[merchant-instance-wireformat-default] +TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/merchant/wire/test.json + +[merchantdb-postgres] +CONFIG = postgres:///taler diff --git a/src/samples/test_merchant.priv b/src/samples/test_merchant.priv @@ -0,0 +1 @@ +`ì&-Èí–ñ./öÀ¿ jxÌGÝ¢O:6l,ζXT4í +\ No newline at end of file