Browse Source

Internal payments working!

internalpayments
arcbtc 4 years ago
parent
commit
53c4df6906
  1. 2
      lnbits/core/crud.py
  2. 5
      lnbits/core/services.py

2
lnbits/core/crud.py

@ -192,7 +192,7 @@ def create_payment(
db.execute(
"""
INSERT INTO apipayment (wallet, id, payment_hash, amount, pending, memo, fee)
VALUES (?, ?, ?, ?, ?, ?)
VALUES (?, ?, ?, ?, ?, ?, ?)
""",
(wallet_id, checking_id, payment_hash, amount, int(pending), memo, fee),
)

5
lnbits/core/services.py

@ -4,7 +4,7 @@ from lnbits.bolt11 import decode as bolt11_decode # type: ignore
from lnbits.helpers import urlsafe_short_hash
from lnbits.settings import WALLET
from .crud import get_wallet, create_payment, delete_payment, check_internal
from .crud import get_wallet, create_payment, delete_payment, check_internal, update_payment_status
def create_invoice(*, wallet_id: str, amount: int, memo: str) -> Tuple[str, str]:
@ -15,9 +15,10 @@ def create_invoice(*, wallet_id: str, amount: int, memo: str) -> Tuple[str, str]
if not ok:
raise Exception(error_message or "Unexpected backend error.")
invoice = bolt11_decode(payment_request)
amount_msat = amount * 1000
create_payment(wallet_id=wallet_id, checking_id=checking_id, amount=amount_msat, memo=memo)
create_payment(wallet_id=wallet_id, checking_id=checking_id, payment_hash=invoice.payment_hash, amount=amount_msat, memo=memo)
return checking_id, payment_request

Loading…
Cancel
Save