commit 5c69b834b6fd1326b369303f9640c4377e125db2
parent 00e974f6aeee3373c7b39d3ebc68f45fc1349d85
Author: bohdan-potuzhnyi <bohdan.potuzhnyi@gmail.com>
Date: Thu, 13 Feb 2025 18:36:15 +0100
Merge branch 'master' into dev/bohdan-potuzhnyi/donau-integration
Diffstat:
10 files changed, 54 insertions(+), 40 deletions(-)
diff --git a/debian/taler-merchant.taler-merchant-httpd.service b/debian/taler-merchant.taler-merchant-httpd.service
@@ -1,6 +1,9 @@
[Unit]
Description=GNU Taler payment system merchant backend
After=postgres.service
+Requires=taler-merchant-httpd.socket
+PartOf=taler-merchant.target
+AssertPathExists=/run/taler-merchant/httpd
[Service]
User=taler-merchant-httpd
diff --git a/debian/taler-merchant.taler-merchant-httpd.socket b/debian/taler-merchant.taler-merchant-httpd.socket
@@ -0,0 +1,14 @@
+[Unit]
+Description=Taler Merchant Socket
+PartOf=taler-merchant-httpd.service
+
+[Socket]
+ListenStream=/run/taler-merchant/httpd/merchant-http.sock
+Accept=no
+Service=taler-merchant-httpd.service
+SocketUser=taler-merchant-httpd
+SocketGroup=www-data
+SocketMode=0660
+
+[Install]
+WantedBy=sockets.target
diff --git a/src/backend/.gitignore b/src/backend/.gitignore
@@ -4,4 +4,8 @@ taler-merchant-kyccheck
taler-merchant-reconciliation
taler-merchant-webhook
taler-merchant-wirewatch
-taler-merchant-donaukeyupdate
-\ No newline at end of file
+<<<<<<< HEAD
+taler-merchant-donaukeyupdate
+=======
+taler-merchant-donaukeyupdate
+>>>>>>> master
diff --git a/src/backend/taler-merchant-httpd_config.c b/src/backend/taler-merchant-httpd_config.c
@@ -43,7 +43,7 @@
* #MERCHANT_PROTOCOL_CURRENT and #MERCHANT_PROTOCOL_AGE in
* merchant_api_config.c!
*/
-#define MERCHANT_PROTOCOL_VERSION "18:0:14"
+#define MERCHANT_PROTOCOL_VERSION "18:0:15"
/**
diff --git a/src/backend/taler-merchant-httpd_post-orders-ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ID-pay.c
@@ -3413,7 +3413,7 @@ phase_parse_wallet_data (struct PayContext *pc)
struct TokenEnvelope *ev
= &pc->parse_wallet_data.token_envelopes[tokens_ev_index];
struct GNUNET_JSON_Specification ispec[] = {
- TALER_JSON_spec_token_envelope ("token_ev",
+ TALER_JSON_spec_token_envelope (NULL,
&ev->blinded_token),
GNUNET_JSON_spec_end ()
};
diff --git a/src/backend/taler-merchant-httpd_private-get-orders-ID.c b/src/backend/taler-merchant-httpd_private-get-orders-ID.c
@@ -947,6 +947,12 @@ phase_unpaid_finish (struct GetOrderRequestContext *gorc)
MHD_suspend_connection (gorc->sc.con);
return;
}
+ order_status_url = TMH_make_order_status_url (gorc->sc.con,
+ hc->infix,
+ gorc->session_id,
+ hc->instance->settings.id,
+ &gorc->claim_token,
+ NULL);
if (! gorc->order_only)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -956,6 +962,8 @@ phase_unpaid_finish (struct GetOrderRequestContext *gorc)
TALER_MHD_REPLY_JSON_PACK (
gorc->sc.con,
MHD_HTTP_OK,
+ GNUNET_JSON_pack_string ("order_status_url",
+ order_status_url),
GNUNET_JSON_pack_object_incref ("contract_terms",
gorc->contract_terms),
GNUNET_JSON_pack_string ("order_status",
@@ -967,12 +975,6 @@ phase_unpaid_finish (struct GetOrderRequestContext *gorc)
gorc->session_id,
hc->instance->settings.id,
&gorc->claim_token);
- order_status_url = TMH_make_order_status_url (gorc->sc.con,
- hc->infix,
- gorc->session_id,
- hc->instance->settings.id,
- &gorc->claim_token,
- NULL);
ret = TALER_MHD_REPLY_JSON_PACK (
gorc->sc.con,
MHD_HTTP_OK,
diff --git a/src/backend/taler-merchant-httpd_private-get-orders.c b/src/backend/taler-merchant-httpd_private-get-orders.c
@@ -309,9 +309,10 @@ add_order (void *cls,
struct TALER_Amount order_amount;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Adding order `%s' (%llu) to result set\n",
+ "Adding order `%s' (%llu) to result set at instance `%s'\n",
orig_order_id,
- (unsigned long long) order_serial);
+ (unsigned long long) order_serial,
+ po->instance_id);
qs = TMH_db->lookup_order_status_by_serial (TMH_db->cls,
po->instance_id,
order_serial,
@@ -330,10 +331,8 @@ add_order (void *cls,
paid = false;
if (NULL == orig_order_id)
{
- /* cannot be via DB trigger, and the other code
- path should have passed an orig_order_id */
- GNUNET_break (0);
- po->result = TALER_EC_GENERIC_DB_FETCH_FAILED;
+ /* Got a DB trigger about a new proposal, but it
+ was already deleted again. Just ignore the event. */
return;
}
order_id = GNUNET_strdup (orig_order_id);
diff --git a/src/backend/taler-merchant-httpd_private-post-orders.c b/src/backend/taler-merchant-httpd_private-post-orders.c
@@ -3412,7 +3412,6 @@ parse_donau_instances (struct OrderContext *oc,
#endif
-
/**
* Parse contract choices. Upon success, continue
* processing with merge_inventory().
diff --git a/src/backenddb/pg_lookup_order_status_by_serial.c b/src/backenddb/pg_lookup_order_status_by_serial.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2022 Taler Systems SA
+ Copyright (C) 2022-2025 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
@@ -26,17 +26,15 @@
#include "pg_helper.h"
enum GNUNET_DB_QueryStatus
-TMH_PG_lookup_order_status_by_serial (void *cls,
- const char *instance_id,
- uint64_t order_serial,
- char **order_id,
- struct TALER_PrivateContractHashP *
- h_contract_terms,
- bool *paid)
+TMH_PG_lookup_order_status_by_serial (
+ void *cls,
+ const char *instance_id,
+ uint64_t order_serial,
+ char **order_id,
+ struct TALER_PrivateContractHashP *h_contract_terms,
+ bool *paid)
{
struct PostgresClosure *pg = cls;
- uint8_t paid8;
- enum GNUNET_DB_QueryStatus qs;
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_string (instance_id),
GNUNET_PQ_query_param_uint64 (&order_serial),
@@ -45,14 +43,15 @@ TMH_PG_lookup_order_status_by_serial (void *cls,
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_auto_from_type ("h_contract_terms",
h_contract_terms),
- GNUNET_PQ_result_spec_auto_from_type ("paid",
- &paid8),
GNUNET_PQ_result_spec_string ("order_id",
order_id),
+ GNUNET_PQ_result_spec_bool ("paid",
+ paid),
GNUNET_PQ_result_spec_end
};
check_connection (pg);
+ *paid = false; /* just to be safe(r) */
PREPARE (pg,
"lookup_order_status_by_serial",
"SELECT"
@@ -65,13 +64,8 @@ TMH_PG_lookup_order_status_by_serial (void *cls,
" FROM merchant_instances"
" WHERE merchant_id=$1)"
" AND order_serial=$2");
- qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "lookup_order_status_by_serial",
- params,
- rs);
- if (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs)
- *paid = (0 != paid8);
- else
- *paid = false; /* just to be safe(r) */
- return qs;
+ return GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "lookup_order_status_by_serial",
+ params,
+ rs);
}
diff --git a/src/lib/merchant_api_post_order_pay.c b/src/lib/merchant_api_post_order_pay.c
@@ -425,7 +425,7 @@ TALER_MERCHANT_order_pay_frontend (
const struct TALER_MERCHANT_PaidCoin coins[static num_coins],
unsigned int num_tokens,
const struct TALER_MERCHANT_UsedToken tokens[static num_tokens],
- json_t *j_output_tokens,
+ json_t *j_output_tokens, // FIXME: not used, remove?
TALER_MERCHANT_OrderPayCallback pay_cb,
void *pay_cb_cls)
{
@@ -660,7 +660,7 @@ TALER_MERCHANT_order_pay (
const struct TALER_MERCHANT_OutputToken *ev = &output_tokens[i];
j_token_ev = GNUNET_JSON_PACK (
- TALER_JSON_pack_token_envelope ("token_ev",
+ TALER_JSON_pack_token_envelope (NULL,
&ev->envelope));
if (0 !=