commit 9cc34ff64006661fa31104ed6af24acf8fda9233
parent 2ade51088b609e04237eba3d7e2a978f2b919b3b
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Thu, 14 Aug 2025 11:59:18 +0200
-fix build issues without donau
Diffstat:
5 files changed, 55 insertions(+), 60 deletions(-)
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -3563,6 +3563,7 @@ phase_validate_tokens (struct PayContext *pc)
return;
}
donau_seen = true;
+#ifdef HAVE_DONAU_DONAU_SERVICE_H
if (output_off + pc->parse_wallet_data.num_bkps < output_off)
{
GNUNET_break_op (0);
@@ -3575,6 +3576,7 @@ phase_validate_tokens (struct PayContext *pc)
return;
}
output_off += pc->parse_wallet_data.num_bkps;
+#endif
break;
}
}
@@ -3612,15 +3614,8 @@ phase_validate_tokens (struct PayContext *pc)
break;
case TALER_MERCHANT_CONTRACT_OUTPUT_TYPE_DONATION_RECEIPT:
#ifndef HAVE_DONAU_DONAU_SERVICE_H
- if (0 == pc->parse_wallet_data.num_bkps)
- return; /* wallet didn't want donau, so OK! */
- GNUNET_break_op (0);
- pay_end (pc,
- TALER_MHD_reply_with_error (
- pc->connection,
- MHD_HTTP_NOT_IMPLEMENTED,
- TALER_EC_MERCHANT_GENERIC_FEATURE_NOT_AVAILABLE,
- "donau support disabled"));
+ /* We checked at parse time, and
+ wallet didn't want donau, so OK! */
return;
#else
if (GNUNET_OK !=
@@ -4412,7 +4407,7 @@ phase_parse_wallet_data (struct PayContext *pc)
pay_end (pc,
TALER_MHD_reply_with_error (pc->connection,
MHD_HTTP_NOT_IMPLEMENTED,
- TALER_EC_MERCHANT_GENERIC_FEATURE_NOT_AVAILABLE,
+ TALER_EC_MERCHANT_GENERIC_DONAU_NOT_CONFIGURED,
"donau support disabled"));
return;
}
diff --git a/src/backenddb/pg_update_donau_instance_receipts_amount.c b/src/backenddb/pg_update_donau_instance_receipts_amount.c
@@ -24,7 +24,6 @@
#include <taler/taler_error_codes.h>
#include <taler/taler_dbevents.h>
#include <taler/taler_pq_lib.h>
-#include "donau/donau_service.h"
#include "pg_update_donau_instance_receipts_amount.h"
#include "pg_helper.h"
@@ -53,4 +52,4 @@ TMH_PG_update_donau_instance_receipts_amount (
return GNUNET_PQ_eval_prepared_non_select (pg->conn,
"update_donau_instance_receipts",
params);
-}
-\ No newline at end of file
+}
diff --git a/src/include/taler_merchant_pay_service.h b/src/include/taler_merchant_pay_service.h
@@ -112,11 +112,9 @@ struct TALER_MERCHANT_OrderPayOption
unsigned int num_output_tokens;
const struct TALER_MERCHANT_OutputToken *output_tokens;
} output_tokens;
-#ifdef HAVE_DONAU_DONAU_SERVICE_H
const char *donau_url;
uint64_t donau_year;
json_t *donau_budis_json;
-#endif
} details;
};
@@ -609,4 +607,4 @@ TALER_MERCHANT_order_pay_start (struct TALER_MERCHANT_OrderPayHandle *ph);
void
TALER_MERCHANT_order_pay_cancel1 (struct TALER_MERCHANT_OrderPayHandle *ph);
-#endif /* TALER_MERCHANT_PAY_SERVICE_H */
-\ No newline at end of file
+#endif /* TALER_MERCHANT_PAY_SERVICE_H */
diff --git a/src/lib/taler_merchant_pay_service.c b/src/lib/taler_merchant_pay_service.c
@@ -635,15 +635,16 @@ store_json_option (struct TALER_MERCHANT_OrderPayHandle *ph,
* internal state updates for coins, tokens, deadlines, Donau data, etc.
*/
enum TALER_MERCHANT_OrderPayErrorCode
-TALER_MERCHANT_order_pay_set_options (struct TALER_MERCHANT_OrderPayHandle *ph,
- const struct TALER_MERCHANT_OrderPayOption
- options[],
- size_t max_options)
+TALER_MERCHANT_order_pay_set_options (
+ struct TALER_MERCHANT_OrderPayHandle *ph,
+ const struct TALER_MERCHANT_OrderPayOption options[],
+ size_t max_options)
{
for (size_t i = 0; i < max_options
&& options[i].ot != TALER_MERCHANT_OrderPayOptionType_END; i++)
{
const struct TALER_MERCHANT_OrderPayOption *o = &options[i];
+
switch (o->ot)
{
case TALER_MERCHANT_OrderPayOptionType_MERCHANT_URL:
@@ -760,7 +761,9 @@ TALER_MERCHANT_order_pay_set_options (struct TALER_MERCHANT_OrderPayHandle *ph,
json_t *je = GNUNET_JSON_PACK (TALER_JSON_pack_token_envelope (NULL,
&otk->
envelope));
- json_array_append_new (arr, je);
+ GNUNET_assert (0 ==
+ json_array_append_new (arr,
+ je));
}
ph->tokens_evs = arr;
@@ -770,15 +773,14 @@ TALER_MERCHANT_order_pay_set_options (struct TALER_MERCHANT_OrderPayHandle *ph,
break;
case TALER_MERCHANT_OrderPayOptionType_DONAU_URL:
- {
- if (ph->donau_data == NULL)
- ph->donau_data = json_object ();
- GNUNET_assert (0 == json_object_set_new (
- ph->donau_data,
- "url",
- json_string (o->details.donau_url)));
- break;
- }
+ if (NULL == ph->donau_data)
+ ph->donau_data = json_object ();
+ GNUNET_assert (0 ==
+ json_object_set_new (
+ ph->donau_data,
+ "url",
+ json_string (o->details.donau_url)));
+ break;
case TALER_MERCHANT_OrderPayOptionType_DONAU_YEAR:
{
diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c
@@ -1102,7 +1102,6 @@ pay_run (void *cls,
kind))
{
const json_t *donau_urls;
- const char *donau_url_str = NULL;
// For test, we care only about the presence of it
struct GNUNET_JSON_Specification donauspec[] = {
@@ -1127,40 +1126,44 @@ pay_run (void *cls,
}
#ifdef HAVE_DONAU_DONAU_SERVICE_H
- if ( (NULL == donau_urls) ||
- (0 == json_array_size (donau_urls)) )
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "No donau_urls found in output\n");
- TALER_TESTING_FAIL (is);
- }
-
- donau_url_str = json_string_value (json_array_get (donau_urls,
- 0));
- if (NULL == donau_url_str)
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "First entry in donau_urls is not a string\n");
- TALER_TESTING_FAIL (is);
- }
+ const char *donau_url_str;
- ps->donau_data.donau_url = GNUNET_strdup (donau_url_str);
+ if ( (NULL == donau_urls) ||
+ (0 == json_array_size (donau_urls)) )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "No donau_urls found in output\n");
+ TALER_TESTING_FAIL (is);
+ }
- if (NULL != ps->donau_data.charity_reference)
- {
- switch (prepare_donau_data (is,
- &ps->donau_data))
+ donau_url_str = json_string_value (json_array_get (donau_urls,
+ 0));
+ if (NULL == donau_url_str)
{
- case GNUNET_OK:
- break;
- case GNUNET_NO:
- TALER_TESTING_interpreter_next (ps->is);
- return;
- case GNUNET_SYSERR:
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "First entry in donau_urls is not a string\n");
TALER_TESTING_FAIL (is);
- return;
}
- ps->num_donau_tokens = ps->donau_data.num_bkps;
+
+ ps->donau_data.donau_url = GNUNET_strdup (donau_url_str);
+
+ if (NULL != ps->donau_data.charity_reference)
+ {
+ switch (prepare_donau_data (is,
+ &ps->donau_data))
+ {
+ case GNUNET_OK:
+ break;
+ case GNUNET_NO:
+ TALER_TESTING_interpreter_next (ps->is);
+ return;
+ case GNUNET_SYSERR:
+ TALER_TESTING_FAIL (is);
+ return;
+ }
+ ps->num_donau_tokens = ps->donau_data.num_bkps;
+ }
}
#else /* HAVE_DONAU_DONAU_SERVICE_H */
/* SIMPLY NOTHING */