Implement phase 1 completion and phase 2 dynamic QR

This commit is contained in:
2026-05-26 08:06:48 +07:00
parent a152c99cce
commit 5624b92872
36 changed files with 3104 additions and 71 deletions

View File

@ -1,5 +1,6 @@
import { randomUUID } from "node:crypto";
import { getPool } from "../db/pool";
import { createPaidLedgerPlaceholder } from "./ledgerStore";
export type TransactionStatus =
| "initiated"
@ -15,9 +16,10 @@ export type TransactionEventType =
| "CALLBACK_RECEIVED"
| "CALLBACK_REJECTED"
| "CALLBACK_DUPLICATE"
| "PUSH_QUEUED";
| "PUSH_QUEUED"
| "DYNAMIC_QR_CREATED";
export type TransactionEventSource = "webhook" | "system" | "admin";
export type TransactionEventSource = "webhook" | "system" | "admin" | "device";
export interface TransactionEntity {
id: string;
@ -265,7 +267,12 @@ export async function updateTransactionStatus(
}
});
return mapTransaction(rows[0]);
const updated = mapTransaction(rows[0]);
if (to === "paid") {
await createPaidLedgerPlaceholder(updated);
}
return updated;
}
export async function getTransactionById(id: string): Promise<TransactionEntity | null> {