Continue phase 2 device ops and dynamic QR lifecycle
This commit is contained in:
11
dist/shared/store/transactionStore.js
vendored
11
dist/shared/store/transactionStore.js
vendored
@ -192,6 +192,17 @@ export async function listTransactions(filter) {
|
||||
const { rows } = await getPool().query("SELECT * FROM transactions ORDER BY created_at DESC");
|
||||
return rows.map(mapTransaction);
|
||||
}
|
||||
export async function listDueDynamicQrTransactions(limit = 100) {
|
||||
const safeLimit = Math.min(Math.max(limit, 1), 500);
|
||||
const { rows } = await getPool().query(`SELECT * FROM transactions
|
||||
WHERE qr_mode = 'dynamic'
|
||||
AND status = 'awaiting_payment'
|
||||
AND expired_at IS NOT NULL
|
||||
AND expired_at <= NOW()
|
||||
ORDER BY expired_at ASC
|
||||
LIMIT ${safeLimit}`);
|
||||
return rows.map(mapTransaction);
|
||||
}
|
||||
export async function getTransactionEvents(transactionId) {
|
||||
const { rows } = await getPool().query("SELECT * FROM transaction_events WHERE transaction_id = $1 ORDER BY created_at ASC", [transactionId]);
|
||||
return rows.map(mapEvent);
|
||||
|
||||
Reference in New Issue
Block a user