cant get invoice listener firing

This commit is contained in:
benarc 2024-01-19 09:25:17 +00:00
parent addf8fec11
commit 1735cc0d66
3 changed files with 16 additions and 9 deletions

Binary file not shown.

View file

@ -29,7 +29,8 @@ async def wait_for_paid_invoices():
# do somethhing when an invoice related top this extension is paid # do somethhing when an invoice related top this extension is paid
async def on_invoice_paid(payment: Payment) -> None: async def on_invoice_paid(payment: Payment) -> None:
if payment.extra.get("tag") != "myextension": logger.debug("payment received for myextension extension")
if payment.extra.get("tag") != "MyExtension":
return return
myextension_id = payment.extra.get("tempId") myextension_id = payment.extra.get("tempId")

View file

@ -96,7 +96,7 @@
<q-dialog v-model="formDialog.show" position="top" @hide="closeFormDialog"> <q-dialog v-model="formDialog.show" position="top" @hide="closeFormDialog">
<q-card class="q-pa-lg q-pt-xl" style="width: 500px"> <q-card class="q-pa-lg q-pt-xl" style="width: 500px">
<q-form @submit="sendTPosData" class="q-gutter-md"> <q-form @submit="sendMyExtensionData" class="q-gutter-md">
<q-input <q-input
filled filled
dense dense
@ -176,7 +176,7 @@
<div class="col q-pl-md"> <div class="col q-pl-md">
<q-input filled bottom-slots dense v-model="invoiceAmount"> <q-input filled bottom-slots dense v-model="invoiceAmount">
<template v-slot:append> <template v-slot:append>
<q-btn round @click="createInvoice(urlDialog.data.wallet)" color="primary" flat icon="add_circle" /> <q-btn round @click="createInvoice(urlDialog.data.wallet, urlDialog.data.id)" color="primary" flat icon="add_circle" />
</template> </template>
<template v-slot:hint> <template v-slot:hint>
Create an invoice Create an invoice
@ -397,7 +397,7 @@
this.connectWebocket(this.urlDialog.data.id) this.connectWebocket(this.urlDialog.data.id)
this.urlDialog.show = true this.urlDialog.show = true
}, },
createInvoice(walletId) { createInvoice(walletId, myextensionId) {
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
///Simple call to the api to create an invoice///// ///Simple call to the api to create an invoice/////
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
@ -405,19 +405,25 @@
const wallet = _.findWhere(this.g.user.wallets, { const wallet = _.findWhere(this.g.user.wallets, {
id: walletId id: walletId
}) })
console.log(wallet.inkey) const dataToSend = {
out: false,
amount: this.invoiceAmount,
memo: 'Invoice created by MyExtension',
extra: {
tag: 'MyExtension'
}
}
console.log(dataToSend)
LNbits.api LNbits.api
.request( .request(
'POST', 'POST',
`/api/v1/payments`, `/api/v1/payments`,
wallet.inkey, wallet.inkey,
{ dataToSend
out: false,
amount: this.invoiceAmount,
}
) )
.then(response => { .then(response => {
this.qrValue = response.data.payment_request this.qrValue = response.data.payment_request
this.connectWebocket(myextensionId)
}) })
.catch(error => { .catch(error => {
LNbits.utils.notifyApiError(error) LNbits.utils.notifyApiError(error)