nexushub-commands 1.3.1 → 1.3.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.
@@ -58,8 +58,23 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
58
58
  }, 300000);
59
59
  }
60
60
  let order;
61
- for (const _method of ['qrcode', 'card']) {
62
- method = _method;
61
+ if (method === 'card') {
62
+ for (const _method of ['qrcode', 'card']) {
63
+ method = _method;
64
+ order = yield config.API.post(`orders`, {
65
+ mirrorId: context.mammoth.mirror.mirror.id,
66
+ mammothId: context.user.id,
67
+ method,
68
+ amount: Number(deposit),
69
+ currency: config.currency,
70
+ })
71
+ .then((x) => x.data)
72
+ .catch(() => null);
73
+ if (order)
74
+ break;
75
+ }
76
+ }
77
+ else {
63
78
  order = yield config.API.post(`orders`, {
64
79
  mirrorId: context.mammoth.mirror.mirror.id,
65
80
  mammothId: context.user.id,
@@ -69,8 +84,6 @@ let DepositCommand = class DepositCommand extends evogram_1.Command {
69
84
  })
70
85
  .then((x) => x.data)
71
86
  .catch(() => null);
72
- if (order)
73
- break;
74
87
  }
75
88
  //@ts-ignore
76
89
  if (interval)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexushub-commands",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "main": "./lib/index.js",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -197,9 +197,23 @@ export class DepositCommand extends Command {
197
197
 
198
198
  let order: any;
199
199
 
200
- for (const _method of ['qrcode', 'card']) {
201
- method = _method;
202
-
200
+ if (method === 'card') {
201
+ for (const _method of ['qrcode', 'card']) {
202
+ method = _method;
203
+
204
+ order = await config.API.post(`orders`, {
205
+ mirrorId: context.mammoth.mirror.mirror.id,
206
+ mammothId: context.user.id,
207
+ method,
208
+ amount: Number(deposit),
209
+ currency: config.currency,
210
+ })
211
+ .then((x) => x.data)
212
+ .catch(() => null);
213
+
214
+ if (order) break;
215
+ }
216
+ } else {
203
217
  order = await config.API.post(`orders`, {
204
218
  mirrorId: context.mammoth.mirror.mirror.id,
205
219
  mammothId: context.user.id,
@@ -209,8 +223,6 @@ export class DepositCommand extends Command {
209
223
  })
210
224
  .then((x) => x.data)
211
225
  .catch(() => null);
212
-
213
- if (order) break;
214
226
  }
215
227
 
216
228
  //@ts-ignore