commit 271777c17fbfea65edb5781cb9758ca27a4d1f86
parent cdadb3079037c3ed2cf91edc16934d4a841a55b2
Author: Christian Grothoff <christian@grothoff.org>
Date: Wed, 25 Mar 2026 22:09:13 +0100
-fix behavior to match spec more closely
Diffstat:
7 files changed, 47 insertions(+), 49 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_patch-private-categories-CATEGORY_ID.c b/src/backend/taler-merchant-httpd_patch-private-categories-CATEGORY_ID.c
@@ -37,12 +37,15 @@ TMH_private_patch_categories_ID (const struct TMH_RequestHandler *rh,
unsigned long long cnum;
char dummy;
const char *category_name;
- const json_t *category_name_i18n;
+ json_t *oempty = NULL;
+ const json_t *category_name_i18n = NULL;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("name",
&category_name),
- GNUNET_JSON_spec_object_const ("name_i18n",
- &category_name_i18n),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_object_const ("name_i18n",
+ &category_name_i18n),
+ NULL),
GNUNET_JSON_spec_end ()
};
enum GNUNET_DB_QueryStatus qs;
@@ -72,12 +75,19 @@ TMH_private_patch_categories_ID (const struct TMH_RequestHandler *rh,
? MHD_YES
: MHD_NO;
}
+ if (NULL == category_name_i18n)
+ {
+ /* NULL is not allowed in the DB, substitute with empty object */
+ oempty = json_object ();
+ category_name_i18n = oempty;
+ }
qs = TMH_db->update_category (TMH_db->cls,
mi->settings.id,
cnum,
category_name,
category_name_i18n);
+ json_decref (oempty);
{
MHD_RESULT ret = MHD_NO;
diff --git a/src/backend/taler-merchant-httpd_patch-private-reports-REPORT_ID.c b/src/backend/taler-merchant-httpd_patch-private-reports-REPORT_ID.c
@@ -38,7 +38,8 @@ TMH_private_patch_report (const struct TMH_RequestHandler *rh,
const char *data_source;
const char *target_address;
struct GNUNET_TIME_Relative frequency;
- struct GNUNET_TIME_Relative frequency_shift;
+ struct GNUNET_TIME_Relative frequency_shift
+ = GNUNET_TIME_UNIT_ZERO;
enum GNUNET_DB_QueryStatus qs;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("description",
@@ -53,8 +54,10 @@ TMH_private_patch_report (const struct TMH_RequestHandler *rh,
&target_address),
GNUNET_JSON_spec_relative_time ("report_frequency",
&frequency),
- GNUNET_JSON_spec_relative_time ("report_frequency_shift",
- &frequency_shift),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_relative_time ("report_frequency_shift",
+ &frequency_shift),
+ NULL),
GNUNET_JSON_spec_end ()
};
diff --git a/src/backend/taler-merchant-httpd_post-private-categories.c b/src/backend/taler-merchant-httpd_post-private-categories.c
@@ -40,13 +40,16 @@ TMH_private_post_categories (const struct TMH_RequestHandler *rh,
{
struct TMH_MerchantInstance *mi = hc->instance;
const char *category_name;
- const json_t *category_name_i18n;
+ const json_t *category_name_i18n = NULL;
+ json_t *oempty = NULL;
uint64_t category_id;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_string ("name",
&category_name),
- GNUNET_JSON_spec_object_const ("name_i18n",
- &category_name_i18n),
+ GNUNET_JSON_spec_mark_optional (
+ GNUNET_JSON_spec_object_const ("name_i18n",
+ &category_name_i18n),
+ NULL),
GNUNET_JSON_spec_end ()
};
enum GNUNET_DB_QueryStatus qs;
@@ -66,7 +69,18 @@ TMH_private_post_categories (const struct TMH_RequestHandler *rh,
: MHD_NO;
}
}
-
+ if (NULL == category_name_i18n)
+ {
+ /* NULL is not allowed in the DB, substitute with empty object */
+ oempty = json_object ();
+ category_name_i18n = oempty;
+ }
+ if (NULL == category_name_i18n)
+ {
+ /* NULL is not allowed in the DB, substitute with empty object */
+ oempty = json_object ();
+ category_name_i18n = oempty;
+ }
/* finally, interact with DB until no serialization error */
for (unsigned int i = 0; i<MAX_RETRIES; i++)
{
@@ -78,6 +92,7 @@ TMH_private_post_categories (const struct TMH_RequestHandler *rh,
{
GNUNET_break (0);
GNUNET_JSON_parse_free (spec);
+ json_decref (oempty);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GENERIC_DB_START_FAILED,
@@ -95,6 +110,7 @@ TMH_private_post_categories (const struct TMH_RequestHandler *rh,
GNUNET_break (0);
TMH_db->rollback (TMH_db->cls);
GNUNET_JSON_parse_free (spec);
+ json_decref (oempty);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
TALER_EC_GENERIC_DB_FETCH_FAILED,
@@ -115,6 +131,7 @@ TMH_private_post_categories (const struct TMH_RequestHandler *rh,
json_decref (xcategory_name_i18n);
TMH_db->rollback (TMH_db->cls);
GNUNET_JSON_parse_free (spec);
+ json_decref (oempty);
return eq
? TALER_MHD_REPLY_JSON_PACK (connection,
MHD_HTTP_OK,
@@ -147,6 +164,7 @@ retry:
GNUNET_assert (GNUNET_DB_STATUS_SOFT_ERROR == qs);
TMH_db->rollback (TMH_db->cls);
} /* for RETRIES loop */
+ json_decref (oempty);
GNUNET_JSON_parse_free (spec);
if (qs < 0)
{
diff --git a/src/include/taler/taler-merchant/post-private-donau.h b/src/include/taler/taler-merchant/post-private-donau.h
@@ -54,11 +54,6 @@ enum TALER_MERCHANT_PostPrivateDonauOption
*/
TALER_MERCHANT_POST_PRIVATE_DONAU_OPTION_END = 0,
- /**
- * Authentication token for the Donau service.
- */
- TALER_MERCHANT_POST_PRIVATE_DONAU_OPTION_AUTH_TOKEN
-
};
@@ -79,12 +74,6 @@ struct TALER_MERCHANT_PostPrivateDonauOptionValue
union
{
- /**
- * Value if @e option is
- * #TALER_MERCHANT_POST_PRIVATE_DONAU_OPTION_AUTH_TOKEN.
- */
- const char *auth_token;
-
} details;
};
@@ -133,20 +122,6 @@ struct TALER_MERCHANT_PostPrivateDonauResponse
}
/**
- * Set authentication token.
- *
- * @param t authentication token
- * @return representation of the option
- */
-#define TALER_MERCHANT_post_private_donau_option_auth_token(t) \
- (const struct TALER_MERCHANT_PostPrivateDonauOptionValue) \
- { \
- .option = TALER_MERCHANT_POST_PRIVATE_DONAU_OPTION_AUTH_TOKEN, \
- .details.auth_token = (t) \
- }
-
-
-/**
* Set the requested options for the operation.
*
* @param ppdh the request to set the options for
diff --git a/src/lib/merchant_api_delete-private-orders-ORDER_ID.c b/src/lib/merchant_api_delete-private-orders-ORDER_ID.c
@@ -15,7 +15,7 @@
<http://www.gnu.org/licenses/>
*/
/**
- * @file merchant_api_delete-private-orders-ORDER_ID-new.c
+ * @file merchant_api_delete-private-orders-ORDER_ID.c
* @brief Implementation of the DELETE /private/orders/$ORDER_ID request
* @author Christian Grothoff
*/
@@ -230,4 +230,4 @@ TALER_MERCHANT_delete_private_order_cancel (
}
-/* end of merchant_api_delete-private-orders-ORDER_ID-new.c */
+/* end of merchant_api_delete-private-orders-ORDER_ID.c */
diff --git a/src/lib/merchant_api_get-private-orders.c b/src/lib/merchant_api_get-private-orders.c
@@ -456,11 +456,11 @@ TALER_MERCHANT_get_private_orders_start (
have_date
? dstr
: NULL,
- "start",
+ "offset",
have_srow
? cbuf
: NULL,
- "delta",
+ "limit",
(-20 != oph->limit)
? dbuf
: NULL,
diff --git a/src/lib/merchant_api_post-private-donau.c b/src/lib/merchant_api_post-private-donau.c
@@ -17,7 +17,7 @@
If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file merchant_api_post-private-donau-new.c
+ * @file merchant_api_post-private-donau.c
* @brief Implementation of the POST /private/donau request
* @author Christian Grothoff
*/
@@ -83,11 +83,6 @@ struct TALER_MERCHANT_PostPrivateDonauHandle
* Charity URL (owned copy).
*/
char *charity_url;
-
- /**
- * Optional authentication token.
- */
- const char *auth_token;
};
@@ -199,9 +194,6 @@ TALER_MERCHANT_post_private_donau_set_options_ (
{
case TALER_MERCHANT_POST_PRIVATE_DONAU_OPTION_END:
return GNUNET_OK;
- case TALER_MERCHANT_POST_PRIVATE_DONAU_OPTION_AUTH_TOKEN:
- ppdh->auth_token = options[i].details.auth_token;
- break;
default:
GNUNET_break (0);
return GNUNET_SYSERR;
@@ -275,4 +267,4 @@ TALER_MERCHANT_post_private_donau_cancel (
}
-/* end of merchant_api_post-private-donau-new.c */
+/* end of merchant_api_post-private-donau.c */