mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-28 04:46:18 +02:00
tags and extras metadata in payment details dialog.
This commit is contained in:
@@ -191,11 +191,18 @@ async def api_payments_pay_lnurl():
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
extra = {}
|
||||||
|
|
||||||
|
if params.get("successAction"):
|
||||||
|
extra["success_action"] = params["successAction"]
|
||||||
|
if g.data["comment"]:
|
||||||
|
extra["comment"] = g.data["comment"]
|
||||||
|
|
||||||
payment_hash = pay_invoice(
|
payment_hash = pay_invoice(
|
||||||
wallet_id=g.wallet.id,
|
wallet_id=g.wallet.id,
|
||||||
payment_request=params["pr"],
|
payment_request=params["pr"],
|
||||||
description=g.data.get("description", ""),
|
description=g.data.get("description", ""),
|
||||||
extra={"success_action": params.get("successAction")},
|
extra=extra,
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
traceback.print_exc(7)
|
traceback.print_exc(7)
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* global Vue, moment, LNbits, EventHub, decryptLnurlPayAES */
|
/* global _, Vue, moment, LNbits, EventHub, decryptLnurlPayAES */
|
||||||
|
|
||||||
Vue.component('lnbits-fsat', {
|
Vue.component('lnbits-fsat', {
|
||||||
props: {
|
props: {
|
||||||
@@ -179,6 +179,11 @@ Vue.component('lnbits-payment-details', {
|
|||||||
props: ['payment'],
|
props: ['payment'],
|
||||||
template: `
|
template: `
|
||||||
<div class="q-py-md" style="text-align: left">
|
<div class="q-py-md" style="text-align: left">
|
||||||
|
<div class="row justify-center q-mb-md">
|
||||||
|
<q-badge v-if="hasTag" color="yellow" text-color="black">
|
||||||
|
#{{ payment.tag }}
|
||||||
|
</q-badge>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-3"><b>Date</b>:</div>
|
<div class="col-3"><b>Date</b>:</div>
|
||||||
<div class="col-9">{{ payment.date }} ({{ payment.dateFrom }})</div>
|
<div class="col-9">{{ payment.date }} ({{ payment.dateFrom }})</div>
|
||||||
@@ -203,6 +208,15 @@ Vue.component('lnbits-payment-details', {
|
|||||||
<div class="col-3"><b>Payment proof</b>:</div>
|
<div class="col-3"><b>Payment proof</b>:</div>
|
||||||
<div class="col-9 text-wrap mono">{{ payment.preimage }}</div>
|
<div class="col-9 text-wrap mono">{{ payment.preimage }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row" v-for="entry in extras">
|
||||||
|
<div class="col-3">
|
||||||
|
<q-badge v-if="hasTag" color="purple" text-color="white">
|
||||||
|
extra
|
||||||
|
</q-badge>
|
||||||
|
<b>{{ entry.key }}</b>:
|
||||||
|
</div>
|
||||||
|
<div class="col-9 text-wrap mono">{{ entry.value }}</div>
|
||||||
|
</div>
|
||||||
<div class="row" v-if="hasSuccessAction">
|
<div class="row" v-if="hasSuccessAction">
|
||||||
<div class="col-3"><b>Success action</b>:</div>
|
<div class="col-3"><b>Success action</b>:</div>
|
||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
@@ -228,6 +242,14 @@ Vue.component('lnbits-payment-details', {
|
|||||||
this.payment.extra &&
|
this.payment.extra &&
|
||||||
this.payment.extra.success_action
|
this.payment.extra.success_action
|
||||||
)
|
)
|
||||||
|
},
|
||||||
|
hasTag() {
|
||||||
|
return this.payment.extra && !!this.payment.extra.tag
|
||||||
|
},
|
||||||
|
extras() {
|
||||||
|
if (!this.payment.extra) return []
|
||||||
|
let extras = _.omit(this.payment.extra, ['tag', 'success_action'])
|
||||||
|
return Object.keys(extras).map(key => ({key, value: extras[key]}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user