merchant

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

commit 7247592dd7ce3542a26a72897c9b6e6021f0241a
parent 8aca4ab356fa801c8c5d6ec944388f5623679ee1
Author: Christian Grothoff <christian@grothoff.org>
Date:   Fri,  9 Oct 2026 22:39:00 +0200

Fixes that paying the same order twice with the same coin
and different amounts (smaller the 2nd time) the merchant
backend would incorrectly trigger a refund.

Diffstat:
Msrc/backend/taler-merchant-httpd_post-orders-ORDER_ID-pay.c | 21++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/src/backend/taler-merchant-httpd_post-orders-ORDER_ID-pay.c b/src/backend/taler-merchant-httpd_post-orders-ORDER_ID-pay.c @@ -290,6 +290,15 @@ struct DepositConfirmation bool matched_in_db; /** + * true if #deposit_paid_check() found a deposit of this coin for + * this order in the database, regardless of the exchange URL and + * amount given by the client. Such a coin must never be offered + * a refund in the "already paid" response, as the refund would + * be honored by the exchange against the existing deposit. + */ + bool deposited_in_db; + + /** * True if this coin is in the current batch. */ bool in_batch; @@ -4397,10 +4406,12 @@ deposit_paid_check ( { struct DepositConfirmation *dci = &pc->parse_pay.dc[i]; + if (0 != + GNUNET_memcmp (&dci->cdd.coin_pub, + coin_pub)) + continue; + dci->deposited_in_db = true; if ( (0 == - GNUNET_memcmp (&dci->cdd.coin_pub, - coin_pub)) && - (0 == strcmp (dci->exchange_url, exchange_url)) && (GNUNET_YES == @@ -4678,8 +4689,8 @@ phase_contract_paid (struct PayContext *pc) struct DepositConfirmation *dci = &pc->parse_pay.dc[i]; struct TALER_MerchantSignatureP merchant_sig; - if (dci->matched_in_db) - continue; + if (dci->deposited_in_db) + continue; /* part of the payment on file, never refund it here */ TALER_merchant_refund_sign (&dci->cdd.coin_pub, &pc->check_contract.h_contract_terms, 0, /* rtransaction id */