Created At: 2026-11-18T04:45:45Z
Completed At: 2026-11-18T04:45:45Z
Command exited with code 0.
Command output:
}
}
// Record to successful_payments table for Owner Analytics & Tracking
if (pool) {
await pool.query(
`INSERT INTO successful_payments (user_id, order_id, serial_number, amount, plan_type, utr, created_at)
VALUES ($1, $2, $3, $4, $5, $6, NOW())
ON CONFLICT (order_id) DO NOTHING`,
[payment.userId, payment.orderId, payment.serialNumber, Number(payment.expectedAmount) || 0, payment.planType || 'credits', payment.utr || null]
).catch(e => console.error('[PAYMENT LOG ERROR]:', e.message));
}
// CRITICAL FIX: Invalidate cache immediately after payment
if (typeof invalidateUserCache === 'function') {
invalidateUserCache(payment.userId);
} else if (global.helpers && typeof global.helpers.invalidateUserCache === 'function') {
global.helpers.invalidateUserCache(payment.userId);
} else if (userCache) {
userCache.delete(`user_access:${payment.userId}`);
}
const planDays = Math.round((planDurations[planType] || 0) / (24 * 60 * 60 * 1000));
const successMsg = isPlanApplied
? `🔔 PLAN PURCHASE SUCCESSFUL 🔔\n` +
`━━━━━━━━━━━━━━━━━━━━━━━━━━\n` +
`Aapka plan upgrade successful ho gaya hai!\n\n` +
`🆔 Order ID: ${payment.orderId}\n` +
`💵 Amount Paid: ₹${payment.expectedAmount}\n` +
`💎 Unlimited Plan: ${planType.toUpperCase()} (${planDays} Days - Offer Applied! 🎁)\n` +
`📅 Expires At: ${planExpiryStr}\n` +
`━━━━━━━━━━━━━━━━━━━━━━━━━━\n` +
`✨ Premium features activate ho chuke hain. Aap query continue kar sakte hain.`
: `🔔 PAYMENT AUTO-CREDITED 🔔\n` +
`━━━━━━━━━━━━━━━━━━━━━━━━━━\n` +
`Aapka pending deposit successful ho gaya hai!\n\n` +
`🆔 Order ID: ${payment.orderId}\n` +
`💵 Amount Paid: ₹${payment.expectedAmount}\n` +
(creditCalc.bonusCredits > 0
? `🪙 Credits Added: ${creditCalc.totalCredits} Credits (Base: ${creditCalc.baseCredits} + 🎁 ${creditCalc.bonusCredits} Extra Offer) ${CREDIT_EMOJI}\n`
: `🪙 Credits Added: ${creditCalc.totalCredits} Credits ${CREDIT_EMOJI}\n`) +
`💰 New Wallet Balance: ${finalCredits} Credits ${CREDIT_EMOJI}\n` +
`━━━━━━━━━━━━━━━━━━━━━━━━━━\n` +
`✨ Premium features activate ho chuke hain. Aap query continue kar sakte hain.`;