@riocrypto/common-server 1.0.1517 → 1.0.1521
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.
package/build/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export * from "./middlewares/require-min-admin-role";
|
|
|
9
9
|
export * from "./services/apiKey";
|
|
10
10
|
export * from "./services/password";
|
|
11
11
|
export * from "./services/logger";
|
|
12
|
+
export * from "./validators/require-admin-auth";
|
|
12
13
|
export * from "./models/admin-auth";
|
|
13
14
|
export * from "./models/auth";
|
|
14
15
|
export * from "./models/bank-payout";
|
package/build/index.js
CHANGED
|
@@ -25,6 +25,7 @@ __exportStar(require("./middlewares/require-min-admin-role"), exports);
|
|
|
25
25
|
__exportStar(require("./services/apiKey"), exports);
|
|
26
26
|
__exportStar(require("./services/password"), exports);
|
|
27
27
|
__exportStar(require("./services/logger"), exports);
|
|
28
|
+
__exportStar(require("./validators/require-admin-auth"), exports);
|
|
28
29
|
__exportStar(require("./models/admin-auth"), exports);
|
|
29
30
|
__exportStar(require("./models/auth"), exports);
|
|
30
31
|
__exportStar(require("./models/bank-payout"), exports);
|
package/build/models/user.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OnboardingStatus, PlatformFeeRange, UserAttribute, UserType, CountryOfOrigin, RiskTier, ImmigrationStatus } from "@riocrypto/common";
|
|
2
2
|
import { Mongoose, Model, Document } from "mongoose";
|
|
3
3
|
interface UserAttrs {
|
|
4
4
|
createdAt: Date;
|
|
@@ -9,7 +9,6 @@ interface UserAttrs {
|
|
|
9
9
|
lastName: string;
|
|
10
10
|
secondLastName?: string;
|
|
11
11
|
birthday: Date;
|
|
12
|
-
countryOfOrigin: CountryOfOrigin;
|
|
13
12
|
};
|
|
14
13
|
businessData?: {
|
|
15
14
|
businessName: string;
|
|
@@ -22,32 +21,10 @@ interface UserAttrs {
|
|
|
22
21
|
type: UserType;
|
|
23
22
|
phoneNumber: string;
|
|
24
23
|
email: string;
|
|
25
|
-
street1: string;
|
|
26
|
-
street2?: string;
|
|
27
|
-
city: string;
|
|
28
|
-
state: USState | string;
|
|
29
|
-
postalCode: string;
|
|
30
|
-
country: CountryOfOrigin;
|
|
31
|
-
kycStatus: OnboardingStatus;
|
|
32
24
|
hasPassedEDD: boolean;
|
|
33
|
-
firstName?: string;
|
|
34
|
-
middleName?: string;
|
|
35
|
-
lastName?: string;
|
|
36
|
-
secondLastName?: string;
|
|
37
|
-
companyName?: string;
|
|
38
|
-
birthday?: Date;
|
|
39
25
|
cosignerGroupId?: string;
|
|
40
|
-
legalRepresentative?: string;
|
|
41
|
-
cpf?: string;
|
|
42
|
-
CPF?: string;
|
|
43
|
-
language?: Language;
|
|
44
26
|
attributes?: UserAttribute[];
|
|
45
27
|
brokerId?: string;
|
|
46
|
-
curp?: string;
|
|
47
|
-
ruc?: string;
|
|
48
|
-
CURP?: string;
|
|
49
|
-
RUC?: string;
|
|
50
|
-
economicActivity?: string;
|
|
51
28
|
platformFeeRanges?: {
|
|
52
29
|
MX?: {
|
|
53
30
|
buy?: PlatformFeeRange[];
|
|
@@ -70,19 +47,7 @@ interface UserAttrs {
|
|
|
70
47
|
sell?: PlatformFeeRange[];
|
|
71
48
|
};
|
|
72
49
|
};
|
|
73
|
-
COIFile?: string;
|
|
74
|
-
KYCReportFile?: string;
|
|
75
|
-
CSFFile?: string;
|
|
76
|
-
proofOfAddressFile?: string;
|
|
77
50
|
authorizedPhoneNumbers?: string[];
|
|
78
|
-
notificationUrl?: string;
|
|
79
|
-
rfc?: string;
|
|
80
|
-
RFC?: string;
|
|
81
|
-
countriesToInvoice?: Country[];
|
|
82
|
-
mexicoFiscalRegimenCode?: number;
|
|
83
|
-
mexicoFiscalName?: string;
|
|
84
|
-
taxId?: string;
|
|
85
|
-
usKYCStatus?: "none" | "pending" | "failed" | "approved";
|
|
86
51
|
onboarding?: {
|
|
87
52
|
[country in CountryOfOrigin]?: {
|
|
88
53
|
status?: OnboardingStatus;
|
|
@@ -144,7 +109,6 @@ interface UserDoc extends Document {
|
|
|
144
109
|
lastName: string;
|
|
145
110
|
secondLastName?: string;
|
|
146
111
|
birthday: Date;
|
|
147
|
-
countryOfOrigin: CountryOfOrigin;
|
|
148
112
|
};
|
|
149
113
|
businessData?: {
|
|
150
114
|
businessName: string;
|
|
@@ -157,32 +121,10 @@ interface UserDoc extends Document {
|
|
|
157
121
|
type: UserType;
|
|
158
122
|
phoneNumber: string;
|
|
159
123
|
email: string;
|
|
160
|
-
street1: string;
|
|
161
|
-
street2?: string;
|
|
162
|
-
city: string;
|
|
163
|
-
state: USState | string;
|
|
164
|
-
postalCode: string;
|
|
165
|
-
country: CountryOfOrigin;
|
|
166
|
-
kycStatus: OnboardingStatus;
|
|
167
124
|
hasPassedEDD: boolean;
|
|
168
|
-
firstName?: string;
|
|
169
|
-
middleName?: string;
|
|
170
|
-
lastName?: string;
|
|
171
|
-
secondLastName?: string;
|
|
172
|
-
companyName?: string;
|
|
173
|
-
birthday?: Date;
|
|
174
125
|
cosignerGroupId?: string;
|
|
175
|
-
legalRepresentative?: string;
|
|
176
|
-
cpf?: string;
|
|
177
|
-
CPF?: string;
|
|
178
|
-
language?: Language;
|
|
179
126
|
attributes?: UserAttribute[];
|
|
180
127
|
brokerId?: string;
|
|
181
|
-
curp?: string;
|
|
182
|
-
ruc?: string;
|
|
183
|
-
CURP?: string;
|
|
184
|
-
RUC?: string;
|
|
185
|
-
economicActivity?: string;
|
|
186
128
|
platformFeeRanges?: {
|
|
187
129
|
MX?: {
|
|
188
130
|
buy?: PlatformFeeRange[];
|
|
@@ -205,26 +147,14 @@ interface UserDoc extends Document {
|
|
|
205
147
|
sell?: PlatformFeeRange[];
|
|
206
148
|
};
|
|
207
149
|
};
|
|
208
|
-
COIFile?: string;
|
|
209
|
-
KYCReportFile?: string;
|
|
210
|
-
CSFFile?: string;
|
|
211
|
-
proofOfAddressFile?: string;
|
|
212
150
|
authorizedPhoneNumbers?: string[];
|
|
213
|
-
notificationUrl?: string;
|
|
214
|
-
rfc?: string;
|
|
215
|
-
RFC?: string;
|
|
216
|
-
countriesToInvoice?: Country[];
|
|
217
|
-
mexicoFiscalRegimenCode?: number;
|
|
218
|
-
mexicoFiscalName?: string;
|
|
219
|
-
taxId?: string;
|
|
220
|
-
usKYCStatus?: "none" | "pending" | "failed" | "approved";
|
|
221
151
|
onboarding?: {
|
|
222
152
|
[country in CountryOfOrigin]?: {
|
|
223
153
|
status?: OnboardingStatus;
|
|
224
154
|
personalId?: string;
|
|
225
155
|
taxId?: string;
|
|
226
|
-
immigrationStatus?: ImmigrationStatus;
|
|
227
156
|
hasAcceptedTerms?: boolean;
|
|
157
|
+
immigrationStatus?: ImmigrationStatus;
|
|
228
158
|
individualIdentityVerification?: {
|
|
229
159
|
status?: "passed" | "failed" | "review";
|
|
230
160
|
};
|
package/build/models/user.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildUser = void 0;
|
|
4
|
-
const unescape_1 = require("../helpers/unescape");
|
|
5
4
|
const buildUser = (mongoose) => {
|
|
6
5
|
// if model is already defined, return it
|
|
7
6
|
if (mongoose.models.User) {
|
|
@@ -21,25 +20,10 @@ const buildUser = (mongoose) => {
|
|
|
21
20
|
type: String,
|
|
22
21
|
required: true,
|
|
23
22
|
},
|
|
24
|
-
firstName: {
|
|
25
|
-
type: String,
|
|
26
|
-
},
|
|
27
|
-
middleName: {
|
|
28
|
-
type: String,
|
|
29
|
-
},
|
|
30
|
-
lastName: {
|
|
31
|
-
type: String,
|
|
32
|
-
},
|
|
33
|
-
secondLastName: {
|
|
34
|
-
type: String,
|
|
35
|
-
},
|
|
36
23
|
phoneNumber: {
|
|
37
24
|
type: String,
|
|
38
25
|
required: true,
|
|
39
26
|
},
|
|
40
|
-
birthday: {
|
|
41
|
-
type: Date,
|
|
42
|
-
},
|
|
43
27
|
email: {
|
|
44
28
|
type: String,
|
|
45
29
|
required: true,
|
|
@@ -47,24 +31,6 @@ const buildUser = (mongoose) => {
|
|
|
47
31
|
cosignerGroupId: {
|
|
48
32
|
type: String,
|
|
49
33
|
},
|
|
50
|
-
street1: {
|
|
51
|
-
type: String,
|
|
52
|
-
},
|
|
53
|
-
street2: {
|
|
54
|
-
type: String,
|
|
55
|
-
},
|
|
56
|
-
city: {
|
|
57
|
-
type: String,
|
|
58
|
-
},
|
|
59
|
-
state: {
|
|
60
|
-
type: String,
|
|
61
|
-
},
|
|
62
|
-
postalCode: {
|
|
63
|
-
type: String,
|
|
64
|
-
},
|
|
65
|
-
country: {
|
|
66
|
-
type: String,
|
|
67
|
-
},
|
|
68
34
|
risk: {
|
|
69
35
|
type: String,
|
|
70
36
|
required: true,
|
|
@@ -73,58 +39,14 @@ const buildUser = (mongoose) => {
|
|
|
73
39
|
type: Boolean,
|
|
74
40
|
required: true,
|
|
75
41
|
},
|
|
76
|
-
language: {
|
|
77
|
-
type: String,
|
|
78
|
-
},
|
|
79
|
-
cpf: {
|
|
80
|
-
type: String,
|
|
81
|
-
},
|
|
82
|
-
curp: {
|
|
83
|
-
type: String,
|
|
84
|
-
},
|
|
85
|
-
CPF: {
|
|
86
|
-
type: String,
|
|
87
|
-
},
|
|
88
|
-
CURP: {
|
|
89
|
-
type: String,
|
|
90
|
-
},
|
|
91
|
-
economicActivity: {
|
|
92
|
-
type: String,
|
|
93
|
-
},
|
|
94
42
|
attributes: [
|
|
95
43
|
{
|
|
96
44
|
type: String,
|
|
97
45
|
},
|
|
98
46
|
],
|
|
99
|
-
countriesToInvoice: [
|
|
100
|
-
{
|
|
101
|
-
type: String,
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
kycStatus: {
|
|
105
|
-
type: String,
|
|
106
|
-
},
|
|
107
47
|
brokerId: {
|
|
108
48
|
type: String,
|
|
109
49
|
},
|
|
110
|
-
companyName: {
|
|
111
|
-
type: String,
|
|
112
|
-
},
|
|
113
|
-
legalRepresentative: {
|
|
114
|
-
type: String,
|
|
115
|
-
},
|
|
116
|
-
COIFile: {
|
|
117
|
-
type: String,
|
|
118
|
-
},
|
|
119
|
-
KYCReportFile: {
|
|
120
|
-
type: String,
|
|
121
|
-
},
|
|
122
|
-
CSFFile: {
|
|
123
|
-
type: String,
|
|
124
|
-
},
|
|
125
|
-
proofOfAddressFile: {
|
|
126
|
-
type: String,
|
|
127
|
-
},
|
|
128
50
|
quotationTime: {
|
|
129
51
|
type: Number,
|
|
130
52
|
},
|
|
@@ -338,36 +260,6 @@ const buildUser = (mongoose) => {
|
|
|
338
260
|
birthday: {
|
|
339
261
|
type: Date,
|
|
340
262
|
},
|
|
341
|
-
countryOfOrigin: {
|
|
342
|
-
type: String,
|
|
343
|
-
},
|
|
344
|
-
},
|
|
345
|
-
notificationUrl: {
|
|
346
|
-
type: String,
|
|
347
|
-
},
|
|
348
|
-
rfc: {
|
|
349
|
-
type: String,
|
|
350
|
-
},
|
|
351
|
-
ruc: {
|
|
352
|
-
type: String,
|
|
353
|
-
},
|
|
354
|
-
RFC: {
|
|
355
|
-
type: String,
|
|
356
|
-
},
|
|
357
|
-
RUC: {
|
|
358
|
-
type: String,
|
|
359
|
-
},
|
|
360
|
-
mexicoFiscalRegimenCode: {
|
|
361
|
-
type: Number,
|
|
362
|
-
},
|
|
363
|
-
mexicoFiscalName: {
|
|
364
|
-
type: String,
|
|
365
|
-
},
|
|
366
|
-
taxId: {
|
|
367
|
-
type: String,
|
|
368
|
-
},
|
|
369
|
-
usKYCStatus: {
|
|
370
|
-
type: String,
|
|
371
263
|
},
|
|
372
264
|
}, {
|
|
373
265
|
toJSON: {
|
|
@@ -375,26 +267,6 @@ const buildUser = (mongoose) => {
|
|
|
375
267
|
ret.id = ret._id.valueOf();
|
|
376
268
|
delete ret._id;
|
|
377
269
|
delete ret.__v;
|
|
378
|
-
ret.street1 = ret.street1 ? (0, unescape_1.unescape)(ret.street1) : undefined;
|
|
379
|
-
ret.street2 = ret.street2 ? (0, unescape_1.unescape)(ret.street2) : undefined;
|
|
380
|
-
ret.state = ret.state ? (0, unescape_1.unescape)(ret.state) : undefined;
|
|
381
|
-
ret.firstName = ret.firstName ? (0, unescape_1.unescape)(ret.firstName) : undefined;
|
|
382
|
-
ret.middleName = ret.middleName
|
|
383
|
-
? (0, unescape_1.unescape)(ret.middleName)
|
|
384
|
-
: undefined;
|
|
385
|
-
ret.lastName = ret.lastName ? (0, unescape_1.unescape)(ret.lastName) : undefined;
|
|
386
|
-
ret.secondLastName = ret.secondLastName
|
|
387
|
-
? (0, unescape_1.unescape)(ret.secondLastName)
|
|
388
|
-
: undefined;
|
|
389
|
-
ret.economicActivity = ret.economicActivity
|
|
390
|
-
? (0, unescape_1.unescape)(ret.economicActivity)
|
|
391
|
-
: undefined;
|
|
392
|
-
ret.legalRepresentative = ret.legalRepresentative
|
|
393
|
-
? (0, unescape_1.unescape)(ret.legalRepresentative)
|
|
394
|
-
: undefined;
|
|
395
|
-
ret.companyName = ret.companyName
|
|
396
|
-
? (0, unescape_1.unescape)(ret.companyName)
|
|
397
|
-
: undefined;
|
|
398
270
|
},
|
|
399
271
|
},
|
|
400
272
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const common_1 = require("@riocrypto/common");
|
|
4
|
+
const requireAdminAuth = (value, { req, path }) => {
|
|
5
|
+
if (value !== undefined && !req.adminAuth) {
|
|
6
|
+
throw new common_1.AdminOnlyError();
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1521",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@google-cloud/storage": "^6.9.5",
|
|
29
29
|
"@google-cloud/vision": "^4.0.2",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.4.2",
|
|
31
|
-
"@riocrypto/common": "^1.0.
|
|
31
|
+
"@riocrypto/common": "^1.0.1362",
|
|
32
32
|
"@types/express": "^4.17.13",
|
|
33
33
|
"axios": "^0.27.2",
|
|
34
34
|
"ccxt": "^3.0.30",
|