merchant

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

commit 2f21b910db7db7735acd7c4227dd50658a16c149
parent d5b6f87e66e7ef7bde45d41845c1cf6c14cb8aac
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Wed,  8 Mar 2017 22:24:08 +0100

Advancing with configuration for the payments generator.

Diffstat:
Msrc/samples/generate_payments.c | 66++++++++++++++++++++++++++++++++++++++++++++++++++++++------------
Dsrc/samples/merchant_create_payments.conf | 0
Asrc/samples/merchant_generate_payments.conf | 100+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 154 insertions(+), 12 deletions(-)

diff --git a/src/samples/generate_payments.c b/src/samples/generate_payments.c @@ -28,11 +28,6 @@ /** - * Handle to database. - */ -struct TALER_MERCHANTDB_Plugin *db; - -/** * Configuration handle. */ struct GNUNET_CONFIGURATION_Handle *cfg; @@ -48,10 +43,7 @@ main () struct GNUNET_SIGNAL_Context *shc_chld; - /*** Very beginning ***/ /* 1 Launch exchange */ - /* 2 Launch merchant */ - /* 3 What about the bank? */ unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); @@ -61,13 +53,63 @@ main () cfg = GNUNET_CONFIGURATION_create (); GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (cfg, - "merchant_create_payments.conf")); + "merchant_generate_payments.conf")); + + + proc = GNUNET_OS_start_process (GNUNET_NO, + GNUNET_OS_INHERIT_STD_ALL, + NULL, NULL, NULL, + "taler-exchange-keyup", + "taler-exchange-keyup", + "-c", "merchant_generate_payments.conf", + NULL); + if (NULL == proc) + { + fprintf (stderr, + "Failed to run taler-exchange-keyup. Check your PATH.\n"); + return 77; + } - db = TALER_MERCHANTDB_plugin_load (cfg); - if (NULL == db) + + GNUNET_OS_process_wait (proc); + GNUNET_OS_process_destroy (proc); + + proc = GNUNET_OS_start_process (GNUNET_NO, + GNUNET_OS_INHERIT_STD_ALL, + NULL, NULL, NULL, + "taler-exchange-dbinit", + "taler-exchange-dbinit", + "-c", "merchant_generate_payments.conf", + "-r", + NULL); + if (NULL == proc) + { + fprintf (stderr, + "Failed to run taler-exchange-dbinit. Check your PATH.\n"); + return 77; + } + GNUNET_OS_process_wait (proc); + GNUNET_OS_process_destroy (proc); + + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "About to launch the exchange.\n"); + + exchanged = GNUNET_OS_start_process (GNUNET_NO, + GNUNET_OS_INHERIT_STD_ALL, + NULL, NULL, NULL, + "taler-exchange-httpd", + "taler-exchange-httpd", + "-c", "merchant_generate_payments.conf", + NULL); + if (NULL == exchanged) { - GNUNET_CONFIGURATION_destroy (cfg); + fprintf (stderr, + "Failed to run taler-exchange-httpd. Check your PATH.\n"); return 77; } + /*Remove this!*/ + GNUNET_OS_process_wait (exchanged); + GNUNET_OS_process_destroy (exchanged); + } diff --git a/src/samples/merchant_create_payments.conf b/src/samples/merchant_create_payments.conf diff --git a/src/samples/merchant_generate_payments.conf b/src/samples/merchant_generate_payments.conf @@ -0,0 +1,100 @@ +# This file is in the public domain. +# +[PATHS] +# Persistant data storage for the testcase +TALER_TEST_HOME = generate_payments_home/ + +[taler] +# What currency do we use? +CURRENCY = EUR + +[exchange-wire-test] +# Enable 'test' for testing of the actual coin operations. +ENABLE = YES + +# 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 + +############################ +# Exchange's configuration # +############################ + +[exchange] +# How to access our database +DB = postgres + +# HTTP port the exchange listens to +PORT = 8081 + +# Our public key +MASTER_PUBLIC_KEY = BNFX90SBRFRMFW7E598BKVH6CTM83YD2AAKRZ0ADGH15M1XXJGBG + +# This value must match the DB we want payments to persist in. +[exchangedb-postgres] +DB_CONN_STR = "postgres:///taler" + + +[exchange-wire-incoming-test] +TEST_RESPONSE_FILE = ${TALER_CONFIG_HOME}/test.signed.json + +[exchange-wire-outgoing-test] +BANK_URI = "http://localhost:8083/" +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