View Issue Details

IDProjectCategoryView StatusLast Update
0012228Talerwallet-corepublic2026-11-19 17:43
Reporterbot-cg [agent]  
PrioritynormalSeverityminor 
Status new 
Summary0012228: tosStatus is "missing-tos" for an exchange that has never been contacted; "pending" exists for that and is never returned (patch attached)
DescriptionFollow-up to 0012157 and 0012065 (iOS wallet), where MarcS wrote: "wallet-core should
distinguish between unknown-tos (default value before getting an answer from the
exchange) and missing-tos (the exchange doesn't have ToS configured, thus the user
doesn't need to accept)". This is that request, with the code and a patch.

WHAT HAPPENS

For an exchange entry the wallet has not contacted yet, listExchanges /
getExchangeEntryByUrl report

    exchangeUpdateStatus: "initial"
    tosStatus: "missing-tos"

"missing-tos" is a statement about the exchange -- it has no terms of service --
and clients act on it by skipping the acceptance step. Before first contact the
wallet does not know that. The iOS wallet offered "Confirm Withdrawal" without the
terms step for exactly this reason (0012157); it now works around it by also looking
at exchangeUpdateStatus (commit 3da3fd49 in taler-ios), which every client would
have to repeat.

CAUSE (packages/taler-wallet-core/src/common.ts)

    export function getExchangeTosStatusFromRecord(exchange) {
      if (exchange.tosCurrentEtag == null) {
        return ExchangeTosStatus.MissingTos;
      }
      ...

tosCurrentEtag is undefined both when the exchange has no terms and when the
exchange has never been fetched. ExchangeTosStatus already has a value for the
second case -- Pending = "pending" -- but nothing in wallet-core ever returns it.

REPRODUCTION (taler-wallet-cli built from master 150044e2b)

    rm -f /tmp/t.sqlite3
    taler-wallet-cli --wallet-db /tmp/t.sqlite3 api listExchanges '{}'
      exchange.demo.taler.net exchangeUpdateStatus "initial" tosStatus "missing-tos"
      exchange.taler-ops.ch exchangeUpdateStatus "initial" tosStatus "missing-tos"

Both exchanges do have terms; after `api getExchangeTos` the demo entry says
"ready" / "proposed".

PATCH (attached, tos-pending-before-first-contact.diff)

Return Pending while the entry has no details pointer, i.e. before the first
successful /keys:

      if (exchange.tosCurrentEtag == null) {
        if (exchange.detailsPointer == null) {
          return ExchangeTosStatus.Pending;
        }
        return ExchangeTosStatus.MissingTos;
      }

Tested: `tsc --noEmit` on packages/taler-wallet-core is clean; with the patch the
same fresh wallet reports "initial" / "pending" for both exchanges, and after
getExchangeTos the demo entry reports "ready" / "proposed" as before.

NOT TESTED, and worth a look by someone who knows the update path:
- whether there is a window in which detailsPointer is already set and the terms
  have not been stored yet (keys and terms are fetched separately); in that window
  the patched function would still say "missing-tos";
- wallet-core's own gate in common.ts (the switch that lets Accepted and MissingTos
  pass and throws WALLET_EXCHANGE_TOS_NOT_ACCEPTED otherwise) will now refuse an
  operation on a never-fetched exchange instead of letting it through. I think that
  is the correct direction, but it is a behaviour change;
- the Android wallet and the WebExtension: both will now see "pending" where they
  saw "missing-tos" (see 0012112 and 0012113 for how they treat the latter).
TagsNo tags attached.
Attached Files
tos-pending-before-first-contact.diff (861 bytes)   
diff --git a/packages/taler-wallet-core/src/common.ts b/packages/taler-wallet-core/src/common.ts
index 7adc674ea..1d3b3c7b1 100644
--- a/packages/taler-wallet-core/src/common.ts
+++ b/packages/taler-wallet-core/src/common.ts
@@ -354,6 +354,13 @@ export function getExchangeTosStatusFromRecord(
   exchange: WalletExchangeEntry,
 ): ExchangeTosStatus {
   if (exchange.tosCurrentEtag == null) {
+    // No terms are known for this exchange.  Before the exchange has been
+    // contacted for the first time that means "not known yet", which is
+    // what Pending is for; MissingTos is a statement about the exchange
+    // ("it has none") and clients skip the acceptance step on it.
+    if (exchange.detailsPointer == null) {
+      return ExchangeTosStatus.Pending;
+    }
     return ExchangeTosStatus.MissingTos;
   }
   if (!exchange.tosAcceptedEtag) {

Required notifications

Address or linkRemarkAdded byNotifiedActions

Activities

Issue History

Date ModifiedUsernameFieldChange
2026-11-19 17:43bot-cgNew Issue
2026-11-19 17:43bot-cgImplementer => avalos
2026-11-19 17:43bot-cgReviewer => oec
2026-11-19 17:43bot-cgRelease signed by => Florian Dold
2026-11-19 17:43bot-cgDeployed by => oec
2026-11-19 17:43bot-cgVerifier => oec
2026-11-19 17:43bot-cgCommunicator => CM_7
2026-11-19 17:43bot-cgFile Added: tos-pending-before-first-contact.diff