@@ -1,12 +1,11 @@
|
||||
from . import db
|
||||
from .models import Tip, TipJar, createTip, createTipJar
|
||||
|
||||
from ..satspay.crud import delete_charge # type: ignore
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from lnbits.db import SQLITE
|
||||
|
||||
from ..satspay.crud import delete_charge # type: ignore
|
||||
from . import db
|
||||
from .models import Tip, TipJar, createTipJar
|
||||
|
||||
|
||||
async def create_tip(
|
||||
id: int, wallet: str, message: str, name: str, sats: int, tipjar: str
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from lnbits.core.crud import get_wallet
|
||||
|
||||
from .crud import get_tipjar
|
||||
import json
|
||||
|
||||
|
||||
async def get_charge_details(tipjar_id):
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
import json
|
||||
from lnurl import Lnurl, LnurlWithdrawResponse, encode as lnurl_encode # type: ignore
|
||||
from urllib.parse import urlparse, urlunparse, parse_qs, urlencode, ParseResult
|
||||
from lnurl.types import LnurlPayMetadata # type: ignore
|
||||
from sqlite3 import Row
|
||||
from typing import NamedTuple, Optional, Dict
|
||||
import shortuuid # type: ignore
|
||||
from typing import NamedTuple, Optional
|
||||
|
||||
from fastapi.param_functions import Query
|
||||
from pydantic.main import BaseModel
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, NamedTuple
|
||||
from fastapi import FastAPI, Request
|
||||
from pydantic.main import BaseModel
|
||||
|
||||
|
||||
class CreateCharge(BaseModel):
|
||||
|
||||
@@ -1,26 +1,16 @@
|
||||
from .crud import get_tipjar
|
||||
|
||||
from http import HTTPStatus
|
||||
import httpx
|
||||
from collections import defaultdict
|
||||
from lnbits.decorators import check_user_exists
|
||||
|
||||
from functools import wraps
|
||||
import hashlib
|
||||
from lnbits.core.services import check_invoice_status
|
||||
from lnbits.core.crud import update_payment_status, get_standalone_payment
|
||||
from fastapi import FastAPI, Request
|
||||
from fastapi import Request
|
||||
from fastapi.param_functions import Query
|
||||
from fastapi.params import Depends
|
||||
from fastapi.templating import Jinja2Templates
|
||||
from starlette.exceptions import HTTPException
|
||||
from starlette.responses import HTMLResponse
|
||||
from fastapi.params import Depends
|
||||
from fastapi.param_functions import Query
|
||||
import random
|
||||
|
||||
from datetime import datetime
|
||||
from http import HTTPStatus
|
||||
from lnbits.core.models import User
|
||||
from lnbits.decorators import check_user_exists
|
||||
|
||||
from . import tipjar_ext, tipjar_renderer
|
||||
from lnbits.core.models import User, Payment
|
||||
from .crud import get_tipjar
|
||||
|
||||
templates = Jinja2Templates(directory="templates")
|
||||
|
||||
@@ -36,7 +26,6 @@ async def index(request: Request, user: User = Depends(check_user_exists)):
|
||||
async def tip(request: Request, tipjar_id: int = Query(None)):
|
||||
"""Return the donation form for the Tipjar corresponding to id"""
|
||||
tipjar = await get_tipjar(tipjar_id)
|
||||
print(tipjar_id)
|
||||
if not tipjar:
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.NOT_FOUND, detail="TipJar does not exist."
|
||||
|
||||
@@ -1,30 +1,28 @@
|
||||
from http import HTTPStatus
|
||||
import json
|
||||
from fastapi import Request
|
||||
|
||||
from fastapi.param_functions import Query
|
||||
from fastapi.params import Depends
|
||||
from lnurl.exceptions import InvalidUrl as LnurlInvalidUrl # type: ignore
|
||||
from starlette.exceptions import HTTPException
|
||||
|
||||
from lnbits.decorators import WalletTypeInfo, get_key_type
|
||||
from lnbits.core.crud import get_user
|
||||
from lnbits.decorators import WalletTypeInfo, get_key_type
|
||||
|
||||
from ..satspay.crud import create_charge
|
||||
from . import tipjar_ext
|
||||
from .helpers import get_charge_details
|
||||
from .crud import (
|
||||
create_tipjar,
|
||||
get_tipjar,
|
||||
create_tip,
|
||||
get_tipjars,
|
||||
create_tipjar,
|
||||
delete_tip,
|
||||
delete_tipjar,
|
||||
get_tip,
|
||||
get_tipjar,
|
||||
get_tipjars,
|
||||
get_tips,
|
||||
update_tip,
|
||||
update_tipjar,
|
||||
delete_tip,
|
||||
delete_tipjar,
|
||||
)
|
||||
from ..satspay.crud import create_charge
|
||||
from .models import createTipJar, createTips, createTip, CreateCharge
|
||||
from .helpers import get_charge_details
|
||||
from .models import CreateCharge, createTipJar, createTips
|
||||
|
||||
|
||||
@tipjar_ext.post("/api/v1/tipjars")
|
||||
@@ -54,7 +52,6 @@ async def api_create_tip(data: createTips):
|
||||
|
||||
webhook = tipjar.webhook
|
||||
charge_details = await get_charge_details(tipjar.id)
|
||||
print(charge_details["time"])
|
||||
name = data.name
|
||||
# Ensure that description string can be split reliably
|
||||
name = name.replace('"', "''")
|
||||
|
||||
Reference in New Issue
Block a user