nexushub-commands 1.2.0 → 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
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexushub-commands",
3
- "version": "1.2.0",
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);