merchant

Merchant backend to process payments, run by merchants
Log | Files | Refs | Submodules | README | LICENSE

commit c9a48b069b7884dfc260aa811ddb4170113b223d
parent b7c5ae7c26d957fe17eaa4e2a7fe89eb284101d6
Author: Florian Dold <dold@taler.net>
Date:   Mon, 27 Jul 2026 21:44:39 +0200

list each exchange only once in the contract terms, fix #11563

Diffstat:
Msrc/backend/taler-merchant-httpd_post-private-orders.c | 50+++++++++++++++++++++++++++++---------------------
1 file changed, 29 insertions(+), 21 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_post-private-orders.c b/src/backend/taler-merchant-httpd_post-private-orders.c @@ -2849,33 +2849,41 @@ keys_cb ( "Got response for %skeys\n", rx->url); - /* Evaluate the use of this exchange for each wire method candidate */ - for (unsigned int j = 0; j<keys->accounts_len; j++) + /* Evaluate the use of this exchange for each wire method candidate. + Note that the exchange may have *several* accounts sharing the same + wire method; as get_acceptable() judges the exchange as a whole (and + not the individual account), it must be called at most once per wire + method candidate, or we would list the exchange more than once in the + contract terms and count its deposit limit more than once. */ + for (struct WireMethodCandidate *wmc = oc->add_payment_details.wmc_head; + NULL != wmc; + wmc = wmc->next) { - struct TALER_FullPayto full_payto = keys->accounts[j].fpayto_uri; - char *wire_method = TALER_payto_get_method (full_payto.full_payto); + bool matches = false; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Exchange `%s' has wire method `%s'\n", - rx->url, - wire_method); - for (struct WireMethodCandidate *wmc = oc->add_payment_details.wmc_head; - NULL != wmc; - wmc = wmc->next) + "Order could use wire method `%s'\n", + wmc->wm->wire_method); + for (unsigned int j = 0; j<keys->accounts_len; j++) { + struct TALER_FullPayto full_payto = keys->accounts[j].fpayto_uri; + char *wire_method = TALER_payto_get_method (full_payto.full_payto); + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Order could use wire method `%s'\n", - wmc->wm->wire_method); - if (0 == strcmp (wmc->wm->wire_method, - wire_method) ) - { - applicable |= get_acceptable (oc, - exchange, - rx->url, - wmc); - } + "Exchange `%s' has wire method `%s'\n", + rx->url, + wire_method); + matches = (0 == strcmp (wmc->wm->wire_method, + wire_method)); + GNUNET_free (wire_method); + if (matches) + break; } - GNUNET_free (wire_method); + if (matches) + applicable |= get_acceptable (oc, + exchange, + rx->url, + wmc); } if ( (! applicable) && (! oc->set_exchanges.forced_reload) )