payment_identifier: move amount_range into payment_identifier
This commit is contained in:
@@ -418,11 +418,9 @@ class SendTab(QWidget, MessageBoxMixin, Logger):
|
|||||||
self.set_field_validated(self.payto_e, validated=fields.validated)
|
self.set_field_validated(self.payto_e, validated=fields.validated)
|
||||||
|
|
||||||
# LNURLp amount range
|
# LNURLp amount range
|
||||||
if pi.type in [PaymentIdentifierType.LNURLP, PaymentIdentifierType.LNADDR] \
|
if fields.amount_range:
|
||||||
and pi.state == PaymentIdentifierState.LNURLP_FINALIZE \
|
amin, amax = fields.amount_range
|
||||||
and pi.lnurl_data.min_sendable_sat != pi.lnurl_data.max_sendable_sat:
|
self.amount_e.setToolTip(_('Amount must be between %d and %d sat.') % (amin, amax))
|
||||||
self.amount_e.setToolTip(_('Amount must be between %d and %d sat.') \
|
|
||||||
% (pi.lnurl_data.min_sendable_sat, pi.lnurl_data.max_sendable_sat))
|
|
||||||
else:
|
else:
|
||||||
self.amount_e.setToolTip('')
|
self.amount_e.setToolTip('')
|
||||||
|
|
||||||
|
|||||||
@@ -204,6 +204,7 @@ class FieldsForGUI(NamedTuple):
|
|||||||
description: Optional[str]
|
description: Optional[str]
|
||||||
validated: Optional[bool]
|
validated: Optional[bool]
|
||||||
comment: Optional[int]
|
comment: Optional[int]
|
||||||
|
amount_range: Optional[tuple[int, int]]
|
||||||
|
|
||||||
|
|
||||||
class PaymentIdentifier(Logger):
|
class PaymentIdentifier(Logger):
|
||||||
@@ -632,6 +633,7 @@ class PaymentIdentifier(Logger):
|
|||||||
description = None
|
description = None
|
||||||
validated = None
|
validated = None
|
||||||
comment = None
|
comment = None
|
||||||
|
amount_range = None
|
||||||
|
|
||||||
if (self.emaillike or self.domainlike) and self.openalias_data:
|
if (self.emaillike or self.domainlike) and self.openalias_data:
|
||||||
key = self.emaillike if self.emaillike else self.domainlike
|
key = self.emaillike if self.emaillike else self.domainlike
|
||||||
@@ -650,10 +652,13 @@ class PaymentIdentifier(Logger):
|
|||||||
elif self.lnurl and self.lnurl_data:
|
elif self.lnurl and self.lnurl_data:
|
||||||
domain = urllib.parse.urlparse(self.lnurl).netloc
|
domain = urllib.parse.urlparse(self.lnurl).netloc
|
||||||
recipient = f"{self.lnurl_data.metadata_plaintext} <{domain}>"
|
recipient = f"{self.lnurl_data.metadata_plaintext} <{domain}>"
|
||||||
amount = self.lnurl_data.min_sendable_sat if self.lnurl_data.min_sendable_sat else None
|
|
||||||
description = self.lnurl_data.metadata_plaintext
|
description = self.lnurl_data.metadata_plaintext
|
||||||
if self.lnurl_data.comment_allowed:
|
if self.lnurl_data.comment_allowed:
|
||||||
comment = self.lnurl_data.comment_allowed
|
comment = self.lnurl_data.comment_allowed
|
||||||
|
if self.lnurl_data.min_sendable_sat:
|
||||||
|
amount = self.lnurl_data.min_sendable_sat
|
||||||
|
if self.lnurl_data.min_sendable_sat != self.lnurl_data.max_sendable_sat:
|
||||||
|
amount_range = (self.lnurl_data.min_sendable_sat, self.lnurl_data.max_sendable_sat)
|
||||||
|
|
||||||
elif self.bip70 and self.bip70_data:
|
elif self.bip70 and self.bip70_data:
|
||||||
pr = self.bip70_data
|
pr = self.bip70_data
|
||||||
@@ -681,7 +686,7 @@ class PaymentIdentifier(Logger):
|
|||||||
description = label
|
description = label
|
||||||
|
|
||||||
return FieldsForGUI(recipient=recipient, amount=amount, description=description,
|
return FieldsForGUI(recipient=recipient, amount=amount, description=description,
|
||||||
comment=comment, validated=validated)
|
comment=comment, validated=validated, amount_range=amount_range)
|
||||||
|
|
||||||
def _get_bolt11_fields(self, bolt11_invoice):
|
def _get_bolt11_fields(self, bolt11_invoice):
|
||||||
"""Parse ln invoice, and prepare the send tab for it."""
|
"""Parse ln invoice, and prepare the send tab for it."""
|
||||||
|
|||||||
Reference in New Issue
Block a user