@riocrypto/common-server 1.0.1446 → 1.0.1448
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.
|
@@ -20,6 +20,7 @@ const getExchangeRates = (mongoose, fiat) => __awaiter(void 0, void 0, void 0, f
|
|
|
20
20
|
throw new Error("Rio settings not found");
|
|
21
21
|
}
|
|
22
22
|
const afterHoursExchangeRateMarkup = rioSettings.afterHoursExchangeRateMarkup;
|
|
23
|
+
const generalExchangeRateMarkup = rioSettings.generalExchangeRateMarkup;
|
|
23
24
|
const polygonClient = yield (0, polygon_client_1.buildPolygonClient)();
|
|
24
25
|
const conversionRateToUSD = fiat === common_1.Fiat.PEN
|
|
25
26
|
? (yield polygonClient.getExchangeRateData(fiat, common_1.Fiat.USD)).bid
|
|
@@ -38,9 +39,11 @@ const getExchangeRates = (mongoose, fiat) => __awaiter(void 0, void 0, void 0, f
|
|
|
38
39
|
// Check if it's between 2:10 PM and 12:00 AM
|
|
39
40
|
if ((hours === 14 && minutes >= 10) || hours > 14 || hours === 0) {
|
|
40
41
|
conversionRateToUSDWithMarkups =
|
|
41
|
-
conversionRateToUSD *
|
|
42
|
+
conversionRateToUSD *
|
|
43
|
+
(1 - afterHoursExchangeRateMarkup - generalExchangeRateMarkup);
|
|
42
44
|
conversionRateFromUSDWithMarkups =
|
|
43
|
-
conversionRateFromUSD *
|
|
45
|
+
conversionRateFromUSD *
|
|
46
|
+
(1 - afterHoursExchangeRateMarkup - generalExchangeRateMarkup);
|
|
44
47
|
}
|
|
45
48
|
}
|
|
46
49
|
if (fiat === common_1.Fiat.MXN) {
|
|
@@ -49,9 +52,9 @@ const getExchangeRates = (mongoose, fiat) => __awaiter(void 0, void 0, void 0, f
|
|
|
49
52
|
const hours = mexicoCityTime.getHours();
|
|
50
53
|
const minutes = mexicoCityTime.getMinutes();
|
|
51
54
|
let isAfterHours = false;
|
|
52
|
-
if ((hours >= 8 && hours < 15)
|
|
53
|
-
(hours === 15 && minutes <= 45)
|
|
54
|
-
(hours >= 19 && hours <= 22)) {
|
|
55
|
+
if (!(hours >= 8 && hours < 15) &&
|
|
56
|
+
!(hours === 15 && minutes <= 45) &&
|
|
57
|
+
!(hours >= 19 && hours <= 22)) {
|
|
55
58
|
isAfterHours = true;
|
|
56
59
|
}
|
|
57
60
|
if (mexicoCityTime.getDay() === 0 || mexicoCityTime.getDay() === 6) {
|
|
@@ -59,9 +62,11 @@ const getExchangeRates = (mongoose, fiat) => __awaiter(void 0, void 0, void 0, f
|
|
|
59
62
|
}
|
|
60
63
|
if (isAfterHours) {
|
|
61
64
|
conversionRateToUSDWithMarkups =
|
|
62
|
-
conversionRateToUSD *
|
|
65
|
+
conversionRateToUSD *
|
|
66
|
+
(1 - afterHoursExchangeRateMarkup - generalExchangeRateMarkup);
|
|
63
67
|
conversionRateFromUSDWithMarkups =
|
|
64
|
-
conversionRateFromUSD *
|
|
68
|
+
conversionRateFromUSD *
|
|
69
|
+
(1 - afterHoursExchangeRateMarkup - generalExchangeRateMarkup);
|
|
65
70
|
}
|
|
66
71
|
}
|
|
67
72
|
return {
|
|
@@ -2,10 +2,12 @@ import mongoose from "mongoose";
|
|
|
2
2
|
interface RioSettingsAttrs {
|
|
3
3
|
platformFee: number;
|
|
4
4
|
afterHoursExchangeRateMarkup: number;
|
|
5
|
+
generalExchangeRateMarkup: number;
|
|
5
6
|
}
|
|
6
7
|
interface RioSettingsDoc extends mongoose.Document {
|
|
7
8
|
platformFee: number;
|
|
8
9
|
afterHoursExchangeRateMarkup: number;
|
|
10
|
+
generalExchangeRateMarkup: number;
|
|
9
11
|
}
|
|
10
12
|
interface RioSettingsModel extends mongoose.Model<RioSettingsDoc> {
|
|
11
13
|
build(attrs: RioSettingsAttrs): RioSettingsDoc;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1448",
|
|
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.
|
|
30
|
+
"@riocrypto/common": "^1.0.1287",
|
|
31
31
|
"@types/express": "^4.17.13",
|
|
32
32
|
"axios": "^0.27.2",
|
|
33
33
|
"ccxt": "^3.0.30",
|