summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-07-24 09:00:35 +0200
committerChristian Grothoff <christian@grothoff.org>2021-07-24 09:00:35 +0200
commit42decef957861689c41d16a0dcfa8af3d9052816 (patch)
treeed55c4e5a2e2a4b8d2880fe10c8f82173cf0a11e /src/include
parent325b60989faadb54213af578bb9b1b705d022726 (diff)
downloadexchange-42decef957861689c41d16a0dcfa8af3d9052816.tar.gz
exchange-42decef957861689c41d16a0dcfa8af3d9052816.tar.bz2
exchange-42decef957861689c41d16a0dcfa8af3d9052816.zip
fix #6939 in exchange
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_json_lib.h41
1 files changed, 40 insertions, 1 deletions
diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h
index 145a5d2e..1089f5bd 100644
--- a/src/include/taler_json_lib.h
+++ b/src/include/taler_json_lib.h
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2014, 2015, 2016 Taler Systems SA
+ Copyright (C) 2014, 2015, 2016, 2021 Taler Systems SA
TALER is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
@@ -59,33 +59,70 @@ TALER_JSON_from_amount_nbo (const struct TALER_AmountNBO *amount);
/**
* Provide specification to parse given JSON object to an amount.
+ * The @a currency must be a valid pointer while the
+ * parsing is done, a copy is not made.
*
* @param name name of the amount field in the JSON
+ * @param currency the currency the amount must be in
* @param[out] r_amount where the amount has to be written
+ * @return spec for parsing an amount
*/
struct GNUNET_JSON_Specification
TALER_JSON_spec_amount (const char *name,
+ const char *currency,
struct TALER_Amount *r_amount);
/**
* Provide specification to parse given JSON object to an amount
* in network byte order.
+ * The @a currency must be a valid pointer while the
+ * parsing is done, a copy is not made.
*
* @param name name of the amount field in the JSON
+ * @param currency the currency the amount must be in
* @param[out] r_amount where the amount has to be written
+ * @return spec for parsing an amount
*/
struct GNUNET_JSON_Specification
TALER_JSON_spec_amount_nbo (const char *name,
+ const char *currency,
struct TALER_AmountNBO *r_amount);
/**
+ * Provide specification to parse given JSON object to an amount
+ * in any currency.
+ *
+ * @param name name of the amount field in the JSON
+ * @param[out] r_amount where the amount has to be written
+ * @return spec for parsing an amount
+ */
+struct GNUNET_JSON_Specification
+TALER_JSON_spec_amount_any (const char *name,
+ struct TALER_Amount *r_amount);
+
+
+/**
+ * Provide specification to parse given JSON object to an amount
+ * in any currency in network byte order.
+ *
+ * @param name name of the amount field in the JSON
+ * @param[out] r_amount where the amount has to be written
+ * @return spec for parsing an amount
+ */
+struct GNUNET_JSON_Specification
+TALER_JSON_spec_amount_any_nbo (const char *name,
+ struct TALER_AmountNBO *r_amount);
+
+
+/**
* Provide specification to parse given JSON object to an absolute time.
* The absolute time value is expected to be already rounded.
*
* @param name name of the time field in the JSON
* @param[out] r_time where the time has to be written
+ * @return spec for parsing an absolute time
*/
struct GNUNET_JSON_Specification
TALER_JSON_spec_absolute_time (const char *name,
@@ -99,6 +136,7 @@ TALER_JSON_spec_absolute_time (const char *name,
*
* @param name name of the time field in the JSON
* @param[out] r_time where the time has to be written
+ * @return spec for parsing an absolute time
*/
struct GNUNET_JSON_Specification
TALER_JSON_spec_absolute_time_nbo (const char *name,
@@ -111,6 +149,7 @@ TALER_JSON_spec_absolute_time_nbo (const char *name,
*
* @param name name of the time field in the JSON
* @param[out] r_time where the time has to be written
+ * @return spec for parsing a relative time
*/
struct GNUNET_JSON_Specification
TALER_JSON_spec_relative_time (const char *name,