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

This commit is contained in:
Kristjan
2021-01-02 22:55:52 +01:00
parent e1abea77f5
commit 10414be0d2
3 changed files with 7 additions and 7 deletions

View File

@@ -23,6 +23,9 @@ $ pipenv shell
$ pipenv install --dev $ 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: If you wish to use a version of Python higher than 3.7:
```sh ```sh

View File

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

View File

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