Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
arcbtc committed Dec 5, 2024
1 parent a9605fe commit f3334bc
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 18 deletions.
4 changes: 0 additions & 4 deletions helpers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import httpx
from lnbits.core.views.api import api_lnurlscan
from loguru import logger


async def get_pr(ln_address, amount):
logger.debug(ln_address)
logger.debug(amount)
try:
data = await api_lnurlscan(ln_address)
if data.get("status") == "ERROR":
Expand All @@ -15,7 +12,6 @@ async def get_pr(ln_address, amount):
url=f"{data['callback']}?amount={int(amount) * 1000}"
)
if response.status_code != 200:
logger.debug(response.status_code)
return
return response.json()["pr"]
except Exception:
Expand Down
2 changes: 0 additions & 2 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class CreateTposData(BaseModel):
withdraw_pin_disabled: bool = Field(False)
lnaddress: bool = Field(False)
lnaddress_cut: Optional[int] = Field(0)
user_lnaddress: Optional[str] = Field(None)


class TposClean(BaseModel):
Expand All @@ -53,7 +52,6 @@ class TposClean(BaseModel):
withdrawn_amount: int = 0
lnaddress: Optional[bool] = None
lnaddress_cut: int = 0
user_lnaddress: Optional[str] = None
items: Optional[str] = None
tip_options: Optional[str] = None

Expand Down
1 change: 0 additions & 1 deletion static/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ window.app = Vue.createApp({
this.g.user.wallets[0].inkey
)
.then(function (response) {
console.log('getTposs', response.data)
self.tposs = response.data.map(function (obj) {
return mapTpos(obj)
})
Expand Down
2 changes: 0 additions & 2 deletions static/js/tpos.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,6 @@ window.app = Vue.createApp({
if (this.lnaddress) {
params.user_lnaddress = this.lnaddressDialog.lnaddress
}
console.log(params)

axios
.post(`/tpos/api/v1/tposs/${this.tposId}/invoices`, params)
.then(response => {
Expand Down
6 changes: 1 addition & 5 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,17 @@ async def on_invoice_paid(payment: Payment) -> None:

tpos = await get_tpos(tpos_id)
assert tpos
logger.debug(payment.extra.get("lnaddress"))
if payment.extra.get("lnaddress") and payment.extra["lnaddress"] != "":
logger.debug("poo")
calc_amount = payment.amount - ((payment.amount / 100) * tpos.lnaddress_cut)
logger.debug(calc_amount)
pr = await get_pr(payment.extra.get("lnaddress"), calc_amount / 1000)
logger.debug(pr)
if pr:
payment.extra["lnaddress"] = ""
paid_payment = await pay_invoice(
payment_request=pr,
wallet_id=payment.wallet_id,
extra={**payment.extra},
)
logger.debug(f"tpos: tip invoice paid: {paid_payment.checking_id}")
logger.debug(f"tpos: LNaddress paid cut: {paid_payment.checking_id}")

await websocket_updater(tpos_id, str(stripped_payment))

Expand Down
2 changes: 0 additions & 2 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from lnbits.decorators import check_user_exists
from lnbits.helpers import template_renderer
from lnbits.settings import settings
from loguru import logger
from starlette.responses import HTMLResponse

from .crud import get_clean_tpos, get_tpos
Expand All @@ -29,7 +28,6 @@ async def index(request: Request, user: User = Depends(check_user_exists)):
@tpos_generic_router.get("/{tpos_id}")
async def tpos(request: Request, tpos_id, lnaddress: Optional[str] = ""):
tpos = await get_tpos(tpos_id)
logger.debug(tpos)
if not tpos:
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="TPoS does not exist."
Expand Down
2 changes: 0 additions & 2 deletions views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
)
from lnbits.utils.exchange_rates import get_fiat_rate_satoshis
from lnurl import decode as decode_lnurl
from loguru import logger

from .crud import (
create_tpos,
Expand Down Expand Up @@ -293,7 +292,6 @@ async def api_tpos_atm_pay(
detail=str(exc),
) from exc
except Exception as exc:
logger.warning(exc)
raise HTTPException(
status_code=HTTPStatus.INTERNAL_SERVER_ERROR,
detail="Cannot process atm withdraw",
Expand Down

0 comments on commit f3334bc

Please sign in to comment.