@riocrypto/common-server 1.0.1256 → 1.0.1258
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.
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Processor } from "@riocrypto/common";
|
|
2
|
-
export declare const getProcessorFees: (processor: Processor, amountFiat: number, conversionRateFromUSD: number, USBankTransferMethod?: "wire" | "ach_push") => Promise<number>;
|
|
1
|
+
import { Fiat, Processor, Side } from "@riocrypto/common";
|
|
2
|
+
export declare const getProcessorFees: (processor: Processor, amountFiat: number, conversionRateFromUSD: number, side: Side, fiat: Fiat, USBankTransferMethod?: "wire" | "ach_push") => Promise<number>;
|
|
@@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.getProcessorFees = void 0;
|
|
13
13
|
const common_1 = require("@riocrypto/common");
|
|
14
|
-
const getProcessorFees = (processor, amountFiat, conversionRateFromUSD, USBankTransferMethod) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14
|
+
const getProcessorFees = (processor, amountFiat, conversionRateFromUSD, side, fiat, USBankTransferMethod) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
15
|
if (processor === common_1.Processor.Bridge) {
|
|
16
16
|
const wireFee = USBankTransferMethod === "wire" ? 20 : 0;
|
|
17
17
|
const x = (amountFiat * (1 / conversionRateFromUSD) * 0.0015 + wireFee) *
|
|
@@ -22,7 +22,19 @@ const getProcessorFees = (processor, amountFiat, conversionRateFromUSD, USBankTr
|
|
|
22
22
|
return amountFiat * 0.006;
|
|
23
23
|
}
|
|
24
24
|
else if (processor === common_1.Processor.Interbank) {
|
|
25
|
-
|
|
25
|
+
if (side === common_1.Side.Buy) {
|
|
26
|
+
return amountFiat * 0.005;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
let baseFee = amountFiat * 0.005;
|
|
30
|
+
if (fiat === common_1.Fiat.PEN) {
|
|
31
|
+
baseFee += 4.47;
|
|
32
|
+
}
|
|
33
|
+
else if (fiat === common_1.Fiat.USD) {
|
|
34
|
+
baseFee += 1.16 * conversionRateFromUSD;
|
|
35
|
+
}
|
|
36
|
+
return baseFee;
|
|
37
|
+
}
|
|
26
38
|
}
|
|
27
39
|
else if (processor === common_1.Processor.SWIFT) {
|
|
28
40
|
return 25 * conversionRateFromUSD;
|
|
@@ -153,8 +153,9 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
153
153
|
next();
|
|
154
154
|
return;
|
|
155
155
|
}
|
|
156
|
-
if (authorizationTypes.includes(common_1.AuthorizationType.User) ||
|
|
157
|
-
|
|
156
|
+
if ((authorizationTypes.includes(common_1.AuthorizationType.User) ||
|
|
157
|
+
authorizationTypes.includes(common_1.AuthorizationType.UserNoKYC)) &&
|
|
158
|
+
req.user) {
|
|
158
159
|
next();
|
|
159
160
|
return;
|
|
160
161
|
}
|