taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

payto-link-only-accepts-iban.md (5038B)


      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 payto link is "not a valid Taler link" unless it is an IBAN
     18 
     19 Found by a harness defect of its own: the `deposit` scenario had been passing
     20 for thirteen rounds while depositing nothing, because it started the deposit
     21 from a payto link the wallet refuses.
     22 
     23 **Severity: moderate.** The wallet deposits to `x-taler-bank` accounts
     24 perfectly well when one is picked from its own account list — that is how every
     25 deposit in this campaign's local stack works — but the same account as a
     26 `payto://` link is rejected, and the message says the *link* is invalid rather
     27 than that the account type is unsupported.
     28 
     29 ## What happens
     30 
     31 The bank in the simulator's stack hands out
     32 
     33 ```
     34 payto://x-taler-bank/localhost/wallet5?receiver-name=Wallet%205
     35 ```
     36 
     37 Sharing that into the wallet opens the "Send funds" screen with one line of red
     38 text:
     39 
     40 ```
     41 ['Not a valid Taler link', 'Go back', 'Send', 'Internal event log']
     42 ```
     43 
     44 Picking the very same account from *Deposit → account list* works and the money
     45 arrives:
     46 
     47 ```
     48 deposit_flow: ['This transaction was completed successfully',
     49                'Chosen amount', '€0.44', 'Fee', '-€0.06', 'Amount sent', '-€0.50']
     50 ```
     51 
     52 ## Why
     53 
     54 `PayToUriScreen` asks one question before it will show the amount form, and the
     55 answer for anything but an IBAN is no:
     56 
     57 ```kotlin
     58 // wallet/src/main/java/net/taler/wallet/deposit/DepositManager.kt:53
     59 fun isSupportedPayToUri(uriString: String): Boolean {
     60     if (!uriString.startsWith("payto://")) return false
     61     val u = uriString.toUri()
     62     if (!u.authority.equals("iban", ignoreCase = true)) return false
     63     return u.pathSegments.isNotEmpty()
     64 }
     65 ```
     66 
     67 ```kotlin
     68 // wallet/src/main/java/net/taler/wallet/deposit/PayToUriScreen.kt:81
     69 } else if (model.depositManager.isSupportedPayToUri(uri)) {
     70     PayToComposable(…)
     71 } else {
     72     Text(text = stringResource(id = R.string.uri_invalid), …)
     73 }
     74 ```
     75 
     76 Everything else in the app disagrees with that restriction:
     77 
     78 * the add-account form offers **x-taler-bank**, **IBAN** and **Bitcoin** tabs,
     79   and `AddAccountComposable` builds a payto for each;
     80 * `Accounts.kt` models `PaytoUriIban`, `PaytoUriTaler`, `PaytoUriBitcoin` and
     81   `PaytoUriCyclos`, and the transfer screens render all four;
     82 * wallet-core's own payto parser accepts `iban`, `x-taler-bank`, `bitcoin`,
     83   `upi` and more (`packages/taler-util/src/payto.ts`);
     84 * and the deposit itself succeeds for an x-taler-bank account chosen from the
     85   list, so nothing downstream needs the restriction.
     86 
     87 So the check is narrower than the feature behind it, and `uri_invalid` —
     88 "Not a valid Taler link" — is the wrong thing to say about a well-formed payto
     89 URI for an account the wallet can use.
     90 
     91 ## Reproduce by hand
     92 
     93 1. Install a debug build, enable **Developer mode**, and withdraw once from the
     94    local bank so the wallet has coins and knows the account.
     95 2. Share a payto URI for a non-IBAN account into the wallet:
     96 
     97    ```bash
     98    adb shell am start -a android.intent.action.VIEW \
     99      -d 'payto://x-taler-bank/localhost/wallet1?receiver-name=Wallet%201'
    100    ```
    101 
    102 3. The screen shows "Not a valid Taler link".
    103 4. For the contrast: **Deposit** on the home screen, pick the `wallet1`
    104    account, enter an amount, **Make deposit** — the same account, and it works.
    105 
    106 An IBAN link, for comparison, opens the amount form:
    107 
    108 ```bash
    109 adb shell am start -a android.intent.action.VIEW \
    110   -d 'payto://iban/DE89370400440532013000?receiver-name=Wallet%20One'
    111 ```
    112 
    113 ## Reproduce with the simulator
    114 
    115 ```bash
    116 ssh root@tripwire.taler.net
    117 cd /opt/taler-sim/driver
    118 SIM_WORKER=0 python3 -u suite.py deposit_payto_link deposit
    119 ```
    120 
    121 `deposit_payto_link` records the refusal and says so if it ever stops
    122 happening; `deposit` now drives the account list instead and **fails** if the
    123 bank balance does not move, which is what should have been checked all along.
    124 
    125 ## Suggested fix
    126 
    127 Accept the target types the wallet already models. `isSupportedPayToUri` can
    128 delegate to the same parsing the account forms use — `PaytoUri.parse`, which
    129 returns `PaytoUriIban`/`PaytoUriTaler`/`PaytoUriBitcoin`/`PaytoUriCyclos` —
    130 and treat "parsed to something we can deposit to" as supported.
    131 
    132 For whatever genuinely stays unsupported, say that instead of `uri_invalid`:
    133 "this wallet cannot deposit to a <type> account" tells the user something,
    134 where "not a valid Taler link" is both unhelpful and untrue.