payment dialog flow

This commit is contained in:
Tiago Vasconcelos 2023-03-08 15:57:16 +00:00
parent 8042f12357
commit 5c4bcdf131
2 changed files with 9 additions and 24 deletions

View file

@ -7,7 +7,10 @@
@click="$emit('change-page', 'market')"
style="cursor: pointer"
></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-toolbar-title></q-toolbar-title>
<chat-dialog
@ -151,14 +154,6 @@
position="top"
@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">
<div class="text-center q-mb-lg">
<a :href="'lightning:' + qrCodeDialog.data.payment_request">
@ -187,6 +182,9 @@
>Close</q-btn
>
</div>
<q-inner-loading :showing="loading">
<q-spinner-cube size="50px" color="primary" />
</q-inner-loading>
</q-card>
</q-dialog>
</div>

View file

@ -231,7 +231,6 @@ async function customerStall(path) {
try {
const pool = new NostrTools.SimplePool()
const filters = [
// /
{
kinds: [4],
'#p': [this.customerPubkey]
@ -261,11 +260,6 @@ async function customerStall(path) {
}
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))
} catch {
console.error('Unable to decrypt message!')
@ -280,7 +274,6 @@ async function customerStall(path) {
let json = JSON.parse(text)
if (json.id != this.activeOrder) return
if (json?.payment_options) {
// this.qrCodeDialog.show = true
this.qrCodeDialog.data.payment_request = json.payment_options.find(
o => o.type == 'ln'
).link
@ -289,24 +282,18 @@ async function customerStall(path) {
message: 'Waiting for payment...'
})
} else if (json?.paid) {
this.qrCodeDialog.dismissMsg = this.$q.notify({
this.closeQrCodeDialog()
this.$q.notify({
type: 'positive',
message: 'Sats received, thanks!',
icon: 'thumb_up'
})
this.closeQrCodeDialog()
this.activeOrder = null
Promise.resolve(cb())
} else {
return
}
}
// async mockInit() {
// this.customerPubkey = await window.nostr.getPublicKey()
// this.activeOrder =
// 'e4a16aa0198022dc682b2b52ed15767438282c0e712f510332fc047eaf795313'
// await this.listenMessages()
// }
},
created() {
this.customerPubkey = this.account.pubkey