@riocrypto/common 1.0.423 → 1.0.425
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.
|
@@ -26,7 +26,7 @@ const missing_password_error_1 = require("../errors/missing-password-error");
|
|
|
26
26
|
const missing_security_question_error_1 = require("../errors/missing-security-question-error");
|
|
27
27
|
const admin_only_error_1 = require("../errors/admin-only-error");
|
|
28
28
|
const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
29
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
30
30
|
let missingKYC = false;
|
|
31
31
|
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Auth) ||
|
|
32
32
|
authorizationTypes.includes(authorization_type_1.AuthorizationType.UserNoKYC) ||
|
|
@@ -138,7 +138,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
138
138
|
}
|
|
139
139
|
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Admin) &&
|
|
140
140
|
authorizationTypes.length === 1 &&
|
|
141
|
-
req.
|
|
141
|
+
((_h = req.cookies) === null || _h === void 0 ? void 0 : _h.jwt)) {
|
|
142
142
|
throw new admin_only_error_1.AdminOnlyError();
|
|
143
143
|
}
|
|
144
144
|
throw new not_authorized_error_1.NotAuthorizedError();
|
|
@@ -8,4 +8,4 @@ declare global {
|
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
-
export declare const getOrder: (req: Request, res: Response, next: NextFunction, mongoose: Mongoose) => Promise<void>;
|
|
11
|
+
export declare const getOrder: (req: Request, res: Response, next: NextFunction, mongoose: Mongoose, onlyBankOrders?: boolean) => Promise<void>;
|
|
@@ -12,8 +12,10 @@ 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
14
|
const not_found_error_1 = require("../errors/not-found-error");
|
|
15
|
+
const wrong_processor_error_1 = require("../errors/wrong-processor-error");
|
|
15
16
|
const order_1 = require("../models/order");
|
|
16
|
-
const
|
|
17
|
+
const processor_1 = require("../types/processor");
|
|
18
|
+
const getOrder = (req, res, next, mongoose, onlyBankOrders) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
19
|
var _a;
|
|
18
20
|
let orderId = "";
|
|
19
21
|
if (req.body.orderId) {
|
|
@@ -34,7 +36,22 @@ const getOrder = (req, res, next, mongoose) => __awaiter(void 0, void 0, void 0,
|
|
|
34
36
|
if (!order) {
|
|
35
37
|
throw new Error();
|
|
36
38
|
}
|
|
37
|
-
|
|
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;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
throw new wrong_processor_error_1.WrongProcessorError();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
req.order = order;
|
|
54
|
+
}
|
|
38
55
|
}
|
|
39
56
|
catch (error) {
|
|
40
57
|
throw new not_found_error_1.NotFoundError();
|