Mohammed Foud commited on
Commit
41011f5
·
1 Parent(s): d3aa312
src/bots/handlers/purchaseHandlers.ts CHANGED
@@ -217,25 +217,25 @@ export const executePurchase = async (
217
  logger.error(`Error purchasing number for ${service} in ${countryId}: ${error.message}`);
218
 
219
  // Create purchase record with FAILED state if we have user info
220
- try {
221
- const user = await authService.getUserByTelegramId(telegramId!,ctx);
222
- if (user) {
223
- // Return the cost to user's balance on error
224
- await authService.updateUserBalance(telegramId!,ctx, user.balance + costWithProfit);
225
 
226
- await purchaseTrackingService.createPurchase({
227
- userId: user.id,
228
- telegramId: telegramId!,
229
- service: service,
230
- countryId: countryId,
231
- operator: operator,
232
- cost: costWithProfit,
233
- state: PurchaseState.FAILED
234
- });
235
- }
236
- } catch (dbError) {
237
- logger.error(`Error creating failed purchase record: ${dbError}`);
238
- }
239
 
240
  await ctx.deleteMessage(loadingMsgId);
241
  await ctx.reply(getPurchaseErrorMessage(error.message), getLoggedInMenuKeyboard());
 
217
  logger.error(`Error purchasing number for ${service} in ${countryId}: ${error.message}`);
218
 
219
  // Create purchase record with FAILED state if we have user info
220
+ // try {
221
+ // const user = await authService.getUserByTelegramId(telegramId!,ctx);
222
+ // if (user) {
223
+ // // Return the cost to user's balance on error
224
+ // await authService.updateUserBalance(telegramId!,ctx, user.balance + costWithProfit);
225
 
226
+ // await purchaseTrackingService.createPurchase({
227
+ // userId: user.id,
228
+ // telegramId: telegramId!,
229
+ // service: service,
230
+ // countryId: countryId,
231
+ // operator: operator,
232
+ // cost: costWithProfit,
233
+ // state: PurchaseState.FAILED
234
+ // });
235
+ // }
236
+ // } catch (dbError) {
237
+ // logger.error(`Error creating failed purchase record: ${dbError}`);
238
+ // }
239
 
240
  await ctx.deleteMessage(loadingMsgId);
241
  await ctx.reply(getPurchaseErrorMessage(error.message), getLoggedInMenuKeyboard());
src/bots/index.ts CHANGED
@@ -78,7 +78,7 @@ export const handleAddTelegrafBot = async (botId: string) => {
78
  await result.bot.launch();
79
 
80
  // Setup payment webhook handlers
81
- setupPaymentWebhookHandlers(result.bot);
82
 
83
  return { status: 200, data: {
84
  message: result.message,
 
78
  await result.bot.launch();
79
 
80
  // Setup payment webhook handlers
81
+ // setupPaymentWebhookHandlers(result.bot);
82
 
83
  return { status: 200, data: {
84
  message: result.message,
src/bots/services/BalanceUpdateService.ts CHANGED
@@ -15,7 +15,7 @@ export class BalanceUpdateService {
15
  private constructor() {
16
  // Delay the initial subscription setup to ensure bot is ready
17
  setTimeout(() => {
18
- this.setupRealtimeSubscription();
19
  //this.setupBotsSubscription();
20
  }, 1000);
21
  }
 
15
  private constructor() {
16
  // Delay the initial subscription setup to ensure bot is ready
17
  setTimeout(() => {
18
+ //this.setupRealtimeSubscription();
19
  //this.setupBotsSubscription();
20
  }, 1000);
21
  }
src/bots/utils/5sim_products_meta.json ADDED
The diff for this file is too large to render. See raw diff
 
src/bots/utils/handlerUtils.ts CHANGED
@@ -59,6 +59,7 @@ export const callbackReplyHandler = (
59
  // Answer the callback query first
60
  await ctx.answerCbQuery();
61
 
 
62
  // Execute the reply function to get message content and options
63
  const result = await Promise.resolve(replyFunction(ctx));
64
 
 
59
  // Answer the callback query first
60
  await ctx.answerCbQuery();
61
 
62
+
63
  // Execute the reply function to get message content and options
64
  const result = await Promise.resolve(replyFunction(ctx));
65
 
src/db/supabase.ts CHANGED
@@ -7,11 +7,11 @@ export const supabaseAnonKey = process.env.SUPABASE_ANON_KEY
7
  export const service_role_key = process.env.SUPABASE_SERVICE_ROLE_KEY
8
  // Create Supabase client with real-time enabled
9
  export const supabase = createClient(supabaseUrl!, supabaseAnonKey!, {
10
- realtime: {
11
- params: {
12
- eventsPerSecond: 10
13
- }
14
- }
15
  })
16
 
17
  // Create admin client with service role key
@@ -20,11 +20,11 @@ export const supabaseAdmin = createClient(supabaseUrl!, service_role_key!, {
20
  autoRefreshToken: false,
21
  persistSession: false
22
  },
23
- realtime: {
24
- params: {
25
- eventsPerSecond: 10
26
- }
27
- }
28
  })
29
 
30
  // Access auth admin api
 
7
  export const service_role_key = process.env.SUPABASE_SERVICE_ROLE_KEY
8
  // Create Supabase client with real-time enabled
9
  export const supabase = createClient(supabaseUrl!, supabaseAnonKey!, {
10
+ // realtime: {
11
+ // params: {
12
+ // eventsPerSecond: 10
13
+ // }
14
+ // }
15
  })
16
 
17
  // Create admin client with service role key
 
20
  autoRefreshToken: false,
21
  persistSession: false
22
  },
23
+ // realtime: {
24
+ // params: {
25
+ // eventsPerSecond: 10
26
+ // }
27
+ // }
28
  })
29
 
30
  // Access auth admin api