taler-mdb

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

commit 583b2f7d6537e57e072d60cf9979e3fe4ec98c62
parent e4245d88e28d9678980593809e367bab82f1275c
Author: Christian Grothoff <christian@grothoff.org>
Date:   Thu,  5 Dec 2019 16:49:09 +0100

add auto_refund information to contract

Diffstat:
Msrc/Makefile.am | 1+
Msrc/main.c | 23++++++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am @@ -12,6 +12,7 @@ taler_nfc_LDADD = \ -ltalermerchant \ -ltalerjson \ -ltalerutil \ + -lgnunetjson \ -lgnunetcurl \ -lgnunetutil \ -ljansson \ diff --git a/src/main.c b/src/main.c @@ -44,6 +44,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 */ @@ -70,6 +71,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. */ @@ -85,9 +98,6 @@ along with #define UID_LEN_LOWER 4 -/* curl auth header */ -#define SNACK_CURL_AUTH_HEADER "Authorization" - /** * @brief FRAMEBUFFER_DEVICE framebuffer device to diplay qr code */ @@ -276,6 +286,7 @@ show_qrcode (const char *uri) write (qrDisplay.backlightfd, "1", 1); } + #endif @@ -743,10 +754,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) {