mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-25 23:21:21 +01:00
Merge branch 'main' into diagon-alley
This commit is contained in:
commit
c23756f546
10 changed files with 54 additions and 51 deletions
|
@ -452,6 +452,15 @@ async def delete_payment(checking_id: str, conn: Optional[Connection] = None) ->
|
|||
)
|
||||
|
||||
|
||||
async def delete_wallet_payment(
|
||||
checking_id: str, wallet_id: str, conn: Optional[Connection] = None
|
||||
) -> None:
|
||||
await (conn or db).execute(
|
||||
"DELETE FROM apipayments WHERE checking_id = ? AND wallet = ?",
|
||||
(checking_id, wallet_id),
|
||||
)
|
||||
|
||||
|
||||
async def check_internal(
|
||||
payment_hash: str, conn: Optional[Connection] = None
|
||||
) -> Optional[str]:
|
||||
|
|
|
@ -174,7 +174,7 @@ class Payment(BaseModel):
|
|||
logger.warning(
|
||||
f"Deleting outgoing failed payment {self.checking_id}: {status}"
|
||||
)
|
||||
await self.delete()
|
||||
await self.delete(conn)
|
||||
elif not status.pending:
|
||||
logger.info(
|
||||
f"Marking '{'in' if self.is_in else 'out'}' {self.checking_id} as not pending anymore: {status}"
|
||||
|
@ -182,10 +182,10 @@ class Payment(BaseModel):
|
|||
await self.update_status(status, conn=conn)
|
||||
return status
|
||||
|
||||
async def delete(self) -> None:
|
||||
async def delete(self, conn: Optional[Connection] = None) -> None:
|
||||
from .crud import delete_payment
|
||||
|
||||
await delete_payment(self.checking_id)
|
||||
await delete_payment(self.checking_id, conn=conn)
|
||||
|
||||
|
||||
class BalanceCheck(BaseModel):
|
||||
|
|
|
@ -28,7 +28,7 @@ from . import db
|
|||
from .crud import (
|
||||
check_internal,
|
||||
create_payment,
|
||||
delete_payment,
|
||||
delete_wallet_payment,
|
||||
get_wallet,
|
||||
get_wallet_payment,
|
||||
update_payment_details,
|
||||
|
@ -221,7 +221,7 @@ async def pay_invoice(
|
|||
logger.warning(f"backend sent payment failure")
|
||||
async with db.connect() as conn:
|
||||
logger.debug(f"deleting temporary payment {temp_id}")
|
||||
await delete_payment(temp_id, conn=conn)
|
||||
await delete_wallet_payment(temp_id, wallet_id, conn=conn)
|
||||
raise PaymentFailure(
|
||||
f"payment failed: {payment.error_message}"
|
||||
or "payment failed, but backend didn't give us an error message"
|
||||
|
|
|
@ -369,9 +369,9 @@ new Vue({
|
|||
decodeRequest: function () {
|
||||
this.parse.show = true
|
||||
let req = this.parse.data.request.toLowerCase()
|
||||
if (this.parse.data.request.startsWith('lightning:')) {
|
||||
if (this.parse.data.request.toLowerCase().startsWith('lightning:')) {
|
||||
this.parse.data.request = this.parse.data.request.slice(10)
|
||||
} else if (this.parse.data.request.startsWith('lnurl:')) {
|
||||
} else if (this.parse.data.request.toLowerCase().startsWith('lnurl:')) {
|
||||
this.parse.data.request = this.parse.data.request.slice(6)
|
||||
} else if (req.indexOf('lightning=lnurl1') !== -1) {
|
||||
this.parse.data.request = this.parse.data.request
|
||||
|
|
|
@ -711,7 +711,7 @@
|
|||
<q-card class="q-pa-lg">
|
||||
<h6 class="q-my-md text-primary">Warning</h6>
|
||||
<p>
|
||||
Login functionality to be released in v0.2, for now,
|
||||
Login functionality to be released in a future update, for now,
|
||||
<strong
|
||||
>make sure you bookmark this page for future access to your
|
||||
wallet</strong
|
||||
|
|
|
@ -19,42 +19,25 @@ async def create_ticket(
|
|||
(payment_hash, wallet, event, name, email, False, True),
|
||||
)
|
||||
|
||||
# UPDATE EVENT DATA ON SOLD TICKET
|
||||
eventdata = await get_event(event)
|
||||
assert eventdata, "Couldn't get event from ticket being paid"
|
||||
sold = eventdata.sold + 1
|
||||
amount_tickets = eventdata.amount_tickets - 1
|
||||
await db.execute(
|
||||
"""
|
||||
UPDATE events.events
|
||||
SET sold = ?, amount_tickets = ?
|
||||
WHERE id = ?
|
||||
""",
|
||||
(sold, amount_tickets, event),
|
||||
)
|
||||
|
||||
ticket = await get_ticket(payment_hash)
|
||||
assert ticket, "Newly created ticket couldn't be retrieved"
|
||||
return ticket
|
||||
|
||||
|
||||
async def set_ticket_paid(payment_hash: str) -> Tickets:
|
||||
row = await db.fetchone("SELECT * FROM events.ticket WHERE id = ?", (payment_hash,))
|
||||
if row[6] != True:
|
||||
await db.execute(
|
||||
"""
|
||||
UPDATE events.ticket
|
||||
SET paid = true
|
||||
WHERE id = ?
|
||||
""",
|
||||
(payment_hash,),
|
||||
)
|
||||
|
||||
eventdata = await get_event(row[2])
|
||||
assert eventdata, "Couldn't get event from ticket being paid"
|
||||
|
||||
sold = eventdata.sold + 1
|
||||
amount_tickets = eventdata.amount_tickets - 1
|
||||
await db.execute(
|
||||
"""
|
||||
UPDATE events.events
|
||||
SET sold = ?, amount_tickets = ?
|
||||
WHERE id = ?
|
||||
""",
|
||||
(sold, amount_tickets, row[2]),
|
||||
)
|
||||
|
||||
ticket = await get_ticket(payment_hash)
|
||||
assert ticket, "Newly updated ticket couldn't be retrieved"
|
||||
return ticket
|
||||
|
||||
|
||||
async def get_ticket(payment_hash: str) -> Optional[Tickets]:
|
||||
row = await db.fetchone("SELECT * FROM events.ticket WHERE id = ?", (payment_hash,))
|
||||
return Tickets(**row) if row else None
|
||||
|
|
|
@ -24,7 +24,6 @@ from .crud import (
|
|||
get_ticket,
|
||||
get_tickets,
|
||||
reg_ticket,
|
||||
set_ticket_paid,
|
||||
update_event,
|
||||
)
|
||||
|
||||
|
|
|
@ -138,8 +138,9 @@
|
|||
hide-dropdown-icon
|
||||
input-debounce="0"
|
||||
new-value-mode="add-unique"
|
||||
label="Tip % Options"
|
||||
></q-select>
|
||||
label="Tip % Options (hit enter to add values)"
|
||||
><q-tooltip>Hit enter to add values</q-tooltip></q-select
|
||||
>
|
||||
<div class="row q-mt-lg">
|
||||
<q-btn
|
||||
unelevated
|
||||
|
|
|
@ -253,7 +253,7 @@
|
|||
name="check"
|
||||
transition-show="fade"
|
||||
class="text-light-green"
|
||||
style="font-size: 40em"
|
||||
style="font-size: min(90vw, 40em)"
|
||||
></q-icon>
|
||||
</q-dialog>
|
||||
</q-page>
|
||||
|
@ -294,6 +294,7 @@
|
|||
exchangeRate: null,
|
||||
stack: [],
|
||||
tipAmount: 0.0,
|
||||
hasNFC: false,
|
||||
nfcTagReading: false,
|
||||
invoiceDialog: {
|
||||
show: false,
|
||||
|
@ -370,7 +371,7 @@
|
|||
this.showInvoice()
|
||||
},
|
||||
submitForm: function () {
|
||||
if (this.tip_options.length) {
|
||||
if (this.tip_options && this.tip_options.length) {
|
||||
this.showTipModal()
|
||||
} else {
|
||||
this.showInvoice()
|
||||
|
@ -413,9 +414,6 @@
|
|||
dialog.show = false
|
||||
|
||||
self.complete.show = true
|
||||
setTimeout(function () {
|
||||
self.complete.show = false
|
||||
}, 5000)
|
||||
}
|
||||
})
|
||||
}, 3000)
|
||||
|
|
|
@ -3,23 +3,36 @@
|
|||
<p>
|
||||
Onchain Wallet (watch-only) extension uses mempool.space<br />
|
||||
For use with "account Extended Public Key"
|
||||
<a href="https://iancoleman.io/bip39/">https://iancoleman.io/bip39/</a>
|
||||
<a
|
||||
href="https://iancoleman.io/bip39/"
|
||||
target="_blank"
|
||||
style="color: unset"
|
||||
>https://iancoleman.io/bip39/</a
|
||||
>
|
||||
<br />
|
||||
Flash binaries
|
||||
<a
|
||||
href="https://lnbits.github.io/hardware-wallet"
|
||||
target="_blank"
|
||||
style="color: unset"
|
||||
>directly from browser</a
|
||||
>
|
||||
<small>
|
||||
<br />Created by,
|
||||
<a target="_blank" class="text-white" href="https://github.com/arcbtc"
|
||||
<a target="_blank" style="color: unset" href="https://github.com/arcbtc"
|
||||
>Ben Arc</a
|
||||
>
|
||||
(using,
|
||||
<a
|
||||
target="_blank"
|
||||
class="text-white"
|
||||
style="color: unset"
|
||||
href="https://github.com/diybitcoinhardware/embit"
|
||||
>Embit</a
|
||||
></small
|
||||
>)
|
||||
<br />
|
||||
<br />
|
||||
<a target="_blank" href="/docs#/watchonly" class="text-white"
|
||||
<a target="_blank" href="/docs#/watchonly" style="color: unset"
|
||||
>Swagger REST API Documentation</a
|
||||
>
|
||||
</p>
|
||||
|
|
Loading…
Add table
Reference in a new issue