mirror of
https://github.com/lnbits/lnbits.git
synced 2025-10-10 04:22:35 +02:00
fix: at least one charge must be active in order to fetch balance
This commit is contained in:
@@ -49,7 +49,6 @@ class Charges(BaseModel):
|
|||||||
def time_elapsed(self):
|
def time_elapsed(self):
|
||||||
return self.time_left < 0
|
return self.time_left < 0
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def paid(self):
|
def paid(self):
|
||||||
if self.balance >= self.amount:
|
if self.balance >= self.amount:
|
||||||
|
@@ -128,6 +128,7 @@
|
|||||||
<q-td key="timeLeft" :props="props" :class="">
|
<q-td key="timeLeft" :props="props" :class="">
|
||||||
<div>{{props.row.timeLeft}}</div>
|
<div>{{props.row.timeLeft}}</div>
|
||||||
<q-linear-progress
|
<q-linear-progress
|
||||||
|
v-if="props.row.timeLeft"
|
||||||
:value="props.row.progress"
|
:value="props.row.progress"
|
||||||
color="secondary"
|
color="secondary"
|
||||||
>
|
>
|
||||||
@@ -580,16 +581,23 @@
|
|||||||
this.createCharge(wallet, data)
|
this.createCharge(wallet, data)
|
||||||
},
|
},
|
||||||
refreshActiveChargesBalance: async function () {
|
refreshActiveChargesBalance: async function () {
|
||||||
|
try {
|
||||||
const activeLinkIds = this.chargeLinks
|
const activeLinkIds = this.chargeLinks
|
||||||
.filter(c => !c.paid && !c.time_elapsed && !c.hasStaleBalance)
|
.filter(c => !c.paid && !c.time_elapsed && !c.hasStaleBalance)
|
||||||
.map(c => c.id)
|
.map(c => c.id)
|
||||||
.join(',')
|
.join(',')
|
||||||
|
if (activeLinkIds) {
|
||||||
await LNbits.api.request(
|
await LNbits.api.request(
|
||||||
'GET',
|
'GET',
|
||||||
'/satspay/api/v1/charges/balance/' + activeLinkIds,
|
'/satspay/api/v1/charges/balance/' + activeLinkIds,
|
||||||
'filla'
|
'filla'
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
LNbits.utils.notifyApiError(error)
|
||||||
|
} finally {
|
||||||
await this.getCharges()
|
await this.getCharges()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
refreshBalance: async function (charge) {
|
refreshBalance: async function (charge) {
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user