diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-08 20:51:04 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2017-03-08 20:51:04 +0100 |
commit | bb0d468a4b2ed99a8956973375af40ab4b9a315e (patch) | |
tree | 4be2436f99adeb625e0b3ba3c234f4a04f9c97ef | |
parent | 01bba44dd4c96605c7a798043849637688edebfb (diff) | |
download | merchant-bb0d468a4b2ed99a8956973375af40ab4b9a315e.tar.gz merchant-bb0d468a4b2ed99a8956973375af40ab4b9a315e.tar.bz2 merchant-bb0d468a4b2ed99a8956973375af40ab4b9a315e.zip |
Stub for automatically generating payments.
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/samples/Makefile.am | 21 | ||||
-rw-r--r-- | src/samples/README | 3 | ||||
-rw-r--r-- | src/samples/create_payments.c | 73 | ||||
-rw-r--r-- | src/samples/merchant_create_payments.conf | 0 |
6 files changed, 99 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 99238620..e7287937 100644 --- a/configure.ac +++ b/configure.ac @@ -280,5 +280,6 @@ src/merchant-tools/Makefile src/include/Makefile src/backenddb/Makefile src/backend/Makefile +src/samples/Makefile src/lib/Makefile]) AC_OUTPUT diff --git a/src/Makefile.am b/src/Makefile.am index e58cf01a..16521e08 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,3 +1,3 @@ # This Makefile is in the public domain AM_CPPFLAGS = -I$(top_srcdir)/src/include -SUBDIRS = include backenddb backend lib merchant-tools +SUBDIRS = include backenddb backend lib merchant-tools samples diff --git a/src/samples/Makefile.am b/src/samples/Makefile.am new file mode 100644 index 00000000..f51998dd --- /dev/null +++ b/src/samples/Makefile.am @@ -0,0 +1,21 @@ +# This Makefile.am is in the public domain +AM_CPPFLAGS = -I$(top_srcdir)/src/include + +bin_PROGRAMS = \ + merchant-create-payments + +merchant_create_payments_SOURCES = \ + create_payments.c + +merchant_create_payments_LDADD = \ + $(top_srcdir)/src/backenddb/libtalermerchantdb.la \ + -ltalermerchant \ + $(LIBGCRYPT_LIBS) \ + -ltalerfakebank \ + -ltalerexchange \ + -ltalerjson \ + -ltalerutil \ + -lgnunetjson \ + -lgnunetcurl \ + -lgnunetutil \ + -ljansson diff --git a/src/samples/README b/src/samples/README new file mode 100644 index 00000000..4926db68 --- /dev/null +++ b/src/samples/README @@ -0,0 +1,3 @@ +Here is the logic that creates dummy payments into the +merchant's DB, mainly used for debugging applications that +need some real data from the merchant backend. diff --git a/src/samples/create_payments.c b/src/samples/create_payments.c new file mode 100644 index 00000000..e07f5d12 --- /dev/null +++ b/src/samples/create_payments.c @@ -0,0 +1,73 @@ +/* + This file is part of TALER + Copyright (C) 2014, 2015, 2016 GNUnet e.V. and INRIA + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU Lesser General Public License as published by the Free Software + Foundation; either version 2.1, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with + TALER; see the file COPYING.LGPL. If not, see <http://www.gnu.org/licenses/> +*/ + +#include "platform.h" +#include <taler/taler_exchange_service.h> +#include <taler/taler_fakebank_lib.h> +#include <taler/taler_json_lib.h> +#include <taler/taler_util.h> +#include <taler/taler_signatures.h> +#include "taler_merchant_service.h" +#include "taler_merchantdb_lib.h" +#include <gnunet/gnunet_util_lib.h> +#include <gnunet/gnunet_curl_lib.h> +#include <microhttpd.h> + + +/** + * Handle to database. + */ +struct TALER_MERCHANTDB_Plugin *db; + +/** + * Configuration handle. + */ +struct GNUNET_CONFIGURATION_Handle *cfg; + + +int +main () +{ + struct GNUNET_OS_Process *proc; + struct GNUNET_OS_Process *exchanged; + struct GNUNET_OS_Process *merchantd; + unsigned int cnt; + 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"); + GNUNET_log_setup ("merchant-create-payments", + "DEBUG", + NULL); + cfg = GNUNET_CONFIGURATION_create (); + GNUNET_assert (GNUNET_OK == + GNUNET_CONFIGURATION_load (cfg, + "merchant_create_payments.conf")); + + db = TALER_MERCHANTDB_plugin_load (cfg); + if (NULL == db) + { + GNUNET_CONFIGURATION_destroy (cfg); + return 77; + } + +} diff --git a/src/samples/merchant_create_payments.conf b/src/samples/merchant_create_payments.conf new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/samples/merchant_create_payments.conf |