@riocrypto/common-server 1.0.1562 → 1.0.1564

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.
@@ -32,12 +32,7 @@ const getExchangeRates = (mongoose, fiat) => __awaiter(void 0, void 0, void 0, f
32
32
  let conversionRateFromUSDWithMarkups = conversionRateFromUSD;
33
33
  // Time based markups
34
34
  if (fiat === common_1.Fiat.PEN) {
35
- const now = new Date();
36
- const peruTime = new Date(now.toLocaleString("en-US", { timeZone: "America/Lima" }));
37
- const hours = peruTime.getHours();
38
- const minutes = peruTime.getMinutes();
39
- // Check if it's between 2:10 PM and 12:00 AM
40
- if ((hours === 14 && minutes >= 10) || hours > 14 || hours === 0) {
35
+ if (rioSettings.isAfterHours[common_1.Country.Peru]) {
41
36
  conversionRateToUSDWithMarkups =
42
37
  conversionRateToUSD *
43
38
  (1 - afterHoursExchangeRateMarkup - generalExchangeRateMarkup);
@@ -47,21 +42,7 @@ const getExchangeRates = (mongoose, fiat) => __awaiter(void 0, void 0, void 0, f
47
42
  }
48
43
  }
49
44
  if (fiat === common_1.Fiat.MXN) {
50
- const now = new Date();
51
- const mexicoCityTime = new Date(now.toLocaleString("en-US", { timeZone: "America/Mexico_City" }));
52
- const hours = mexicoCityTime.getHours();
53
- const minutes = mexicoCityTime.getMinutes();
54
- let isAfterHours = false;
55
- if (hours >= 8 && hours < 16 && !(hours === 15 && minutes > 45)) {
56
- isAfterHours = false;
57
- }
58
- else {
59
- isAfterHours = true;
60
- }
61
- if (mexicoCityTime.getDay() === 0 || mexicoCityTime.getDay() === 6) {
62
- isAfterHours = true;
63
- }
64
- if (isAfterHours) {
45
+ if (rioSettings.isAfterHours[common_1.Country.Mexico]) {
65
46
  conversionRateToUSDWithMarkups =
66
47
  conversionRateToUSD *
67
48
  (1 - afterHoursExchangeRateMarkup - generalExchangeRateMarkup);
@@ -2,7 +2,10 @@ import mongoose from "mongoose";
2
2
  interface RioSettingsAttrs {
3
3
  platformFee: number;
4
4
  isAfterHours: {
5
- [key: string]: boolean;
5
+ [key: string]: {
6
+ value: boolean;
7
+ frozen: boolean;
8
+ };
6
9
  };
7
10
  afterHoursExchangeRateMarkup: number;
8
11
  generalExchangeRateMarkup: number;
@@ -13,7 +16,10 @@ interface RioSettingsAttrs {
13
16
  interface RioSettingsDoc extends mongoose.Document {
14
17
  platformFee: number;
15
18
  isAfterHours: {
16
- [key: string]: boolean;
19
+ [key: string]: {
20
+ value: boolean;
21
+ frozen: boolean;
22
+ };
17
23
  };
18
24
  afterHoursExchangeRateMarkup: number;
19
25
  generalExchangeRateMarkup: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common-server",
3
- "version": "1.0.1562",
3
+ "version": "1.0.1564",
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.1398",
31
+ "@riocrypto/common": "^1.0.1401",
32
32
  "@types/express": "^4.17.13",
33
33
  "axios": "^1.6.0",
34
34
  "ccxt": "^3.0.30",