fix: improve transaction lookup by supporting internal UUID in sweep API
This commit is contained in:
@@ -16,8 +16,9 @@ export async function POST(request: Request) {
|
||||
|
||||
console.log(`[API] Processing sweep for TX: ${txId} on ${selectedNetwork} with ${selectedToken}`);
|
||||
|
||||
// 1. Fetch the transaction from DB to get the temporary wallet private key
|
||||
const result = await db.query('SELECT * FROM transactions WHERE stripe_pi_id = $1', [txId]);
|
||||
// 1. Fetch the transaction from DB
|
||||
// Search by either the internal UUID (id) or the provider ID (stripe_pi_id)
|
||||
const result = await db.query('SELECT * FROM transactions WHERE id::text = $1 OR stripe_pi_id = $1', [txId]);
|
||||
|
||||
if (result.rows.length === 0) {
|
||||
return NextResponse.json({ success: false, error: "Transaction not found" }, { status: 404 });
|
||||
|
||||
Reference in New Issue
Block a user