[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-mdb] branch master updated: use pack
From: |
gnunet |
Subject: |
[taler-taler-mdb] branch master updated: use pack |
Date: |
Wed, 18 May 2022 18:12:38 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository taler-mdb.
The following commit(s) were added to refs/heads/master by this push:
new cb081e0 use pack
new 12afb98 Merge branch 'master' of git+ssh://git.taler.net/taler-mdb
cb081e0 is described below
commit cb081e0d19d9fa945b1d8cf2487aa25b9d6404da
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed May 18 18:12:23 2022 +0200
use pack
---
src/main.c | 53 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 30 insertions(+), 23 deletions(-)
diff --git a/src/main.c b/src/main.c
index c6ab55d..5fbd355 100644
--- a/src/main.c
+++ b/src/main.c
@@ -73,6 +73,16 @@ along with
#define BACKEND_POLL_TIMEOUT GNUNET_TIME_relative_multiply ( \
GNUNET_TIME_UNIT_MINUTES, 5)
+/**
+ * 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)
+
+
#define NFC_FAILURE_RETRY_FREQ GNUNET_TIME_UNIT_SECONDS
/**
@@ -91,15 +101,6 @@ along with
#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.
*/
@@ -1560,20 +1561,26 @@ launch_payment (struct Product *product)
/* create the json object for the order request */
if (NULL != product->preview)
{
- orderReq = json_pack (
- "{ s:s, s:[ { s:s, s:s, s:o, s:I } ], s:o, s:s, s:o }",
- "summary", product->description,
- "products",
- /* */ "description", product->description,
- /* */ "image", product->preview,
- /* */ "price", TALER_JSON_from_amount (
- &product->price),
- /* */ "quantity", (json_int_t) 1,
- "amount", TALER_JSON_from_amount (&product->price),
- "fulfillment_message", msg,
- "auto_refund", GNUNET_JSON_from_time_rel (
- MAX_REFUND_DELAY)
- );
+ orderReq = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("summary",
+ product->description),
+ GNUNET_JSON_pack_object_steal (
+ "products",
+ GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_string ("description",
+ product->description),
+ GNUNET_JSON_pack_string ("image",
+ product->preview),
+ TALER_JSON_pack_amount ("price",
+ &product->price),
+ GNUNET_JSON_pack_uint64 ("quantity",
+ 1))),
+ TALER_JSON_pack_amount ("amount",
+ &product->price),
+ GNUNET_JSON_pack_string ("fulfillment_message",
+ msg),
+ GNUNET_JSON_pack_time_rel ("auto_refund",
+ MAX_REFUND_DELAY));
}
else
{
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-taler-mdb] branch master updated: use pack,
gnunet <=