taler-typescript-core

Wallet core logic and WebUIs for various components
Log | Files | Refs | Submodules | README | LICENSE

commit 45c10c168a0b79865db3533dabd91df568d57b35
parent 9d5ef78709bb5f2f554cc10ed6c25a6d7912a803
Author: Florian Dold <florian@dold.me>
Date:   Wed, 30 Jul 2025 20:38:20 +0200

wallet-core: always report at least one scope for pay tx

Diffstat:
Mpackages/taler-wallet-core/src/pay-merchant.ts | 23+++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/packages/taler-wallet-core/src/pay-merchant.ts b/packages/taler-wallet-core/src/pay-merchant.ts @@ -85,6 +85,7 @@ import { RefundInfoShort, RefundPaymentInfo, ScopeInfo, + ScopeType, SelectedProspectiveCoin, SharePaymentResult, SignedTokenEnvelope, @@ -310,17 +311,31 @@ export class PayMerchantTransactionContext implements TransactionContext { let amountEffective: AmountString; if (!purchaseRec.payInfo) { - scopes = []; amountEffective = Amounts.stringify(zero); } else { + amountEffective = isUnsuccessfulTransaction(txState) + ? Amounts.stringify(zero) + : Amounts.stringify(purchaseRec.payInfo.totalPayCost); + } + + if (purchaseRec.exchanges && purchaseRec.exchanges.length > 0) { + scopes = await getScopeForAllExchanges(tx, purchaseRec.exchanges); + } else if (purchaseRec.payInfo) { + // This should not be necessary, as we now track + // involved exchanges directly in the purchase. const coinList = !purchaseRec.payInfo.payCoinSelection ? [] : purchaseRec.payInfo.payCoinSelection.coinPubs; scopes = await getScopeForAllCoins(tx, coinList); - amountEffective = isUnsuccessfulTransaction(txState) - ? Amounts.stringify(zero) - : Amounts.stringify(purchaseRec.payInfo.totalPayCost); + } else { + scopes = [ + { + type: ScopeType.Global, + currency: "UNKNOWN", + }, + ]; } + return { type: TransactionType.Payment, txState,