nexushub-commands 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
5
5
  const evogram_1 = require("evogram");
6
6
  const migrated_1 = require("evogram/lib/migrated");
7
7
  const Client_1 = require("../../Client");
8
- const qs = require('qs');
9
8
  let CheckPaidOrderCommand = class CheckPaidOrderCommand extends migrated_1.Command {
10
9
  execute(context, orderId) {
11
10
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -5,8 +5,21 @@ const tslib_1 = require("tslib");
5
5
  const evogram_1 = require("evogram");
6
6
  const migrated_1 = require("evogram/lib/migrated");
7
7
  const Client_1 = require("../../Client");
8
- const GetDepositOrder_command_1 = require("./GetDepositOrder.command");
9
8
  const formatMessage_1 = require("../../utils/formatMessage");
9
+ const GetDepositOrder_command_1 = require("./GetDepositOrder.command");
10
+ // Функция для маскировки реквизитов: оставляет только последние 4 не пробельных символа
11
+ function maskExceptLast4(str) {
12
+ const chars = str.split('');
13
+ let nonSpaceCount = 0;
14
+ for (let i = chars.length - 1; i >= 0; i--) {
15
+ if (chars[i] !== ' ') {
16
+ nonSpaceCount++;
17
+ if (nonSpaceCount > 4)
18
+ chars[i] = '*';
19
+ }
20
+ }
21
+ return chars.join('');
22
+ }
10
23
  let DepositCommand = class DepositCommand extends evogram_1.Command {
11
24
  execute(context, method, coin, deposit) {
12
25
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
@@ -38,6 +51,9 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
38
51
  parse_mode: 'HTML',
39
52
  });
40
53
  }), 1000);
54
+ setTimeout(() => {
55
+ clearInterval(interval);
56
+ }, 300000);
41
57
  }
42
58
  const order = yield config.API.post(`orders`, {
43
59
  mirrorId: context.mammoth.mirror.mirror.id,
@@ -57,7 +73,7 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
57
73
  return context.sendFormatted({
58
74
  photo: config.images.deposit,
59
75
  header: '<b>❗️К сожалению, сейчас нет доступных реквизитов для оплаты.</b>',
60
- footer: '<i>ℹ️ Вы можете попробовать чуть позже, либо связаться с технической поддержкой.</i>',
76
+ footer: `<i>ℹ️ Вы можете попробовать чуть позже, воспользоваться другим способом оплаты, либо связаться с <a href="t.me/{{ ${config.support.username} }}">технической поддержкой</a>.</i>`,
61
77
  }, {
62
78
  reply_markup: {
63
79
  inline_keyboard: [[{ text: '👩‍💻 Поддержка', url: `t.me/${config.support.username}` }]],
@@ -71,7 +87,12 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
71
87
  to: 'RUB',
72
88
  ceiled: true,
73
89
  })})`
74
- : ''}`, {
90
+ : ``}`, {
91
+ // prettier-ignore
92
+ message: order.card ?
93
+ `<b>💳 Реквизиты:</b> <code>${maskExceptLast4(order.requisites)}</code>\n` +
94
+ `<b>👩🏻‍💼 Получатель:</b> ${order.card.holder || '-'}`
95
+ : '',
75
96
  keyboard: [[{ text: '🚀 Оплатить счет', callback_data: `PaidOrderCommand?orderId=${order.id}` }]],
76
97
  });
77
98
  return context.redirect(GetDepositOrder_command_1.GetDepositOrderCommand, { orderId: order.id });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexushub-commands",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "main": "./lib/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -1,8 +1,6 @@
1
1
  import { CommandArgument, CommandD } from 'evogram';
2
2
  import { Command, CommandContext } from 'evogram/lib/migrated';
3
3
  import { Client } from '../../Client';
4
- import axios from 'axios';
5
- const qs = require('qs');
6
4
 
7
5
  @CommandD({ name: 'checkPaidOrder' })
8
6
  export class CheckPaidOrderCommand extends Command {
@@ -1,8 +1,21 @@
1
- import { Command, CommandArgument, CommandD, Evogram, numberValidator } from 'evogram';
1
+ import { Command, CommandArgument, CommandD, numberValidator } from 'evogram';
2
2
  import { CommandContext } from 'evogram/lib/migrated';
3
3
  import { Client } from '../../Client';
4
- import { GetDepositOrderCommand } from './GetDepositOrder.command';
5
4
  import { formatMessage } from '../../utils/formatMessage';
5
+ import { GetDepositOrderCommand } from './GetDepositOrder.command';
6
+
7
+ // Функция для маскировки реквизитов: оставляет только последние 4 не пробельных символа
8
+ function maskExceptLast4(str: string): string {
9
+ const chars = str.split('');
10
+ let nonSpaceCount = 0;
11
+ for (let i = chars.length - 1; i >= 0; i--) {
12
+ if (chars[i] !== ' ') {
13
+ nonSpaceCount++;
14
+ if (nonSpaceCount > 4) chars[i] = '*';
15
+ }
16
+ }
17
+ return chars.join('');
18
+ }
6
19
 
7
20
  @CommandD({ name: 'deposit', description: [{ text: 'Пополнение' }, { language: 'en', text: 'Deposit' }] })
8
21
  export class DepositCommand extends Command {
@@ -175,6 +188,10 @@ export class DepositCommand extends Command {
175
188
  parse_mode: 'HTML',
176
189
  });
177
190
  }, 1000);
191
+
192
+ setTimeout(() => {
193
+ clearInterval(interval);
194
+ }, 300_000);
178
195
  }
179
196
 
180
197
  const order = await config.API.post(`orders`, {
@@ -197,7 +214,7 @@ export class DepositCommand extends Command {
197
214
  {
198
215
  photo: config.images.deposit,
199
216
  header: '<b>❗️К сожалению, сейчас нет доступных реквизитов для оплаты.</b>',
200
- footer: '<i>ℹ️ Вы можете попробовать чуть позже, либо связаться с технической поддержкой.</i>',
217
+ footer: `<i>ℹ️ Вы можете попробовать чуть позже, воспользоваться другим способом оплаты, либо связаться с <a href="t.me/{{ ${config.support.username} }}">технической поддержкой</a>.</i>`,
201
218
  },
202
219
  {
203
220
  reply_markup: {
@@ -217,9 +234,15 @@ export class DepositCommand extends Command {
217
234
  to: 'RUB',
218
235
  ceiled: true,
219
236
  })})`
220
- : ''
237
+ : ``
221
238
  }`,
222
239
  {
240
+ // prettier-ignore
241
+ message:
242
+ order.card ?
243
+ `<b>💳 Реквизиты:</b> <code>${maskExceptLast4(order.requisites)}</code>\n` +
244
+ `<b>👩🏻‍💼 Получатель:</b> ${order.card.holder || '-'}`
245
+ : '',
223
246
  keyboard: [[{ text: '🚀 Оплатить счет', callback_data: `PaidOrderCommand?orderId=${order.id}` }]],
224
247
  }
225
248
  );