From 42decef957861689c41d16a0dcfa8af3d9052816 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Sat, 24 Jul 2021 09:00:35 +0200 Subject: fix #6939 in exchange --- src/include/taler_json_lib.h | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'src/include') diff --git a/src/include/taler_json_lib.h b/src/include/taler_json_lib.h index 145a5d2e2..1089f5bdf 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, -- cgit v1.2.3