From 1f827f71d2897bf6252bdb60449438f7fed7ac26 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Thu, 7 Jul 2022 15:22:15 +0200 Subject: [PATCH] add info text for all remaining invoice states --- electrum/gui/qml/qeinvoice.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/electrum/gui/qml/qeinvoice.py b/electrum/gui/qml/qeinvoice.py index 82378b4e7..6de0b5715 100644 --- a/electrum/gui/qml/qeinvoice.py +++ b/electrum/gui/qml/qeinvoice.py @@ -249,13 +249,27 @@ class QEInvoiceParser(QEInvoice): self.canPay = True else: self.userinfo = _('Can\'t pay, insufficient balance') - else: # TODO: proper text for other possible states - self.userinfo = _('Can\'t pay, invoice is expired') + else: + self.userinfo = { + PR_EXPIRED: _('Can\'t pay, invoice is expired'), + PR_PAID: _('Can\'t pay, invoice is already paid'), + PR_INFLIGHT: _('Can\'t pay, invoice is already being paid'), + PR_ROUTING: _('Can\'t pay, invoice is already being paid'), + PR_UNKNOWN: _('Can\'t pay, invoice has unknown status'), + }[self.status] elif self.invoiceType == QEInvoice.Type.OnchainInvoice: - if self.get_max_spendable_onchain() >= self.amount.satsInt: - self.canPay = True + if self.status in [PR_UNPAID, PR_FAILED]: + if self.get_max_spendable_onchain() >= self.amount.satsInt: + self.canPay = True + else: + self.userinfo = _('Can\'t pay, insufficient balance') else: - self.userinfo = _('Can\'t pay, insufficient balance') + self.userinfo = { + PR_EXPIRED: _('Can\'t pay, invoice is expired'), + PR_PAID: _('Can\'t pay, invoice is already paid'), + PR_UNCONFIRMED: _('Can\'t pay, invoice is already paid'), + PR_UNKNOWN: _('Can\'t pay, invoice has unknown status'), + }[self.status] def get_max_spendable_lightning(self):