diff --git a/lnbits/extensions/satspay/templates/satspay/display.html b/lnbits/extensions/satspay/templates/satspay/display.html
index 58f6b51c..02bec930 100644
--- a/lnbits/extensions/satspay/templates/satspay/display.html
+++ b/lnbits/extensions/satspay/templates/satspay/display.html
@@ -13,7 +13,7 @@
Time elapsed
@@ -25,14 +25,18 @@
Charge paid
-
+
Awaiting payment...
- {% raw %} {{ newTimeLeft }} {% endraw %}
@@ -155,7 +159,7 @@
-
+
-
+
-
+
= this.charge.amount) {
- this.charge.paid = true
- }
+ this.charge = mapCharge(data, this.charge)
+ } catch (error) {
+ LNbits.utils.notifyApiError(error)
+ }
+ },
+ refreshCharge: async function () {
+ try {
+ const {data} = await LNbits.api.request(
+ 'GET',
+ `/satspay/api/v1/charge/${this.charge.id}`
+ )
+ this.charge = mapCharge(data, this.charge)
+ console.log('### ', this.charge)
} catch (error) {
LNbits.utils.notifyApiError(error)
}
@@ -375,28 +380,13 @@
this.lnbtc = false
this.onbtc = true
},
- refreshExpirationTime: function () {
- this.timetoComplete =
- parseInt(this.charge.time) * 60 -
- (Date.now() / 1000 - parseInt(this.charge.timestamp))
- this.newTimeLeft = Quasar.utils.date.formatDate(
- new Date((this.timeToComplete - 3600) * 1000),
- 'HH:mm:ss'
- )
- },
- refreshProgres: function () {
- this.refreshExpirationTime()
- this.newProgress =
- 1 - this.timeToComplete / (parseInt(this.charge.time) * 60)
- },
loopRefresh: function () {
// invoice only
const refreshIntervalId = setInterval(async () => {
- if (this.charge.paid || this.timetoComplete < 1) {
+ if (this.charge.paid || !this.charge.timeLeft) {
clearInterval(refreshIntervalId)
}
- this.refreshProgres()
if (this.counter % 10 === 0) {
await this.checkBalances()
await this.checkPendingOnchain()
@@ -456,7 +446,6 @@
this.wallet.inkey = '{{ wallet_inkey }}'
this.startPaymentNotifier()
- this.refreshProgres()
if (!this.charge.paid) {
this.loopRefresh()
}
diff --git a/lnbits/extensions/satspay/templates/satspay/index.html b/lnbits/extensions/satspay/templates/satspay/index.html
index abef0291..7158453f 100644
--- a/lnbits/extensions/satspay/templates/satspay/index.html
+++ b/lnbits/extensions/satspay/templates/satspay/index.html
@@ -125,8 +125,13 @@
>{{props.row.description}}
-
- {{props.row.date}}
+
+ {{props.row.timeLeft}}
+
+
{{props.row.time}}
@@ -424,10 +429,10 @@
field: 'description'
},
{
- name: 'timeleft',
+ name: 'timeLeft',
align: 'left',
label: 'Time left',
- field: 'date'
+ field: 'timeLeft'
},
{
name: 'time to pay',
@@ -638,7 +643,7 @@
data
)
- this.chargeLinks.push(mapCharge(resp.data))
+ this.chargeLinks.unshift(mapCharge(resp.data))
this.formDialogCharge.show = false
this.formDialogCharge.data = {
onchain: false,