@riocrypto/common 1.0.426 → 1.0.427

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.
@@ -11,7 +11,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.getOrder = void 0;
13
13
  const not_authorized_error_1 = require("../errors/not-authorized-error");
14
- const not_found_error_1 = require("../errors/not-found-error");
15
14
  const wrong_processor_error_1 = require("../errors/wrong-processor-error");
16
15
  const order_1 = require("../models/order");
17
16
  const processor_1 = require("../types/processor");
@@ -28,34 +27,26 @@ const getOrder = (req, res, next, mongoose, onlyBankOrders) => __awaiter(void 0,
28
27
  orderId = req.query.orderId;
29
28
  }
30
29
  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
- }
30
+ const Order = yield (0, order_1.buildOrder)(mongoose);
31
+ const order = yield Order.findById(orderId);
32
+ if (!order) {
33
+ throw new Error();
34
+ }
35
+ if (onlyBankOrders) {
36
+ if ([
37
+ processor_1.Processor.Interbank,
38
+ processor_1.Processor.SPEI,
39
+ processor_1.Processor.SWIFT,
40
+ processor_1.Processor.SPID,
41
+ ].includes(order.processor)) {
42
+ req.order = order;
50
43
  }
51
44
  else {
52
- req.order = order;
45
+ throw new wrong_processor_error_1.WrongProcessorError();
53
46
  }
54
47
  }
55
- catch (error) {
56
- console.log(error);
57
- console.log("kakakaka");
58
- throw new not_found_error_1.NotFoundError();
48
+ else {
49
+ req.order = order;
59
50
  }
60
51
  if (req.order.userId !== ((_a = req.user) === null || _a === void 0 ? void 0 : _a.toJSON().id) && !req.currentAdminAuth) {
61
52
  throw new not_authorized_error_1.NotAuthorizedError();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.426",
3
+ "version": "1.0.427",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",