purchase viewing
This commit is contained in:
10
src/index.js
10
src/index.js
@@ -12,6 +12,7 @@ import ErrorHandler from './utils/errorHandler.js';
|
||||
import User from './models/User.js';
|
||||
import AdminUserLocationHandler from "./handlers/adminUserLocationHandler.js";
|
||||
import AdminDumpHandler from "./handlers/adminDumpHandler.js";
|
||||
import UserPurchaseHandler from "./handlers/userPurchaseHandler.js";
|
||||
|
||||
// Debug logging function
|
||||
const logDebug = (action, functionName) => {
|
||||
@@ -41,6 +42,7 @@ const adminLocationHandler = new AdminLocationHandler(bot);
|
||||
const adminUserLocationHandler = new AdminUserLocationHandler(bot);
|
||||
const adminProductHandler = new AdminProductHandler(bot);
|
||||
const adminDumpHandler = new AdminDumpHandler(bot);
|
||||
const userPurchaseHandler = new UserPurchaseHandler(bot);
|
||||
|
||||
// Start command - Create user profile
|
||||
bot.onText(/\/start/, async (msg) => {
|
||||
@@ -125,7 +127,7 @@ bot.on('message', async (msg) => {
|
||||
await userWalletsHandler.showBalance(msg);
|
||||
break;
|
||||
case '🛍 Purchases':
|
||||
await userProductHandler.showPurchases(msg);
|
||||
await userPurchaseHandler.showPurchases(msg);
|
||||
break;
|
||||
case '📦 Manage Products':
|
||||
if (adminHandler.isAdmin(msg.from.id)) {
|
||||
@@ -242,6 +244,12 @@ bot.on('callback_query', async (callbackQuery) => {
|
||||
} else if (action.startsWith('pay_with_')) {
|
||||
logDebug(action, 'handlePay');
|
||||
await userProductHandler.handlePay(callbackQuery);
|
||||
} else if (action.startsWith('list_purchases_')) {
|
||||
logDebug(action, 'handlePurchaseListPage');
|
||||
await userPurchaseHandler.handlePurchaseListPage(callbackQuery);
|
||||
} else if (action.startsWith('view_purchase_')) {
|
||||
logDebug(action, 'viewPurchase');
|
||||
await userPurchaseHandler.viewPurchase(callbackQuery);
|
||||
}
|
||||
// Admin location management
|
||||
else if (action === 'add_location') {
|
||||
|
||||
Reference in New Issue
Block a user