@riocrypto/common-server 1.0.2364 → 1.0.2367

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.
@@ -27,9 +27,7 @@ class CoincoverClient {
27
27
  return address;
28
28
  };
29
29
  this.getResidenceCountry = (user) => {
30
- var _a, _b;
31
- const highestOnboardingCountry = (0, common_1.getHighestOnboardingStatus)(user).country;
32
- return (_b = (_a = user.onboarding[highestOnboardingCountry]) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b.country;
30
+ return user.address.country;
33
31
  };
34
32
  if ([common_1.RioEnv.Development, common_1.RioEnv.Production].includes(process.env.RIO_ENV)) {
35
33
  this.baseUrl = "https://api.txm.coincover.com";
@@ -3,19 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getTaxRate = void 0;
4
4
  const common_1 = require("@riocrypto/common");
5
5
  const getTaxRate = (user, country, fiat, processor) => {
6
- var _a, _b, _c, _d;
6
+ var _a, _b;
7
7
  let taxRate = 0;
8
8
  if ((fiat === common_1.Fiat.MXN && processor === common_1.Processor.SPEI) ||
9
9
  (fiat === common_1.Fiat.MXN && processor === common_1.Processor.SPEI_NVIO) ||
10
10
  (fiat === common_1.Fiat.MXN && processor === common_1.Processor.SPEI_STP) ||
11
11
  (fiat === common_1.Fiat.USD && processor === common_1.Processor.SPID)) {
12
12
  if (country === common_1.Country.Mexico &&
13
- ((_b = (_a = user === null || user === void 0 ? void 0 : user.onboarding[country]) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b.country) === common_1.CountryOfOrigin.Mexico) {
13
+ ((_a = user === null || user === void 0 ? void 0 : user.address) === null || _a === void 0 ? void 0 : _a.country) === common_1.CountryOfOrigin.Mexico) {
14
14
  taxRate = 0.16;
15
15
  }
16
16
  }
17
17
  if (fiat === common_1.Fiat.PEN && processor === common_1.Processor.Interbank) {
18
- if (((_d = (_c = user === null || user === void 0 ? void 0 : user.onboarding[country]) === null || _c === void 0 ? void 0 : _c.address) === null || _d === void 0 ? void 0 : _d.country) === common_1.CountryOfOrigin.Peru) {
18
+ if (((_b = user === null || user === void 0 ? void 0 : user.address) === null || _b === void 0 ? void 0 : _b.country) === common_1.CountryOfOrigin.Peru) {
19
19
  taxRate = 0.18;
20
20
  }
21
21
  }
@@ -78,14 +78,14 @@ interface UserAttrs {
78
78
  aipriseUserVerificationSessionUrl?: string;
79
79
  status: OnboardingStatus;
80
80
  hasAcceptedTerms: boolean;
81
- address?: {
82
- street1?: string;
83
- street2?: string;
84
- city?: string;
85
- state?: string;
86
- postalCode?: string;
87
- country?: CountryOfOrigin;
88
- };
81
+ };
82
+ address: {
83
+ street1?: string;
84
+ street2?: string;
85
+ city?: string;
86
+ state?: string;
87
+ postalCode?: string;
88
+ country?: CountryOfOrigin;
89
89
  };
90
90
  invoicing?: {
91
91
  MX: {
@@ -191,14 +191,14 @@ interface UserDoc extends Document {
191
191
  aipriseUserVerificationSessionUrl?: string;
192
192
  status: OnboardingStatus;
193
193
  hasAcceptedTerms: boolean;
194
- address?: {
195
- street1?: string;
196
- street2?: string;
197
- city?: string;
198
- state?: string;
199
- postalCode?: string;
200
- country?: CountryOfOrigin;
201
- };
194
+ };
195
+ address: {
196
+ street1?: string;
197
+ street2?: string;
198
+ city?: string;
199
+ state?: string;
200
+ postalCode?: string;
201
+ country?: CountryOfOrigin;
202
202
  };
203
203
  invoicing?: {
204
204
  MX: {
@@ -48,6 +48,9 @@ const buildUser = (mongoose) => {
48
48
  type: String,
49
49
  },
50
50
  ],
51
+ address: {
52
+ type: Object,
53
+ },
51
54
  brokerId: {
52
55
  type: String,
53
56
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.2364",
3
+ "version": "1.0.2367",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@google-cloud/secret-manager": "^5.3.0",
29
29
  "@google-cloud/storage": "^6.9.5",
30
30
  "@hyperdx/node-opentelemetry": "^0.7.0",
31
- "@riocrypto/common": "^1.0.2082",
31
+ "@riocrypto/common": "^1.0.2089",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.7.4",
34
34
  "crypto-js": "^4.2.0",