@riocrypto/common-server 1.0.775 → 1.0.776
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.
|
@@ -19,6 +19,7 @@ const user_1 = require("../models/user");
|
|
|
19
19
|
const calculate_aggregate_volume_1 = require("./calculate-aggregate-volume");
|
|
20
20
|
const getPlatformAndPartnerFees = (mongoose, amountFiat, fiat, processor, country, discount, partnerId, brokerId, user) => __awaiter(void 0, void 0, void 0, function* () {
|
|
21
21
|
var _a;
|
|
22
|
+
console.log("user", user);
|
|
22
23
|
let platformFeeFiat;
|
|
23
24
|
let platformFeeFiatTax = 0;
|
|
24
25
|
let partnerFeeFiat = 0;
|
|
@@ -70,8 +71,11 @@ const getPlatformAndPartnerFees = (mongoose, amountFiat, fiat, processor, countr
|
|
|
70
71
|
else {
|
|
71
72
|
volume = Number(amountUSD);
|
|
72
73
|
}
|
|
74
|
+
console.log("Volume", volume);
|
|
73
75
|
for (const range of user.platformFeeRanges) {
|
|
76
|
+
console.log(range);
|
|
74
77
|
if (range.min <= Number(volume) && range.max >= Number(volume)) {
|
|
78
|
+
console.log("Hit");
|
|
75
79
|
if (discount) {
|
|
76
80
|
if (discount > range.fee) {
|
|
77
81
|
throw new Error("Discount cannot be greater than platform fee");
|
|
@@ -87,6 +91,7 @@ const getPlatformAndPartnerFees = (mongoose, amountFiat, fiat, processor, countr
|
|
|
87
91
|
break;
|
|
88
92
|
}
|
|
89
93
|
}
|
|
94
|
+
console.log("platformFeeFiat", platformFeeFiat);
|
|
90
95
|
// @ts-ignore
|
|
91
96
|
if (platformFeeFiat === undefined) {
|
|
92
97
|
const netPlatformFee = rioSettings.platformFee - discount;
|
|
@@ -98,6 +103,7 @@ const getPlatformAndPartnerFees = (mongoose, amountFiat, fiat, processor, countr
|
|
|
98
103
|
partnerFeeFiat = 0;
|
|
99
104
|
}
|
|
100
105
|
else {
|
|
106
|
+
console.log("tribeca");
|
|
101
107
|
const netPlatformFee = rioSettings.platformFee - discount;
|
|
102
108
|
if (netPlatformFee < 0) {
|
|
103
109
|
throw new Error("Discount cannot be greater than platform fee");
|
|
@@ -106,6 +112,7 @@ const getPlatformAndPartnerFees = (mongoose, amountFiat, fiat, processor, countr
|
|
|
106
112
|
partnerFeeFiat = 0;
|
|
107
113
|
}
|
|
108
114
|
if (brokerId && !platformFeeFiat) {
|
|
115
|
+
console.log("plas");
|
|
109
116
|
const User = (0, user_1.buildUser)(mongoose);
|
|
110
117
|
const brokerCustomer = yield User.findById(brokerId);
|
|
111
118
|
if (!brokerCustomer) {
|