commit f36f501da6dce0223da07f59f4989c41bdda4ff2
parent 49317c7d1787ee7c5917490dd14eae04a9249f11
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Sat, 17 Jan 2026 14:18:35 +0100
gana update, plus fix crash if array of amounts is optional
Diffstat:
3 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/src/include/taler/taler_error_codes.h b/src/include/taler/taler_error_codes.h
@@ -3863,6 +3863,30 @@ enum TALER_ErrorCode
/**
+ * The selected template has a different type than the one specified in the request of the client. This may happen if the template was updated since the last time the client fetched it. The client should re-fetch the current template and send a request of the correct type.
+ * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ TALER_EC_MERCHANT_POST_USING_TEMPLATES_WRONG_TYPE = 2864,
+
+
+ /**
+ * The selected template does not allow one of the specified products to be included in the order. This may happen if the template was updated since the last time the client fetched it. The client should re-fetch the current template and send a request of the correct type.
+ * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ TALER_EC_MERCHANT_POST_USING_TEMPLATES_WRONG_PRODUCT = 2865,
+
+
+ /**
+ * The selected combination of products does not allow the backend to compute a price for the order in any of the supported currencies. This may happen if the template was updated since the last time the client fetched it or if the wallet assembled an unsupported combination of products. The site administrator might want to specify additional prices for products, while the client should re-fetch the current template and send a request with a combination of products for which prices exist in the same currency.
+ * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ TALER_EC_MERCHANT_POST_USING_TEMPLATES_NO_CURRENCY = 2866,
+
+
+ /**
* The webhook ID elready exists.
* Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
* (A value of 0 indicates that the error is generated client-side).
diff --git a/src/json/json_helper.c b/src/json/json_helper.c
@@ -249,6 +249,8 @@ TALER_JSON_spec_amount_any_array (const char *field,
GNUNET_assert (NULL != amounts_len);
GNUNET_assert (NULL != amounts);
+ *amounts = NULL;
+ *amounts_len = 0;
ctx = GNUNET_new (struct AmountArrayCtx);
ctx->len = amounts_len;
{
@@ -2163,6 +2165,7 @@ TALER_JSON_spec_array_of_data (
GNUNET_assert (0< entry_size);
GNUNET_assert (NULL != entries);
+ *entries = NULL;
cls = GNUNET_new (struct closure_array_of_data);
cls->num_entries = num_entries;
cls->entry_size = entry_size;
diff --git a/src/util/taler_error_codes.c b/src/util/taler_error_codes.c
@@ -3835,6 +3835,30 @@ static const struct ErrorCodeAndHint code_hint_pairs[] = {
},
{
+ /* 2864 */
+ .ec = TALER_EC_MERCHANT_POST_USING_TEMPLATES_WRONG_TYPE,
+ .hint = gettext_noop (
+ "The selected template has a different type than the one specified in the request of the client. This may happen if the template was updated since the last time the client fetched it. The client should re-fetch the current template and send a request of the correct type."),
+ .http_code = MHD_HTTP_CONFLICT
+ },
+
+ {
+ /* 2865 */
+ .ec = TALER_EC_MERCHANT_POST_USING_TEMPLATES_WRONG_PRODUCT,
+ .hint = gettext_noop (
+ "The selected template does not allow one of the specified products to be included in the order. This may happen if the template was updated since the last time the client fetched it. The client should re-fetch the current template and send a request of the correct type."),
+ .http_code = MHD_HTTP_CONFLICT
+ },
+
+ {
+ /* 2866 */
+ .ec = TALER_EC_MERCHANT_POST_USING_TEMPLATES_NO_CURRENCY,
+ .hint = gettext_noop (
+ "The selected combination of products does not allow the backend to compute a price for the order in any of the supported currencies. This may happen if the template was updated since the last time the client fetched it or if the wallet assembled an unsupported combination of products. The site administrator might want to specify additional prices for products, while the client should re-fetch the current template and send a request with a combination of products for which prices exist in the same currency."),
+ .http_code = MHD_HTTP_CONFLICT
+ },
+
+ {
/* 2900 */
.ec = TALER_EC_MERCHANT_PRIVATE_POST_WEBHOOKS_CONFLICT_WEBHOOK_EXISTS,
.hint = gettext_noop ("The webhook ID elready exists."),
@@ -5595,7 +5619,7 @@ static const struct ErrorCodeAndHint code_hint_pairs[] = {
/**
* The length of @e code_hint_pairs.
*/
-static const unsigned int code_hint_pairs_length = 700;
+static const unsigned int code_hint_pairs_length = 703;
const char *