[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-mdb] 02/03: add auto_refund information to contract
From: |
gnunet |
Subject: |
[taler-taler-mdb] 02/03: add auto_refund information to contract |
Date: |
Thu, 05 Dec 2019 16:50:27 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository taler-mdb.
commit 583b2f7d6537e57e072d60cf9979e3fe4ec98c62
Author: Christian Grothoff <address@hidden>
AuthorDate: Thu Dec 5 16:49:09 2019 +0100
add auto_refund information to contract
---
src/Makefile.am | 1 +
src/main.c | 23 ++++++++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index 9eca344..5bd904f 100644
--- 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
index f02f0d9..03b0ae3 100644
--- 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)
{
--
To stop receiving notification emails like this one, please contact
address@hidden.