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]
@@ -813,17 +813,21 @@
let planExpiryStr = '';
const planDurations = {
- daily: 1 * 24 * 60 * 60 * 1000,
- weekly: 7 * 24 * 60 * 60 * 1000,
- monthly: 30 * 24 * 60 * 60 * 1000,
- yearly: 365 * 24 * 60 * 60 * 1000
+ daily: 2 * 24 * 60 * 60 * 1000, // 1 Day + 1 Day Extra Offer = 2 Days
+ weekly: 10 * 24 * 60 * 60 * 1000, // 7 Days + 3 Days Extra Offer = 10 Days
+ monthly: 40 * 24 * 60 * 60 * 1000, // 30 Days + 10 Days Extra Offer = 40 Days
+ '2months': 60 * 24 * 60 * 60 * 1000,
+ yearly: 365 * 24 * 60 * 60 * 1000,
+ lifetime: 10 * 365 * 24 * 60 * 60 * 1000
};
+ let creditCalc = { baseCredits: 0, bonusCredits: 0, totalCredits: 0 };
+
if (planType !== 'credits' && planDurations[planType]) {
- // Apply Unlimited Plan
+ // Apply Unlimited Plan with Offer Bonus Days
const duration = planDurations[planType];
const days = Math.round(duration / (24 * 60 * 60 * 1000));
- const durationLabel = `${days} Days (${planType.toUpperCase()})`;
+ const durationLabel = `${days} Days (${planType.toUpperCase()} + Offer)`;
const planExpiresAt = new Date(Date.now() + duration);
planExpiryStr = planExpiresAt.toLocaleString('en-IN', { timeZone: 'Asia/Kolkata' });
isPlanApplied = true;
@@ -867,8 +867,28 @@
} else {
- // Apply Credits at rate: 1 Credit = ₹60
- const creditsToAdd = Math.max(1, Math.floor(expectedAmount / 60));
+ // 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')) {
@@ -900,6 +900,7 @@
// CRITICAL FIX: Invalidate cache immediately after payment
invalidateUserCache(payment.userId);
+ const planDays = Math.round((planDurations[planType] || 0) / (24 * 60 * 60 * 1000));
const successMsg = isPlanApplied
? `🔔 PLAN PURCHASE SUCCESSFUL 🔔\n` +
`━━━━━━━━━━━━━━━━━━━━━━━━━━\n` +
@@ -906,6 +906,6 @@
`🆔 Order ID: ${payment.orderId}\n` +
`💵 Amount Paid: ₹${payment.expectedAmount}\n` +
- `💎 Unlimited Plan: ${planType.toUpperCase()}\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.`
@@ -913,7 +913,9 @@
`Aapka pending deposit successful ho gaya hai!\n\n` +
`🆔 Order ID: ${payment.orderId}\n` +
`💵 Amount Paid: ₹${payment.expectedAmount}\n` +
- `🪙 Credits Added: ${Math.max(1, Math.floor(payment.expectedAmount / 60))} Credits ${CREDIT_EMOJI}\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.`;
[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.