commit 079f612df372c1c860dc9db473d788f0e420a30a
parent d46e00a7a7a534ad214842dcccaff8fb04ef1878
Author: bohdan-potuzhnyi <bohdan.potuzhnyi@gmail.com>
Date: Mon, 30 Jun 2025 22:01:20 +0200
donau_payment still not working
Diffstat:
3 files changed, 31 insertions(+), 11 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
@@ -2715,7 +2715,7 @@ phase_execute_pay_transaction (struct PayContext *pc)
qs = TMH_db->insert_order_budis (TMH_db->cls,
pc->order_id,
pc->parse_wallet_data.donau.budikeypairs);
- if (qs < 0)
+ if (0 >= qs)
{
if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
{
@@ -2741,7 +2741,7 @@ phase_execute_pay_transaction (struct PayContext *pc)
&pc->charity.charity_id,
pc->charity.charity_priv);
- if (qs < 0)
+ if (0 >= qs)
{
TMH_db->rollback (TMH_db->cls);
diff --git a/src/testing/test_merchant_api.c b/src/testing/test_merchant_api.c
@@ -1887,15 +1887,15 @@ run (void *cls,
"donau",
GNUNET_TIME_UNIT_ZERO_TS,
GNUNET_TIME_UNIT_FOREVER_TS,
- "EUR:10.0"),
+ "EUR:5.0"),
TALER_TESTING_cmd_merchant_pay_order_donau(
"pay-donau-order",
merchant_url,
MHD_HTTP_OK,
"create-donau-order",
"withdraw-coin-3",
- "EUR:10.0",
- "EUR:9.99",
+ "EUR:5.0",
+ "EUR:4.99",
NULL,
0,
"post-charity",
diff --git a/src/testing/testing_api_cmd_pay_order.c b/src/testing/testing_api_cmd_pay_order.c
@@ -1055,6 +1055,7 @@ pay_run (void *cls,
if (0 == strcmp ("tax-receipt", 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[] = {
@@ -1079,12 +1080,31 @@ pay_run (void *cls,
}
#ifdef HAVE_DONAU_DONAU_SERVICE_H
- if (ps->donau_data.charity_reference != NULL) {
- if (GNUNET_OK != prepare_donau_data(is, &ps->donau_data)) {
- TALER_TESTING_FAIL(is);
- return;
- }
- }
+ 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);
+ }
+
+ ps->donau_data.donau_url = GNUNET_strdup (donau_url_str);
+
+ if (ps->donau_data.charity_reference != NULL)
+ {
+ if (GNUNET_OK != prepare_donau_data(is, &ps->donau_data)) {
+ TALER_TESTING_FAIL(is);
+ return;
+ }
+ }
#else /* HAVE_DONAU_DONAU_SERVICE_H */
// Theoretically we have thought about paying without donau_url being selected, so could proceed...
// or maybe not