payment dialog flow
This commit is contained in:
parent
6a94f6c366
commit
288111a144
2 changed files with 9 additions and 24 deletions
|
|
@ -7,7 +7,10 @@
|
||||||
@click="$emit('change-page', 'market')"
|
@click="$emit('change-page', 'market')"
|
||||||
style="cursor: pointer"
|
style="cursor: pointer"
|
||||||
></q-breadcrumbs-el>
|
></q-breadcrumbs-el>
|
||||||
<q-breadcrumbs-el :label="stall.name" icon="widgets"></q-breadcrumbs-el>
|
<q-breadcrumbs-el
|
||||||
|
:label="stall?.name || 'Stall'"
|
||||||
|
icon="widgets"
|
||||||
|
></q-breadcrumbs-el>
|
||||||
</q-breadcrumbs>
|
</q-breadcrumbs>
|
||||||
<q-toolbar-title></q-toolbar-title>
|
<q-toolbar-title></q-toolbar-title>
|
||||||
<chat-dialog
|
<chat-dialog
|
||||||
|
|
@ -151,14 +154,6 @@
|
||||||
position="top"
|
position="top"
|
||||||
@hide="closeQrCodeDialog"
|
@hide="closeQrCodeDialog"
|
||||||
>
|
>
|
||||||
<q-card
|
|
||||||
v-if="!qrCodeDialog.data.payment_request"
|
|
||||||
class="q-pa-lg q-pt-xl lnbits__dialog-card"
|
|
||||||
>
|
|
||||||
<div class="q-gutter-md row items-center">
|
|
||||||
<q-spinner-cube color="white" size="5.5em" />
|
|
||||||
</div>
|
|
||||||
</q-card>
|
|
||||||
<q-card v-else class="q-pa-lg q-pt-xl lnbits__dialog-card">
|
<q-card v-else class="q-pa-lg q-pt-xl lnbits__dialog-card">
|
||||||
<div class="text-center q-mb-lg">
|
<div class="text-center q-mb-lg">
|
||||||
<a :href="'lightning:' + qrCodeDialog.data.payment_request">
|
<a :href="'lightning:' + qrCodeDialog.data.payment_request">
|
||||||
|
|
@ -187,6 +182,9 @@
|
||||||
>Close</q-btn
|
>Close</q-btn
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
<q-inner-loading :showing="loading">
|
||||||
|
<q-spinner-cube size="50px" color="primary" />
|
||||||
|
</q-inner-loading>
|
||||||
</q-card>
|
</q-card>
|
||||||
</q-dialog>
|
</q-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,6 @@ async function customerStall(path) {
|
||||||
try {
|
try {
|
||||||
const pool = new NostrTools.SimplePool()
|
const pool = new NostrTools.SimplePool()
|
||||||
const filters = [
|
const filters = [
|
||||||
// /
|
|
||||||
{
|
{
|
||||||
kinds: [4],
|
kinds: [4],
|
||||||
'#p': [this.customerPubkey]
|
'#p': [this.customerPubkey]
|
||||||
|
|
@ -261,11 +260,6 @@ async function customerStall(path) {
|
||||||
}
|
}
|
||||||
console.log(`${mine ? 'Me' : 'Merchant'}: ${plaintext}`)
|
console.log(`${mine ? 'Me' : 'Merchant'}: ${plaintext}`)
|
||||||
|
|
||||||
// this.nostrMessages.set(event.id, {
|
|
||||||
// msg: plaintext,
|
|
||||||
// timestamp: event.created_at,
|
|
||||||
// sender: `${mine ? 'Me' : 'Merchant'}`
|
|
||||||
// })
|
|
||||||
this.messageFilter(plaintext, cb => Promise.resolve(pool.close))
|
this.messageFilter(plaintext, cb => Promise.resolve(pool.close))
|
||||||
} catch {
|
} catch {
|
||||||
console.error('Unable to decrypt message!')
|
console.error('Unable to decrypt message!')
|
||||||
|
|
@ -280,7 +274,6 @@ async function customerStall(path) {
|
||||||
let json = JSON.parse(text)
|
let json = JSON.parse(text)
|
||||||
if (json.id != this.activeOrder) return
|
if (json.id != this.activeOrder) return
|
||||||
if (json?.payment_options) {
|
if (json?.payment_options) {
|
||||||
// this.qrCodeDialog.show = true
|
|
||||||
this.qrCodeDialog.data.payment_request = json.payment_options.find(
|
this.qrCodeDialog.data.payment_request = json.payment_options.find(
|
||||||
o => o.type == 'ln'
|
o => o.type == 'ln'
|
||||||
).link
|
).link
|
||||||
|
|
@ -289,24 +282,18 @@ async function customerStall(path) {
|
||||||
message: 'Waiting for payment...'
|
message: 'Waiting for payment...'
|
||||||
})
|
})
|
||||||
} else if (json?.paid) {
|
} else if (json?.paid) {
|
||||||
this.qrCodeDialog.dismissMsg = this.$q.notify({
|
this.closeQrCodeDialog()
|
||||||
|
this.$q.notify({
|
||||||
type: 'positive',
|
type: 'positive',
|
||||||
message: 'Sats received, thanks!',
|
message: 'Sats received, thanks!',
|
||||||
icon: 'thumb_up'
|
icon: 'thumb_up'
|
||||||
})
|
})
|
||||||
this.closeQrCodeDialog()
|
|
||||||
this.activeOrder = null
|
this.activeOrder = null
|
||||||
Promise.resolve(cb())
|
Promise.resolve(cb())
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// async mockInit() {
|
|
||||||
// this.customerPubkey = await window.nostr.getPublicKey()
|
|
||||||
// this.activeOrder =
|
|
||||||
// 'e4a16aa0198022dc682b2b52ed15767438282c0e712f510332fc047eaf795313'
|
|
||||||
// await this.listenMessages()
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.customerPubkey = this.account.pubkey
|
this.customerPubkey = this.account.pubkey
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue