finish webhooks for normal invoices with two extra columns.

This commit is contained in:
fiatjaf
2020-12-24 09:39:46 -03:00
committed by fiatjaf
parent 4623220316
commit 1c922a5ddc
9 changed files with 92 additions and 42 deletions
+4 -1
View File
@@ -140,7 +140,10 @@ window.LNbits = {
'bolt11',
'preimage',
'payment_hash',
'extra'
'extra',
'wallet_id',
'webhook',
'webhook_status'
],
data
)
+22
View File
@@ -204,6 +204,15 @@ Vue.component('lnbits-payment-details', {
<div class="col-3"><b>Payment hash</b>:</div>
<div class="col-9 text-wrap mono">{{ payment.payment_hash }}</div>
</div>
<div class="row" v-if="payment.webhook">
<div class="col-3"><b>Webhook</b>:</div>
<div class="col-9 text-wrap mono">
{{ payment.webhook }}
<q-badge :color="webhookStatusColor" text-color="white">
{{ webhookStatusText }}
</q-badge>
</div>
</div>
<div class="row" v-if="hasPreimage">
<div class="col-3"><b>Payment proof</b>:</div>
<div class="col-9 text-wrap mono">{{ payment.preimage }}</div>
@@ -243,6 +252,19 @@ Vue.component('lnbits-payment-details', {
this.payment.extra.success_action
)
},
webhookStatusColor() {
return this.payment.webhook_status >= 300 ||
this.payment.webhook_status < 0
? 'red-10'
: !this.payment.webhook_status
? 'cyan-7'
: 'green-10'
},
webhookStatusText() {
return this.payment.webhook_status
? this.payment.webhook_status
: 'not sent yet'
},
hasTag() {
return this.payment.extra && !!this.payment.extra.tag
},