Browse Source

now payments are finalized and dns registered when the event happens instead when user polls the backend

master
Kristjan 4 years ago
parent
commit
10414be0d2
  1. 3
      docs/devs/installation.md
  2. 4
      lnbits/extensions/subdomains/tasks.py
  3. 3
      lnbits/extensions/subdomains/views_api.py

3
docs/devs/installation.md

@ -23,6 +23,9 @@ $ pipenv shell
$ pipenv install --dev
```
If any of the modules fails to install, try checking and upgrading your setupTool module.
`pip install -U setuptools`
If you wish to use a version of Python higher than 3.7:
```sh

4
lnbits/extensions/subdomains/tasks.py

@ -23,12 +23,10 @@ async def wait_for_paid_invoices(invoice_paid_chan: trio.MemoryReceiveChannel):
async def on_invoice_paid(payment: Payment) -> None:
print(payment)
if "lnsubdomain" != payment.extra.get("tag"):
# not an lnurlp invoice
return
wallet = await get_wallet(payment.wallet_id)
await payment.set_pending(False)
subdomain = await set_subdomain_paid(payment_hash=payment.payment_hash)
domain = await get_domain(subdomain.domain)
@ -76,5 +74,3 @@ async def on_invoice_paid(payment: Payment) -> None:
)
except AssertionError:
webhook = None
return jsonify({"paid": True}), HTTPStatus.OK

3
lnbits/extensions/subdomains/views_api.py

@ -10,7 +10,6 @@ from .util import isValidDomain, isvalidIPAddress
from . import subdomains_ext
from .crud import (
create_subdomain,
set_subdomain_paid,
get_subdomain,
get_subdomains,
delete_subdomain,
@ -152,6 +151,8 @@ async def api_subdomain_send_subdomain(payment_hash):
return jsonify({"paid": False}), HTTPStatus.OK
if is_paid:
return jsonify({"paid": True}), HTTPStatus.OK
return jsonify({"paid": False}), HTTPStatus.OK

Loading…
Cancel
Save