NWC: a failed wallet payment drops the seller into the manual QR without saying why

Aperta
#955 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
dart, flutter

Direzione di ricerca

Start with NwcPaymentWidget._pay in lib/shared/widgets/nwc_payment_widget.dart and trace onFallbackToManual to the screen that displays the manual QR. Read the invoice failure warning in NwcInvoiceWidget and check the existing localization and widget test patterns. Add a localized failure message for wallet errors and timeouts, then verify the relevant widget tests show the reason above the QR.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: ui bug priority: medium

Context

When the seller presses "pay with wallet", NwcPaymentWidget._pay (lib/shared/widgets/nwc_payment_widget.dart:40-58) calls nwc_api.payInvoice. On any failure, whether a NIP-47 error from the wallet, a timeout or an exception, it calls onFallbackToManual, and the screen switches to the manual QR.

What happens

The reason is only printed (debugPrint('NWC payment failed: ${result.error}') / debugPrint('NWC payment error: $e')). The seller sees the screen change from a pay button to a QR with no message: nothing says the wallet refused, that it lacked balance, or that it never answered. "Insufficient balance", "the wallet is unreachable", "quota exceeded" and "restricted" all look the same, and none looks like an error. A user can easily believe the payment went through, or pay the QR from a second wallet without knowing why the first one failed.

The invoice side already does better: NwcInvoiceWidget shows a warning icon and a message when generation fails (line 109).

Mortsom's nwc_payment_refused_then_manual (INSUFFICIENT_BALANCE) and nwc_wallet_unreachable_then_manual (no answer) both pass. The fallback works, but the only evidence of why it happened is the harness's own wallet log.

How to fix

  1. Pass the failure to the screen: onFallbackToManual(String reason), or an enum built from the NIP-47 error code (INSUFFICIENT_BALANCE, QUOTA_EXCEEDED, RESTRICTED, PAYMENT_FAILED, timeout).
  2. When the screen switches to manual, show it as a localized banner above the QR, or as a snackbar, e.g. "Your wallet could not pay: insufficient balance. Pay this invoice from another wallet or cancel the trade."
  3. Optional, and a contract change: expose the reason on an automation readout (e.g. pay.nwc.error, labelled with the code), so automation can assert the right failure was reported.
  4. Add widget tests for each mapped code and for the timeout.
Lingua principale
Dart
Stelle
11
Fork
9
Merge medio
2g 1h
PR unite (30g)
16

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di MostroP2P/app

Tutte le issue di MostroP2P/app

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.