@riocrypto/common-server 1.0.1390 → 1.0.1393

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.
@@ -23,7 +23,7 @@ class InvopopClient {
23
23
  this.baseUrl = "https://api.invopop.com";
24
24
  }
25
25
  createJob(order, user) {
26
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
26
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
27
27
  return __awaiter(this, void 0, void 0, function* () {
28
28
  const uuid = (0, uuid_1.v1)();
29
29
  const operationDate = new Date(order.createdAt);
@@ -60,24 +60,24 @@ class InvopopClient {
60
60
  ],
61
61
  },
62
62
  customer: {
63
- name: ((_a = user.invoicing) === null || _a === void 0 ? void 0 : _a.MX.fiscalName)
64
- ? (_b = user.invoicing) === null || _b === void 0 ? void 0 : _b.MX.fiscalName.toLocaleUpperCase()
63
+ name: ((_b = (_a = user.invoicing) === null || _a === void 0 ? void 0 : _a.MX) === null || _b === void 0 ? void 0 : _b.fiscalName)
64
+ ? (_c = user.invoicing) === null || _c === void 0 ? void 0 : _c.MX.fiscalName.toLocaleUpperCase()
65
65
  : (0, common_1.getUserName)(user),
66
66
  tax_id: {
67
67
  country: "MX",
68
- zone: ((_c = user.invoicing) === null || _c === void 0 ? void 0 : _c.MX.shouldInvoice)
68
+ zone: ((_e = (_d = user.invoicing) === null || _d === void 0 ? void 0 : _d.MX) === null || _e === void 0 ? void 0 : _e.shouldInvoice)
69
69
  ? user.address.postalCode
70
70
  : "66260",
71
- code: ((_e = (_d = user.KYC) === null || _d === void 0 ? void 0 : _d.MX) === null || _e === void 0 ? void 0 : _e.taxId) || "XAXX010101000",
71
+ code: ((_g = (_f = user.KYC) === null || _f === void 0 ? void 0 : _f.MX) === null || _g === void 0 ? void 0 : _g.taxId) || "XAXX010101000",
72
72
  },
73
73
  identities: [
74
74
  {
75
75
  key: "mx-cfdi-fiscal-regime",
76
- code: ((_g = (_f = user.invoicing) === null || _f === void 0 ? void 0 : _f.MX.fiscalRegimenCode) === null || _g === void 0 ? void 0 : _g.toString()) || "616",
76
+ code: ((_k = (_j = (_h = user.invoicing) === null || _h === void 0 ? void 0 : _h.MX) === null || _j === void 0 ? void 0 : _j.fiscalRegimenCode) === null || _k === void 0 ? void 0 : _k.toString()) || "616",
77
77
  },
78
78
  {
79
79
  key: "mx-cfdi-use",
80
- code: ((_h = user.invoicing) === null || _h === void 0 ? void 0 : _h.MX.shouldInvoice) ? "G03" : "S01",
80
+ code: ((_m = (_l = user.invoicing) === null || _l === void 0 ? void 0 : _l.MX) === null || _m === void 0 ? void 0 : _m.shouldInvoice) ? "G03" : "S01",
81
81
  },
82
82
  ],
83
83
  },
@@ -88,7 +88,7 @@ class InvopopClient {
88
88
  item: {
89
89
  name: "Facilitación de Compra-Venta de Activos Virtuales",
90
90
  identities: [{ key: "mx-cfdi-prod-serv", code: "80151500" }],
91
- price: (_j = order.actualFees.platformFeeFiat) === null || _j === void 0 ? void 0 : _j.toFixed(2),
91
+ price: (_o = order.actualFees.platformFeeFiat) === null || _o === void 0 ? void 0 : _o.toFixed(2),
92
92
  },
93
93
  taxes: [
94
94
  {
@@ -1,12 +1,8 @@
1
- import { KYCStatus, PlatformFeeRange, UserAttribute, UserType, CountryOfOrigin, RiskTier } from "@riocrypto/common";
1
+ import { Country, KYCStatus, Language, PlatformFeeRange, USState, UserAttribute, UserType, CountryOfOrigin, RiskTier } from "@riocrypto/common";
2
2
  import { Mongoose, Model, Document } from "mongoose";
3
3
  interface UserAttrs {
4
4
  createdAt: Date;
5
5
  authIds?: string[];
6
- brokerId?: string;
7
- type: UserType;
8
- phoneNumber: string;
9
- email: string;
10
6
  individualData?: {
11
7
  firstName: string;
12
8
  middleName?: string;
@@ -20,18 +16,45 @@ interface UserAttrs {
20
16
  legalRepresentative?: {
21
17
  name: string;
22
18
  status?: string;
19
+ email?: string;
23
20
  };
24
21
  UBO?: {
25
- name: string;
26
22
  id?: string;
23
+ name: string;
27
24
  status?: string;
25
+ email?: string;
28
26
  };
29
27
  };
30
28
  risk: RiskTier;
29
+ type: UserType;
30
+ phoneNumber: string;
31
+ email: string;
32
+ street1: string;
33
+ street2?: string;
34
+ city: string;
35
+ state: USState | string;
36
+ postalCode: string;
37
+ country: CountryOfOrigin;
38
+ kycStatus: KYCStatus;
31
39
  hasPassedEDD: boolean;
40
+ firstName?: string;
41
+ middleName?: string;
42
+ lastName?: string;
43
+ secondLastName?: string;
44
+ companyName?: string;
45
+ birthday?: Date;
32
46
  cosignerGroupId?: string;
47
+ legalRepresentative?: string;
48
+ cpf?: string;
49
+ CPF?: string;
50
+ language?: Language;
33
51
  attributes?: UserAttribute[];
34
- authorizedPhoneNumbers?: string[];
52
+ brokerId?: string;
53
+ curp?: string;
54
+ ruc?: string;
55
+ CURP?: string;
56
+ RUC?: string;
57
+ economicActivity?: string;
35
58
  platformFeeRanges?: {
36
59
  MX?: {
37
60
  buy?: PlatformFeeRange[];
@@ -54,51 +77,22 @@ interface UserAttrs {
54
77
  sell?: PlatformFeeRange[];
55
78
  };
56
79
  };
80
+ COIFile?: string;
81
+ KYCReportFile?: string;
82
+ CSFFile?: string;
83
+ proofOfAddressFile?: string;
84
+ authorizedPhoneNumbers?: string[];
85
+ notificationUrl?: string;
86
+ rfc?: string;
87
+ RFC?: string;
88
+ countriesToInvoice?: Country[];
89
+ mexicoFiscalRegimenCode?: number;
90
+ mexicoFiscalName?: string;
91
+ taxId?: string;
92
+ usKYCStatus?: "none" | "pending" | "failed" | "approved";
57
93
  KYC?: {
58
- MX?: {
59
- status: KYCStatus;
60
- personalId?: string;
61
- taxId: string;
62
- files?: {
63
- certificateOfIncorporation?: string;
64
- kycReport?: string;
65
- taxTranscript?: string;
66
- proofOfAddress?: string;
67
- businessRegistration?: string;
68
- taxIdentificationCertificate?: string;
69
- legalRepresentativeIdPowerOfAttorney?: string;
70
- personalIdentificationCertificate?: string;
71
- extraFiles?: string[];
72
- };
73
- };
74
- PE?: {
75
- status: KYCStatus;
76
- personalId?: string;
77
- taxId?: string;
78
- files?: {
79
- certificateOfIncorporation?: string;
80
- kycReport?: string;
81
- taxTranscript?: string;
82
- proofOfAddress?: string;
83
- businessRegistration?: string;
84
- taxIdentificationCertificate?: string;
85
- legalRepresentativeIdPowerOfAttorney?: string;
86
- personalIdentificationCertificate?: string;
87
- extraFiles?: string[];
88
- };
89
- };
90
- US?: {
91
- status: KYCStatus;
92
- personalId?: string;
93
- taxId?: string;
94
- files?: {
95
- certificateOfIncorporation?: string;
96
- kycReport?: string;
97
- extraFiles?: string[];
98
- };
99
- };
100
- BR?: {
101
- status: KYCStatus;
94
+ [country in CountryOfOrigin]: {
95
+ status?: KYCStatus;
102
96
  personalId?: string;
103
97
  taxId?: string;
104
98
  files?: {
@@ -137,10 +131,6 @@ interface UserDoc extends Document {
137
131
  _id: string;
138
132
  createdAt: Date;
139
133
  authIds?: string[];
140
- brokerId?: string;
141
- type: UserType;
142
- phoneNumber: string;
143
- email: string;
144
134
  individualData?: {
145
135
  firstName: string;
146
136
  middleName?: string;
@@ -153,19 +143,46 @@ interface UserDoc extends Document {
153
143
  businessName: string;
154
144
  legalRepresentative?: {
155
145
  name: string;
146
+ email?: string;
156
147
  status?: string;
157
148
  };
158
149
  UBO?: {
159
- name: string;
160
150
  id?: string;
151
+ name: string;
152
+ email?: string;
161
153
  status?: string;
162
154
  };
163
155
  };
164
156
  risk: RiskTier;
157
+ type: UserType;
158
+ phoneNumber: string;
159
+ email: string;
160
+ street1: string;
161
+ street2?: string;
162
+ city: string;
163
+ state: USState | string;
164
+ postalCode: string;
165
+ country: CountryOfOrigin;
166
+ kycStatus: KYCStatus;
165
167
  hasPassedEDD: boolean;
168
+ firstName?: string;
169
+ middleName?: string;
170
+ lastName?: string;
171
+ secondLastName?: string;
172
+ companyName?: string;
173
+ birthday?: Date;
166
174
  cosignerGroupId?: string;
175
+ legalRepresentative?: string;
176
+ cpf?: string;
177
+ CPF?: string;
178
+ language?: Language;
167
179
  attributes?: UserAttribute[];
168
- authorizedPhoneNumbers?: string[];
180
+ brokerId?: string;
181
+ curp?: string;
182
+ ruc?: string;
183
+ CURP?: string;
184
+ RUC?: string;
185
+ economicActivity?: string;
169
186
  platformFeeRanges?: {
170
187
  MX?: {
171
188
  buy?: PlatformFeeRange[];
@@ -188,51 +205,22 @@ interface UserDoc extends Document {
188
205
  sell?: PlatformFeeRange[];
189
206
  };
190
207
  };
208
+ COIFile?: string;
209
+ KYCReportFile?: string;
210
+ CSFFile?: string;
211
+ proofOfAddressFile?: string;
212
+ 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";
191
221
  KYC?: {
192
- MX?: {
193
- status: KYCStatus;
194
- personalId?: string;
195
- taxId: string;
196
- files?: {
197
- certificateOfIncorporation?: string;
198
- kycReport?: string;
199
- taxTranscript?: string;
200
- proofOfAddress?: string;
201
- businessRegistration?: string;
202
- taxIdentificationCertificate?: string;
203
- legalRepresentativeIdPowerOfAttorney?: string;
204
- personalIdentificationCertificate?: string;
205
- extraFiles?: string[];
206
- };
207
- };
208
- PE?: {
209
- status: KYCStatus;
210
- personalId?: string;
211
- taxId?: string;
212
- files?: {
213
- certificateOfIncorporation?: string;
214
- kycReport?: string;
215
- taxTranscript?: string;
216
- proofOfAddress?: string;
217
- businessRegistration?: string;
218
- taxIdentificationCertificate?: string;
219
- legalRepresentativeIdPowerOfAttorney?: string;
220
- personalIdentificationCertificate?: string;
221
- extraFiles?: string[];
222
- };
223
- };
224
- US?: {
225
- status: KYCStatus;
226
- personalId?: string;
227
- taxId?: string;
228
- files?: {
229
- certificateOfIncorporation?: string;
230
- kycReport?: string;
231
- extraFiles?: string[];
232
- };
233
- };
234
- BR?: {
235
- status: KYCStatus;
222
+ [country in CountryOfOrigin]: {
223
+ status?: KYCStatus;
236
224
  personalId?: string;
237
225
  taxId?: string;
238
226
  files?: {
@@ -110,14 +110,6 @@ const buildUser = (mongoose) => {
110
110
  type: String,
111
111
  required: true,
112
112
  },
113
- status: {
114
- local: {
115
- type: String,
116
- },
117
- US: {
118
- type: String,
119
- },
120
- },
121
113
  brokerId: {
122
114
  type: String,
123
115
  },
@@ -316,33 +308,6 @@ const buildUser = (mongoose) => {
316
308
  type: String,
317
309
  },
318
310
  ],
319
- notificationUrl: {
320
- type: String,
321
- },
322
- rfc: {
323
- type: String,
324
- },
325
- ruc: {
326
- type: String,
327
- },
328
- RFC: {
329
- type: String,
330
- },
331
- RUC: {
332
- type: String,
333
- },
334
- mexicoFiscalRegimenCode: {
335
- type: Number,
336
- },
337
- mexicoFiscalName: {
338
- type: String,
339
- },
340
- taxId: {
341
- type: String,
342
- },
343
- usKYCStatus: {
344
- type: String,
345
- },
346
311
  address: {
347
312
  street1: {
348
313
  type: String,
@@ -368,162 +333,7 @@ const buildUser = (mongoose) => {
368
333
  required: true,
369
334
  },
370
335
  },
371
- KYC: {
372
- MX: {
373
- status: {
374
- type: String,
375
- required: true,
376
- },
377
- personalId: {
378
- type: String,
379
- },
380
- taxId: {
381
- type: String,
382
- },
383
- files: {
384
- certificateOfIncorporation: {
385
- type: String,
386
- },
387
- kycReport: {
388
- type: String,
389
- },
390
- taxTranscript: {
391
- type: String,
392
- },
393
- proofOfAddress: {
394
- type: String,
395
- },
396
- businessRegistration: {
397
- type: String,
398
- },
399
- taxIdentificationCertificate: {
400
- type: String,
401
- },
402
- legalRepresentativeIdPowerOfAttorney: {
403
- type: String,
404
- },
405
- personalIdentificationCertificate: {
406
- type: String,
407
- },
408
- extraFiles: [
409
- {
410
- type: String,
411
- },
412
- ],
413
- },
414
- },
415
- PE: {
416
- status: {
417
- type: String,
418
- required: true,
419
- },
420
- personalId: {
421
- type: String,
422
- },
423
- taxId: {
424
- type: String,
425
- },
426
- files: {
427
- certificateOfIncorporation: {
428
- type: String,
429
- },
430
- kycReport: {
431
- type: String,
432
- },
433
- taxTranscript: {
434
- type: String,
435
- },
436
- proofOfAddress: {
437
- type: String,
438
- },
439
- businessRegistration: {
440
- type: String,
441
- },
442
- taxIdentificationCertificate: {
443
- type: String,
444
- },
445
- legalRepresentativeIdPowerOfAttorney: {
446
- type: String,
447
- },
448
- personalIdentificationCertificate: {
449
- type: String,
450
- },
451
- extraFiles: [
452
- {
453
- type: String,
454
- },
455
- ],
456
- },
457
- },
458
- US: {
459
- status: {
460
- type: String,
461
- required: true,
462
- },
463
- personalId: {
464
- type: String,
465
- },
466
- taxId: {
467
- type: String,
468
- },
469
- files: {
470
- certificateOfIncorporation: {
471
- type: String,
472
- },
473
- kycReport: {
474
- type: String,
475
- },
476
- extraFiles: [
477
- {
478
- type: String,
479
- },
480
- ],
481
- },
482
- },
483
- BR: {
484
- status: {
485
- type: String,
486
- required: true,
487
- },
488
- personalId: {
489
- type: String,
490
- },
491
- taxId: {
492
- type: String,
493
- },
494
- files: {
495
- certificateOfIncorporation: {
496
- type: String,
497
- },
498
- kycReport: {
499
- type: String,
500
- },
501
- taxTranscript: {
502
- type: String,
503
- },
504
- proofOfAddress: {
505
- type: String,
506
- },
507
- businessRegistration: {
508
- type: String,
509
- },
510
- taxIdentificationCertificate: {
511
- type: String,
512
- },
513
- legalRepresentativeIdPowerOfAttorney: {
514
- type: String,
515
- },
516
- personalIdentificationCertificate: {
517
- type: String,
518
- },
519
- extraFiles: [
520
- {
521
- type: String,
522
- },
523
- ],
524
- },
525
- },
526
- },
336
+ KYC: Object,
527
337
  invoicing: {
528
338
  MX: {
529
339
  shouldInvoice: {
@@ -545,6 +355,9 @@ const buildUser = (mongoose) => {
545
355
  name: {
546
356
  type: String,
547
357
  },
358
+ email: {
359
+ type: String,
360
+ },
548
361
  status: {
549
362
  type: String,
550
363
  },
@@ -553,6 +366,9 @@ const buildUser = (mongoose) => {
553
366
  name: {
554
367
  type: String,
555
368
  },
369
+ email: {
370
+ type: String,
371
+ },
556
372
  id: {
557
373
  type: String,
558
374
  },
@@ -581,6 +397,33 @@ const buildUser = (mongoose) => {
581
397
  type: String,
582
398
  },
583
399
  },
400
+ notificationUrl: {
401
+ type: String,
402
+ },
403
+ rfc: {
404
+ type: String,
405
+ },
406
+ ruc: {
407
+ type: String,
408
+ },
409
+ RFC: {
410
+ type: String,
411
+ },
412
+ RUC: {
413
+ type: String,
414
+ },
415
+ mexicoFiscalRegimenCode: {
416
+ type: Number,
417
+ },
418
+ mexicoFiscalName: {
419
+ type: String,
420
+ },
421
+ taxId: {
422
+ type: String,
423
+ },
424
+ usKYCStatus: {
425
+ type: String,
426
+ },
584
427
  }, {
585
428
  toJSON: {
586
429
  transform(doc, ret) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1390",
3
+ "version": "1.0.1393",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -27,7 +27,7 @@
27
27
  "@everapi/currencyapi-js": "^1.0.6",
28
28
  "@google-cloud/storage": "^6.9.5",
29
29
  "@google-cloud/vision": "^4.0.2",
30
- "@riocrypto/common": "^1.0.1213",
30
+ "@riocrypto/common": "^1.0.1214",
31
31
  "@types/express": "^4.17.13",
32
32
  "axios": "^0.27.2",
33
33
  "ccxt": "^3.0.30",