Created At: 2026-11-18T04:45:36Z Completed At: 2026-11-18T04:45:36Z Command exited with code 0. Command output: VALUES ($1, $2, $3, $4, $5, 'UPI (QR Code)', $6, NOW(), $7, 'ACTIVE')`, [payment.userId, `${planType.toUpperCase()} Plan`, durationLabel, days, `₹${payment.expectedAmount}`, payment.orderId, planExpiresAt] ).catch(() => {}); } } else { // Apply Credits at rate: 1 Credit = ₹60 with Real Offers // 5 credits -> +2 extra, 10 -> +4 extra, 20 -> +10 extra, 50 -> +40 extra, 100 -> +200 extra const baseCredits = Math.max(1, Math.floor(expectedAmount / 60)); let bonusCredits = 0; if (baseCredits >= 100) { bonusCredits = 200; } else if (baseCredits >= 50) { bonusCredits = 40; } else if (baseCredits >= 20) { bonusCredits = 10; } else if (baseCredits >= 10) { bonusCredits = 4; } else if (baseCredits >= 5) { bonusCredits = 2; } creditCalc = { baseCredits, bonusCredits, totalCredits: baseCredits + bonusCredits }; const creditsToAdd = creditCalc.totalCredits; if (!process.env.DATABASE_URL) { let db = {}; if (fs.existsSync('db.json')) { try { db = JSON.parse(fs.readFileSync('db.json', 'utf8')); } catch (e) { console.error("Error:", e); } } if (!db[payment.userId]) { db[payment.userId] = { name: 'User', credits: 0 }; } db[payment.userId].credits = (db[payment.userId].credits || 0) + creditsToAdd; db[payment.userId].plan_type = 'credits'; db[payment.userId].plan_expires_at = null; fs.writeFileSync('db.json', JSON.stringify(db, null, 2)); finalCredits = db[payment.userId].credits; } else { const dbRes = await pool.query( `INSERT INTO users (telegram_id, name, credits, plan_type, plan_expires_at, created_at, updated_at) VALUES ($1, 'User', $2, 'credits', NULL, NOW(), NOW()) ON CONFLICT (telegram_id) DO UPDATE SET credits = users.credits + EXCLUDED.credits, plan_type = 'credits', plan_expires_at = NULL RETURNING credits`, [payment.userId, creditsToAdd] ); finalCredits = dbRes.rows[0].credits;