@@ -82,13 +82,26 @@ class _ShopInBitPaymentViewState extends ConsumerState<ShopInBitPaymentView> {
8282 if (widget.initialPaymentInfo != null ) {
8383 _applyPaymentInfo (widget.initialPaymentInfo! );
8484 }
85- // Poll even when the pre-load returned null so the view can still recover
86- // a live invoice on its own.
8785 if (widget.model.apiTicketId != 0 ) {
88- _startPolling ();
86+ // If the pre-load didn't hand us usable payment links, recover them:
87+ // GET, then PUT to generate one.
88+ if (_addresses.every ((a) => a.isEmpty)) {
89+ unawaited (_recoverPaymentInfo ());
90+ } else {
91+ _startPolling ();
92+ }
8993 }
9094 }
9195
96+ Future <void > _recoverPaymentInfo () async {
97+ final info = await fetchShopInBitPaymentInfo (ref, widget.model.apiTicketId);
98+ if (! mounted) return ;
99+ if (info != null ) {
100+ setState (() => _applyPaymentInfo (info));
101+ }
102+ _startPolling ();
103+ }
104+
92105 @override
93106 void dispose () {
94107 _pollTimer? .cancel ();
@@ -230,13 +243,18 @@ class _ShopInBitPaymentViewState extends ConsumerState<ShopInBitPaymentView> {
230243 }
231244 if (! mounted) return ;
232245
233- widget.model.status = ShopInBitOrderStatus .paymentPending;
234- widget.model.paymentMethod = method;
235-
236- if (Util .isDesktop) {
237- Navigator .of (context, rootNavigator: true ).pop ();
238- } else {
239- Navigator .of (context).popUntil ((route) => route.isFirst);
246+ // Couldn't launch the in-wallet send.
247+ unawaited (
248+ showFloatingFlushBar (
249+ type: FlushBarType .warning,
250+ message:
251+ "Payment details for $ticker aren't ready yet. "
252+ "Please wait a moment or refresh the invoice." ,
253+ context: context,
254+ ),
255+ );
256+ if (! _isTerminal) {
257+ _startPolling ();
240258 }
241259 }
242260
0 commit comments