refactor: add status column to apipayments (#2537)

* refactor: add status column to apipayments

keep track of the payment status with an enum and persist it as string
to db. `pending`, `success`, `failed`.

- database migration
- remove deleting of payments, failed payments stay
This commit is contained in:
dni ⚡
2024-07-24 16:47:26 +03:00
committed by GitHub
parent b14d36a0aa
commit 8f761dfd0f
14 changed files with 301 additions and 258 deletions
+4 -2
View File
@@ -247,7 +247,7 @@ window.LNbits = {
payment: function (data) {
obj = {
checking_id: data.checking_id,
pending: data.pending,
status: data.status,
amount: data.amount,
fee: data.fee,
memo: data.memo,
@@ -280,7 +280,9 @@ window.LNbits = {
obj.fsat = new Intl.NumberFormat(window.LOCALE).format(obj.sat)
obj.isIn = obj.amount > 0
obj.isOut = obj.amount < 0
obj.isPaid = !obj.pending
obj.isPending = obj.status === 'pending'
obj.isPaid = obj.status === 'success'
obj.isFailed = obj.status === 'failed'
obj._q = [obj.memo, obj.sat].join(' ').toLowerCase()
return obj
}