nexushub-commands 1.1.3 → 1.2.0

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.
@@ -9,6 +9,8 @@ const formatMessage_1 = require("../../utils/formatMessage");
9
9
  const GetDepositOrder_command_1 = require("./GetDepositOrder.command");
10
10
  // Функция для маскировки реквизитов: оставляет только последние 4 не пробельных символа
11
11
  function maskExceptLast4(str) {
12
+ if (!str)
13
+ return '';
12
14
  const chars = str.split('');
13
15
  let nonSpaceCount = 0;
14
16
  for (let i = chars.length - 1; i >= 0; i--) {
@@ -90,7 +92,7 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
90
92
  : ``}`, {
91
93
  // prettier-ignore
92
94
  message: order.card ?
93
- `<b>💳 Реквизиты:</b> <code>${maskExceptLast4(order.requisites)}</code>\n` +
95
+ `<b>💳 Реквизиты:</b> <code>${maskExceptLast4(order.card.requisites)}</code>\n` +
94
96
  `<b>👩🏻‍💼 Получатель:</b> ${order.card.holder || '-'}`
95
97
  : '',
96
98
  keyboard: [[{ text: '🚀 Оплатить счет', callback_data: `PaidOrderCommand?orderId=${order.id}` }]],
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SendChequeCommand = void 0;
4
4
  const tslib_1 = require("tslib");
5
+ const axios_1 = tslib_1.__importDefault(require("axios"));
5
6
  const evogram_1 = require("evogram");
6
7
  const migrated_1 = require("evogram/lib/migrated");
7
8
  const Client_1 = require("../../Client");
8
- const axios_1 = tslib_1.__importDefault(require("axios"));
9
9
  const qs = require('qs');
10
10
  let SendChequeCommand = class SendChequeCommand extends migrated_1.Command {
11
11
  execute(context, orderId) {
@@ -54,6 +54,9 @@ let SendChequeCommand = class SendChequeCommand extends migrated_1.Command {
54
54
  yield config.API.put(`/orders/${orderId}`, {
55
55
  cheque: photoURL,
56
56
  });
57
+ yield context.user.log(0, `Отправлен чек на оплату счета`, {
58
+ photo: photoURL,
59
+ });
57
60
  return context.sendFormatted({
58
61
  photo: photoURL,
59
62
  header: '<blockquote><b>🧾 Подтверждение оплаты счета</b></blockquote>',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexushub-commands",
3
- "version": "1.1.3",
3
+ "version": "1.2.0",
4
4
  "main": "./lib/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -6,6 +6,8 @@ import { GetDepositOrderCommand } from './GetDepositOrder.command';
6
6
 
7
7
  // Функция для маскировки реквизитов: оставляет только последние 4 не пробельных символа
8
8
  function maskExceptLast4(str: string): string {
9
+ if (!str) return '';
10
+
9
11
  const chars = str.split('');
10
12
  let nonSpaceCount = 0;
11
13
  for (let i = chars.length - 1; i >= 0; i--) {
@@ -240,7 +242,7 @@ export class DepositCommand extends Command {
240
242
  // prettier-ignore
241
243
  message:
242
244
  order.card ?
243
- `<b>💳 Реквизиты:</b> <code>${maskExceptLast4(order.requisites)}</code>\n` +
245
+ `<b>💳 Реквизиты:</b> <code>${maskExceptLast4(order.card.requisites)}</code>\n` +
244
246
  `<b>👩🏻‍💼 Получатель:</b> ${order.card.holder || '-'}`
245
247
  : '',
246
248
  keyboard: [[{ text: '🚀 Оплатить счет', callback_data: `PaidOrderCommand?orderId=${order.id}` }]],
@@ -1,7 +1,7 @@
1
+ import axios from 'axios';
1
2
  import { CommandArgument, CommandD } from 'evogram';
2
3
  import { Command, CommandContext } from 'evogram/lib/migrated';
3
4
  import { Client } from '../../Client';
4
- import axios from 'axios';
5
5
  const qs = require('qs');
6
6
 
7
7
  @CommandD({ name: 'sendCheque' })
@@ -59,6 +59,10 @@ export class SendChequeCommand extends Command {
59
59
  cheque: photoURL,
60
60
  });
61
61
 
62
+ await context.user.log(0, `Отправлен чек на оплату счета`, {
63
+ photo: photoURL,
64
+ });
65
+
62
66
  return context.sendFormatted(
63
67
  {
64
68
  photo: photoURL,