@riocrypto/common-server 1.0.1030 → 1.0.1031
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.
|
@@ -47,7 +47,7 @@ class InvopopClient {
|
|
|
47
47
|
},
|
|
48
48
|
customer: {
|
|
49
49
|
name: user.mexicoFiscalName
|
|
50
|
-
? user.mexicoFiscalName
|
|
50
|
+
? user.mexicoFiscalName.toLocaleUpperCase()
|
|
51
51
|
: user.type === common_1.UserType.Business
|
|
52
52
|
? user.companyName.toLocaleUpperCase()
|
|
53
53
|
: `${user.firstName.toLocaleUpperCase()} ${user.lastName.toLocaleUpperCase()}`,
|
|
@@ -45,16 +45,33 @@ const getExchangeRates = (from, to, volatilitySafeguard) => __awaiter(void 0, vo
|
|
|
45
45
|
}
|
|
46
46
|
if (from === common_1.Fiat.PEN || to === common_1.Fiat.PEN) {
|
|
47
47
|
const now = new Date();
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
if
|
|
48
|
+
const peruTime = new Date(now.toLocaleString("en-US", { timeZone: "America/Lima" }));
|
|
49
|
+
const hours = peruTime.getHours();
|
|
50
|
+
const minutes = peruTime.getMinutes();
|
|
51
|
+
// Check if it's between 2:10 PM and 12:00 AM
|
|
52
|
+
if ((hours === 14 && minutes >= 10) || hours > 14 || hours === 0) {
|
|
52
53
|
exchangeRateMultiplier = 0.997;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
if (from === common_1.Fiat.USD) {
|
|
56
57
|
exchangeRateMultiplier = 0.999;
|
|
57
58
|
}
|
|
59
|
+
if ((from === common_1.Fiat.MXN && to === common_1.Fiat.USD) ||
|
|
60
|
+
(from === common_1.Fiat.USD && to === common_1.Fiat.MXN)) {
|
|
61
|
+
const now = new Date();
|
|
62
|
+
const mexicoCityTime = new Date(now.toLocaleString("en-US", { timeZone: "America/Mexico_City" }));
|
|
63
|
+
const hours = mexicoCityTime.getHours();
|
|
64
|
+
const minutes = mexicoCityTime.getMinutes();
|
|
65
|
+
// Check if it's between 2:30 PM and 6:00 PM
|
|
66
|
+
if ((hours === 14 && minutes >= 30) ||
|
|
67
|
+
(hours > 14 && hours < 18) ||
|
|
68
|
+
(hours === 18 && minutes === 0)) {
|
|
69
|
+
exchangeRateMultiplier = 0.997;
|
|
70
|
+
}
|
|
71
|
+
else if (hours >= 0 && hours < 8) {
|
|
72
|
+
exchangeRateMultiplier = 0.996;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
58
75
|
const conversionRateWithRioMarkup = to === from ? conversionRate : conversionRate * exchangeRateMultiplier;
|
|
59
76
|
const conversionRateWithAllMarkups = to === from
|
|
60
77
|
? conversionRateWithVolatilityMarkup
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1031",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
25
25
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
26
26
|
"@google-cloud/storage": "^6.9.5",
|
|
27
|
-
"@riocrypto/common": "^1.0.
|
|
27
|
+
"@riocrypto/common": "^1.0.887",
|
|
28
28
|
"@types/express": "^4.17.13",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"ccxt": "^3.0.30",
|