The following changes were made by the replace_file_content tool to: /root/aadharbot/modules/pay/services/paymentService.js. If relevant, proactively run terminal commands to execute this code for the USER. Don't ask for permission.
[diff_block_start]
@@ -486,10 +486,20 @@
const loadingMsg = await ctx.reply(`⏳ Submitting UTR for verification... Please wait.\n\nAapka payment receive hote hi credits automatically add ho jayenge. Please is window ko cancel na karein.`, { parse_mode: 'HTML' });
try {
- try {
- await gateways.uploadUtr(session, utr);
- } catch (err) {
- console.error(`[UTR UPLOAD ERROR]: Gateway upload returned error: ${err.message}. Proceeding to verification regardless.`);
+ let uploadSuccess = false;
+ for (let attempt = 1; attempt <= 3; attempt++) {
+ try {
+ await gateways.uploadUtr(session, utr);
+ uploadSuccess = true;
+ break;
+ } catch (err) {
+ console.error(`[UTR UPLOAD ERROR]: Gateway upload attempt ${attempt} returned error: ${err.message}.`);
+ if (attempt < 3) await new Promise(r => setTimeout(r, 2000)); // wait 2 seconds before retry
+ }
+ }
+
+ if (!uploadSuccess) {
+ console.error(`[UTR UPLOAD ERROR]: All gateway upload attempts failed. Proceeding to verification regardless.`);
}
// Save order to pending payments for background daemon tracking
[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.