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 15:47:26 +02:00 committed by GitHub
parent b14d36a0aa
commit 8f761dfd0f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 301 additions and 258 deletions

View file

@ -55,8 +55,8 @@ cursor.execute(
"""
INSERT INTO apipayments
(wallet, checking_id, bolt11, hash, preimage,
amount, pending, memo, fee, extra, webhook, expiry)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
amount, status, memo, fee, extra, webhook, expiry, pending)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""",
(
wallet_id,
@ -65,12 +65,13 @@ cursor.execute(
"test_admin_internal",
None,
amount * 1000,
False,
"success",
"test_admin_internal",
0,
None,
"",
expiration_date,
False, # TODO: remove this in next release
),
)