Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: switch duration on wrong amounts #7

Merged
merged 3 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ async def on_invoice_paid(payment: Payment) -> None:
bitcoinswitch_payment.payment_hash = bitcoinswitch_payment.payload
bitcoinswitch_payment = await update_bitcoinswitch_payment(bitcoinswitch_payment)
payload = bitcoinswitch_payment.payload
variable = payment.extra.get("variable", False)
if variable:

variable = payment.extra.get("variable")
if variable is True:
payload = str(
(int(payload) / int(bitcoinswitch_payment.sats))
* int(payment.extra["amount"])
)

payload = f"{bitcoinswitch_payment.pin}-{payload}"

comment = payment.extra.get("comment")
Expand Down
4 changes: 2 additions & 2 deletions views_lnurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def lnurl_params(
}
if comment:
resp["commentAllowed"] = 1500
if variable:
if variable is True:
resp["maxSendable"] = price_msat * 360
return resp

Expand All @@ -95,7 +95,7 @@ async def lnurl_params(
)
async def lnurl_callback(
payment_id: str,
variable: str = Query(None),
variable: bool = Query(None),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one was the main issue

amount: int = Query(None),
comment: str = Query(None),
):
Expand Down
Loading