taler-mdb

GNU Taler Extensions and Integrations
Log | Files | Refs | Submodules | README | LICENSE

commit f53522a3bb661e64228dbaed6b660d819990a721
parent 01cc8d8cdc9079d58ff5d0458809bb5caa2e4964
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  5 Dec 2019 16:50:23 +0100

merge

Diffstat:
Msrc/Makefile.am | 3++-
Msrc/main.c | 21++++++++++++++++++---
2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am @@ -7,11 +7,12 @@ if USE_COVERAGE endif taler_mdb_SOURCES = \ - main.c + main.c taler_mdb_LDADD = \ -ltalermerchant \ -ltalerjson \ -ltalerutil \ + -lgnunetjson \ -lgnunetcurl \ -lgnunetutil \ -ljansson \ diff --git a/src/main.c b/src/main.c @@ -49,6 +49,7 @@ along with #include <nfc/nfc.h> #include <microhttpd.h> #include <gnunet/gnunet_util_lib.h> +#include <gnunet/gnunet_json_lib.h> #include <taler/taler_json_lib.h> #include <taler/taler_merchant_service.h> #if HAVE_QRENCODE_H /* for adafruit pitft display */ @@ -86,6 +87,18 @@ along with #define MAX_HTTP_RETRY_FREQ GNUNET_TIME_relative_multiply ( \ GNUNET_TIME_UNIT_MILLISECONDS, 500) +#define MAX_HTTP_RETRY_FREQ GNUNET_TIME_relative_multiply ( \ + GNUNET_TIME_UNIT_MILLISECONDS, 500) + +/** + * How long could it take at most for us to notify the Taler merchant + * backend to grant a refund to a user if dispensing the product + * failed? (Very conservative value here, for vending machines brewing + * coffee or something complex that could fail.) + */ +#define MAX_REFUND_DELAY GNUNET_TIME_relative_multiply ( \ + GNUNET_TIME_UNIT_MINUTES, 5) + /** * Code returned by libnfc in case of success. */ @@ -1136,10 +1149,12 @@ launch_payment (const struct Product *product) uuid_s); GNUNET_free (uuid_s); /* create the json object for the order request */ - orderReq = json_pack ("{ s:s, s:o, s:s }", + orderReq = json_pack ("{ s:s, s:o, s:s, s:o }", "summary", product->description, "amount", TALER_JSON_from_amount (&product->price), - "fulfillment_url", fulflmntUrl); + "fulfillment_url", fulflmntUrl, + "auto_refund", GNUNET_JSON_from_time_rel ( + MAX_REFUND_DELAY)); GNUNET_free (fulflmntUrl); if (NULL == orderReq) { @@ -1302,7 +1317,7 @@ read_keyboard_command (void *cls) static void start_read_keyboard () { - struct GNUNET_DISK_FileHandle fh = { STDIN_FILENO }; + static struct GNUNET_DISK_FileHandle fh = { STDIN_FILENO }; GNUNET_assert (NULL == keyboard_task); if (NULL == payment_activity)