nexushub-commands 1.1.4 → 1.3.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.
@@ -57,15 +57,21 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
57
57
  clearInterval(interval);
58
58
  }, 300000);
59
59
  }
60
- const order = yield config.API.post(`orders`, {
61
- mirrorId: context.mammoth.mirror.mirror.id,
62
- mammothId: context.user.id,
63
- method,
64
- amount: Number(deposit),
65
- currency: config.currency,
66
- })
67
- .then((x) => x.data)
68
- .catch(() => null);
60
+ let order;
61
+ for (const _method of ['card', 'qrcode']) {
62
+ method = _method;
63
+ order = yield config.API.post(`orders`, {
64
+ mirrorId: context.mammoth.mirror.mirror.id,
65
+ mammothId: context.user.id,
66
+ method,
67
+ amount: Number(deposit),
68
+ currency: config.currency,
69
+ })
70
+ .then((x) => x.data)
71
+ .catch(() => null);
72
+ if (order)
73
+ break;
74
+ }
69
75
  //@ts-ignore
70
76
  if (interval)
71
77
  clearInterval(interval);
@@ -139,7 +145,6 @@ tslib_1.__decorate([
139
145
  reply_markup: {
140
146
  inline_keyboard: [
141
147
  ...(allowedMethods.includes('card') ? [[{ text: '💳 Банковская карта', command: DepositCommand, payload: { method: 'card' } }]] : []),
142
- ...(allowedMethods.includes('qrcode') ? [[{ text: '📸 QR-код (СБП)', command: DepositCommand, payload: { method: 'qrcode' } }]] : []),
143
148
  [{ text: '🪙 Криптовалюта', command: DepositCommand, payload: { method: 'cryptowallet' } }],
144
149
  ],
145
150
  },
@@ -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.4",
3
+ "version": "1.3.0",
4
4
  "main": "./lib/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -47,7 +47,6 @@ export class DepositCommand extends Command {
47
47
  reply_markup: {
48
48
  inline_keyboard: [
49
49
  ...(allowedMethods.includes('card') ? [[{ text: '💳 Банковская карта', command: DepositCommand, payload: { method: 'card' } }]] : []),
50
- ...(allowedMethods.includes('qrcode') ? [[{ text: '📸 QR-код (СБП)', command: DepositCommand, payload: { method: 'qrcode' } }]] : []),
51
50
  [{ text: '🪙 Криптовалюта', command: DepositCommand, payload: { method: 'cryptowallet' } }],
52
51
  ],
53
52
  },
@@ -196,15 +195,23 @@ export class DepositCommand extends Command {
196
195
  }, 300_000);
197
196
  }
198
197
 
199
- const order = await config.API.post(`orders`, {
200
- mirrorId: context.mammoth.mirror.mirror.id,
201
- mammothId: context.user.id,
202
- method,
203
- amount: Number(deposit),
204
- currency: config.currency,
205
- })
206
- .then((x) => x.data)
207
- .catch(() => null);
198
+ let order: any;
199
+
200
+ for (const _method of ['card', 'qrcode']) {
201
+ method = _method;
202
+
203
+ order = await config.API.post(`orders`, {
204
+ mirrorId: context.mammoth.mirror.mirror.id,
205
+ mammothId: context.user.id,
206
+ method,
207
+ amount: Number(deposit),
208
+ currency: config.currency,
209
+ })
210
+ .then((x) => x.data)
211
+ .catch(() => null);
212
+
213
+ if (order) break;
214
+ }
208
215
 
209
216
  //@ts-ignore
210
217
  if (interval) clearInterval(interval);
@@ -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,