suspended-looks-like-completed-in-the-list.md (5324B)
1 <!-- 2 This file is part of GNU Taler 3 (C) 2026 Taler Systems S.A. 4 5 GNU Taler is free software; you can redistribute it and/or modify it under the 6 terms of the GNU General Public License as published by the Free Software 7 Foundation; either version 3, or (at your option) any later version. 8 9 GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY 10 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 13 You should have received a copy of the GNU General Public License along with 14 GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 --> 16 17 # A suspended transaction is indistinguishable from a completed one in the list 18 19 Found by the `transaction_states_rendered` scenario, which renders every 20 transaction state the app has a branch for by feeding the list a canned 21 wallet-core reply. 22 23 **Severity: low-moderate.** Suspending is an action the app offers on nearly 24 every transaction, and the transaction list — the screen a user scans to see 25 what is going on — gives no sign that anything was suspended. For a suspended 26 withdrawal the row goes further and says "Waiting for confirmation", which is 27 the opposite of what is happening. 28 29 ## What happens 30 31 Six withdrawals, one per state, in the transaction list: 32 33 | state | what the row shows | 34 | --- | --- | 35 | `pending` + `kyc` | the "PENDING" chip and "KYC required to proceed" | 36 | `aborting` | "Aborting" | 37 | `failed` | "Failed" | 38 | `done` | nothing, which is right | 39 | **`suspended`** | **nothing** | 40 | an unknown future state | nothing | 41 42 The detail screen does say it — "This transaction is suspended" — so the 43 information is there; it is the row that omits it. 44 45 On a *real* suspension it is worse than an omission. Suspending a withdrawal 46 that is waiting for the bank gives this: 47 48 ``` 49 its detail screen: ['This transaction is suspended', 'Chosen amount', '€5.00', 50 'Fee', '-€0.12', 'Total amount', '€4.88', …] 51 its row in the list: ['0 min. ago', 'Withdraw', 'Waiting for confirmation', '+4.88'] 52 ``` 53 54 The row says **"Waiting for confirmation"** — i.e. that the wallet is waiting 55 for the bank — when in fact the transaction is suspended and nothing is 56 happening until the user resumes it. That comes from the fall-through at the 57 end of the same `when`: 58 59 ```kotlin 60 tx is TransactionWithdrawal && !tx.confirmed -> Text(stringResource(R.string.withdraw_waiting_confirm)) 61 ``` 62 63 which a suspended, unconfirmed withdrawal reaches because no earlier branch 64 claimed it. 65 66 ## Why 67 68 The row's state line has no branch for `Suspended`, and the "PENDING" chip is 69 only drawn for `Pending` and `Dialog`: 70 71 ```kotlin 72 // wallet/src/main/java/net/taler/wallet/transactions/TransactionsComposable.kt:382 73 if (tx.txState.major == Pending || tx.txState.major == Dialog) { 74 … Text(stringResource(R.string.transaction_pending)) // the "PENDING" chip 75 } 76 … 77 // …:395 78 when { 79 tx.txState.major == Aborted -> Text(…payment_aborted…) 80 tx.txState.minor == Repurchase -> … 81 tx.txState.major == Failed -> Text(…payment_failed…) 82 tx.txState.major == Aborting -> Text(…payment_aborting…) 83 tx.txState.major == Pending -> when (tx.txState.minor) { … } 84 tx.txState.major == Dialog -> {} 85 … 86 } 87 ``` 88 89 `Suspended` falls through all of it. The detail screen's own state card 90 (`TransactionStateComposable`) *does* handle it. 91 92 The same `when` has no branch for a state this version of the app does not 93 know, and the detail screen's card ends in `else -> return` — so a future 94 state renders as nothing in both places, although `TransactionState` goes out 95 of its way to keep the unrecognised name (`majorName`, `minorName`) precisely 96 so that it could be shown. 97 98 ## Reproduce by hand 99 100 No injection needed for the suspended case: 101 102 1. Start a withdrawal and confirm it, so it waits for the bank. 103 2. On its detail screen tap **Suspend**. The screen says "This transaction is 104 suspended". 105 3. Go back to the main screen and look at the row under "Recent 106 transactions": it shows the time, "Withdraw" and the amount, exactly as a 107 completed withdrawal does. 108 109 For the unknown-state case, a canned reply is needed (developer mode): 110 111 ```bash 112 # {"transactions":[{… "txState":{"major":"transmogrified","minor":"inside-out"} …}]} 113 adb shell am start -a android.intent.action.VIEW -d \ 114 'taler+http://dev-experiment/api-response?operation=getTransactionsV2&response=<base64url>&count=8' 115 ``` 116 117 `simulator/driver/suite.py`'s `_fake_withdrawal` builds the object; the 118 scenario below does the encoding. 119 120 ## Reproduce with the simulator 121 122 ```bash 123 ssh root@tripwire.taler.net 124 cd /opt/taler-sim/driver 125 SIM_WORKER=4 python3 suite.py transaction_states_rendered # all six states 126 SIM_WORKER=4 python3 suite.py withdraw_suspend_resume # a real suspension 127 ``` 128 129 The first prints the whole list; the second reports what the suspended 130 transaction's own row says, which is nothing. 131 132 ## Suggested fix 133 134 Add `tx.txState.major == Suspended -> Text(stringResource(R.string.transaction_state_suspended))` 135 to the row's `when`, before the `!tx.confirmed` fall-through — the string 136 already exists — and a final `else` that shows the unrecognised state name the 137 app kept, rather than nothing.