The following changes were made by the replace_file_content tool to: /root/aadharbot/index.js. If relevant, proactively run terminal commands to execute this code for the USER. Don't ask for permission. [diff_block_start] @@ -4285,13 +4285,17 @@ const histJson = await histRes.json(); if (histJson.code === 0 && histJson.data && histJson.data.records) { const matched = histJson.data.records.find(r => { - let dateMatches = true; + if (r.status && r.status !== 'PENDING') return false; + const amountMatches = Math.abs(Number(r.depositAmount) - Number(amount)) < 1; + if (!amountMatches) return false; if (expectedDate && r.depositDate) { const diff = dateDifferenceSeconds(r.depositDate, expectedDate); - dateMatches = diff <= 60; + return diff <= 180; } - const amountMatches = Math.abs(Number(r.depositAmount) - Number(amount)) < 1; - return dateMatches && amountMatches; + return true; + }) || histJson.data.records.find(r => { + if (r.status && r.status !== 'PENDING') return false; + return Math.abs(Number(r.depositAmount) - Number(amount)) < 1; }); if (matched) { serialNumber = matched.serialNumber; [diff_block_end] Please note that the above snippet only shows the MODIFIED lines from the last change. It shows up to 3 lines of unchanged lines before and after the modified lines. The actual file contents may have many more lines not shown.