@riocrypto/common 1.0.425 → 1.0.426

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.
@@ -27,37 +27,39 @@ const getOrder = (req, res, next, mongoose, onlyBankOrders) => __awaiter(void 0,
27
27
  else if (req.query.orderId) {
28
28
  orderId = req.query.orderId;
29
29
  }
30
- if (!orderId) {
31
- throw new Error("Failed to provide orderId");
32
- }
33
- try {
34
- const Order = yield (0, order_1.buildOrder)(mongoose);
35
- const order = yield Order.findById(orderId);
36
- if (!order) {
37
- throw new Error();
38
- }
39
- if (onlyBankOrders) {
40
- if ([
41
- processor_1.Processor.Interbank,
42
- processor_1.Processor.SPEI,
43
- processor_1.Processor.SWIFT,
44
- processor_1.Processor.SPID,
45
- ].includes(order.processor)) {
46
- req.order = order;
30
+ if (orderId) {
31
+ try {
32
+ const Order = yield (0, order_1.buildOrder)(mongoose);
33
+ const order = yield Order.findById(orderId);
34
+ if (!order) {
35
+ throw new Error();
36
+ }
37
+ console.log("order", order.toJSON());
38
+ if (onlyBankOrders) {
39
+ if ([
40
+ processor_1.Processor.Interbank,
41
+ processor_1.Processor.SPEI,
42
+ processor_1.Processor.SWIFT,
43
+ processor_1.Processor.SPID,
44
+ ].includes(order.processor)) {
45
+ req.order = order;
46
+ }
47
+ else {
48
+ throw new wrong_processor_error_1.WrongProcessorError();
49
+ }
47
50
  }
48
51
  else {
49
- throw new wrong_processor_error_1.WrongProcessorError();
52
+ req.order = order;
50
53
  }
51
54
  }
52
- else {
53
- req.order = order;
55
+ catch (error) {
56
+ console.log(error);
57
+ console.log("kakakaka");
58
+ throw new not_found_error_1.NotFoundError();
59
+ }
60
+ if (req.order.userId !== ((_a = req.user) === null || _a === void 0 ? void 0 : _a.toJSON().id) && !req.currentAdminAuth) {
61
+ throw new not_authorized_error_1.NotAuthorizedError();
54
62
  }
55
- }
56
- catch (error) {
57
- throw new not_found_error_1.NotFoundError();
58
- }
59
- if (req.order.userId !== ((_a = req.user) === null || _a === void 0 ? void 0 : _a.toJSON().id) && !req.currentAdminAuth) {
60
- throw new not_authorized_error_1.NotAuthorizedError();
61
63
  }
62
64
  next();
63
65
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.425",
3
+ "version": "1.0.426",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",