commit
f91c0ec38c
1 changed files with 52 additions and 63 deletions
|
|
@ -193,11 +193,6 @@ async function customerStall(path) {
|
|||
},
|
||||
async placeOrder() {
|
||||
this.loading = true
|
||||
LNbits.utils
|
||||
.confirmDialog(
|
||||
`Send the order to the merchant? You should receive a message with the payment details.`
|
||||
)
|
||||
.onOk(async () => {
|
||||
let orderData = this.checkoutDialog.data
|
||||
let orderObj = {
|
||||
name: orderData?.username,
|
||||
|
|
@ -214,9 +209,7 @@ async function customerStall(path) {
|
|||
}
|
||||
let created_at = Math.floor(Date.now() / 1000)
|
||||
orderObj.id = await hash(
|
||||
[this.customerPubkey, created_at, JSON.stringify(orderObj)].join(
|
||||
':'
|
||||
)
|
||||
[this.customerPubkey, created_at, JSON.stringify(orderObj)].join(':')
|
||||
)
|
||||
this.activeOrder = orderObj.id
|
||||
let event = {
|
||||
|
|
@ -246,16 +239,12 @@ async function customerStall(path) {
|
|||
}
|
||||
event.id = NostrTools.getEventHash(event)
|
||||
if (this.customerPrivkey) {
|
||||
event.sig = await NostrTools.signEvent(
|
||||
event,
|
||||
this.customerPrivkey
|
||||
)
|
||||
event.sig = await NostrTools.signEvent(event, this.customerPrivkey)
|
||||
} else if (this.customerUseExtension && this.hasNip07) {
|
||||
event = await window.nostr.signEvent(event)
|
||||
}
|
||||
this.resetCheckout()
|
||||
await this.sendOrder(event)
|
||||
})
|
||||
},
|
||||
async sendOrder(order) {
|
||||
this.$q.notify({
|
||||
|
|
@ -276,7 +265,7 @@ async function customerStall(path) {
|
|||
await relay.connect()
|
||||
let pub = relay.publish(order)
|
||||
pub.on('ok', () => {
|
||||
console.debug(`${relay.url} has accepted our event`)
|
||||
console.debug(`${relay.url} has accepted our event: ${order.id}`)
|
||||
relay.close()
|
||||
})
|
||||
pub.on('failed', reason => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue