@riocrypto/common 1.0.401 → 1.0.403

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.
@@ -96,6 +96,9 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
96
96
  phoneNumber: req.currentAuth.phoneNumber,
97
97
  attributes: { $ne: user_attribute_1.UserAttribute.deleted },
98
98
  });
99
+ if (!individualUser) {
100
+ throw new Error();
101
+ }
99
102
  if ((individualUser === null || individualUser === void 0 ? void 0 : individualUser.kycStatus) !== kyc_status_1.KYCStatus.Passed) {
100
103
  missingKYC = true;
101
104
  throw new Error();
@@ -110,6 +113,9 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
110
113
  phoneNumber: req.currentAuth.phoneNumber,
111
114
  attributes: { $ne: user_attribute_1.UserAttribute.deleted },
112
115
  });
116
+ if (!businessUser) {
117
+ throw new Error();
118
+ }
113
119
  if ((businessUser === null || businessUser === void 0 ? void 0 : businessUser.kycStatus) !== kyc_status_1.KYCStatus.businessApproved) {
114
120
  missingKYC = true;
115
121
  throw new Error();
@@ -123,7 +129,8 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
123
129
  req.user = user;
124
130
  }
125
131
  }
126
- if (!req.currentAdminAuth && !req.currentAuth && !req.user) {
132
+ if ((!req.currentAdminAuth && !req.currentAuth && !req.user) ||
133
+ (req.currentAuth && !authorizationTypes.includes(authorization_type_1.AuthorizationType.Auth))) {
127
134
  if (missingKYC) {
128
135
  throw new missing_kyc_approval_error_1.MissingKYCApprovalError();
129
136
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.401",
3
+ "version": "1.0.403",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",