@riocrypto/common-server 1.0.1172 → 1.0.1174
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.
- package/build/helpers/get-platform-fees.js +4 -4
- package/build/models/user.d.ts +14 -2
- package/build/models/user.js +79 -13
- package/package.json +2 -2
|
@@ -46,8 +46,8 @@ const getPlatformFees = (mongoose, conversionRateToUSD, amountFiat, fiat, proces
|
|
|
46
46
|
else {
|
|
47
47
|
volume = Number(amountUSD);
|
|
48
48
|
}
|
|
49
|
-
if (broker.platformFeeRanges) {
|
|
50
|
-
for (const range of broker.platformFeeRanges) {
|
|
49
|
+
if (broker.platformFeeRanges && broker.platformFeeRanges[country]) {
|
|
50
|
+
for (const range of broker.platformFeeRanges[country]) {
|
|
51
51
|
if (range.min <= Number(volume) && range.max >= Number(volume)) {
|
|
52
52
|
if (discount) {
|
|
53
53
|
if (discount > range.fee) {
|
|
@@ -84,7 +84,7 @@ const getPlatformFees = (mongoose, conversionRateToUSD, amountFiat, fiat, proces
|
|
|
84
84
|
platformFeeFiat = amountFiat * netPlatformFee;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
else if (user === null || user === void 0 ? void 0 : user.platformFeeRanges) {
|
|
87
|
+
else if ((user === null || user === void 0 ? void 0 : user.platformFeeRanges) && user.platformFeeRanges[country]) {
|
|
88
88
|
let volume;
|
|
89
89
|
if ((_b = user === null || user === void 0 ? void 0 : user.attributes) === null || _b === void 0 ? void 0 : _b.includes(common_1.UserAttribute.summedVolumeFees)) {
|
|
90
90
|
const volumeAndRevenue = yield (0, calculate_aggregate_volume_and_revenue_1.calculateAggregateVolumeAndRevenue)(mongoose, 14, user);
|
|
@@ -93,7 +93,7 @@ const getPlatformFees = (mongoose, conversionRateToUSD, amountFiat, fiat, proces
|
|
|
93
93
|
else {
|
|
94
94
|
volume = Number(amountUSD);
|
|
95
95
|
}
|
|
96
|
-
for (const range of user.platformFeeRanges) {
|
|
96
|
+
for (const range of user.platformFeeRanges[country]) {
|
|
97
97
|
if (range.min <= Number(volume) && range.max >= Number(volume)) {
|
|
98
98
|
if (discount) {
|
|
99
99
|
if (discount > range.fee) {
|
package/build/models/user.d.ts
CHANGED
|
@@ -25,7 +25,13 @@ interface UserAttrs {
|
|
|
25
25
|
curp?: string;
|
|
26
26
|
ruc?: string;
|
|
27
27
|
economicActivity?: string;
|
|
28
|
-
platformFeeRanges?:
|
|
28
|
+
platformFeeRanges?: {
|
|
29
|
+
MX?: PlatformFeeRange[];
|
|
30
|
+
PE?: PlatformFeeRange[];
|
|
31
|
+
CO?: PlatformFeeRange[];
|
|
32
|
+
BR?: PlatformFeeRange[];
|
|
33
|
+
US?: PlatformFeeRange[];
|
|
34
|
+
};
|
|
29
35
|
COIFile?: string;
|
|
30
36
|
KYCReportFile?: string;
|
|
31
37
|
CSFFile?: string;
|
|
@@ -67,7 +73,13 @@ interface UserDoc extends Document {
|
|
|
67
73
|
language?: Language;
|
|
68
74
|
attributes?: UserAttribute[];
|
|
69
75
|
brokerId?: string;
|
|
70
|
-
platformFeeRanges?:
|
|
76
|
+
platformFeeRanges?: {
|
|
77
|
+
MX?: PlatformFeeRange[];
|
|
78
|
+
PE?: PlatformFeeRange[];
|
|
79
|
+
CO?: PlatformFeeRange[];
|
|
80
|
+
BR?: PlatformFeeRange[];
|
|
81
|
+
US?: PlatformFeeRange[];
|
|
82
|
+
};
|
|
71
83
|
COIFile?: string;
|
|
72
84
|
KYCReportFile?: string;
|
|
73
85
|
CSFFile?: string;
|
package/build/models/user.js
CHANGED
|
@@ -103,22 +103,88 @@ const buildUser = (mongoose) => {
|
|
|
103
103
|
proofOfAddressFile: {
|
|
104
104
|
type: String,
|
|
105
105
|
},
|
|
106
|
-
platformFeeRanges:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
platformFeeRanges: {
|
|
107
|
+
MX: [
|
|
108
|
+
{
|
|
109
|
+
min: {
|
|
110
|
+
type: Number,
|
|
111
|
+
required: true,
|
|
112
|
+
},
|
|
113
|
+
max: {
|
|
114
|
+
type: Number,
|
|
115
|
+
required: true,
|
|
116
|
+
},
|
|
117
|
+
fee: {
|
|
118
|
+
type: Number,
|
|
119
|
+
required: true,
|
|
120
|
+
},
|
|
111
121
|
},
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
122
|
+
],
|
|
123
|
+
US: [
|
|
124
|
+
{
|
|
125
|
+
min: {
|
|
126
|
+
type: Number,
|
|
127
|
+
required: true,
|
|
128
|
+
},
|
|
129
|
+
max: {
|
|
130
|
+
type: Number,
|
|
131
|
+
required: true,
|
|
132
|
+
},
|
|
133
|
+
fee: {
|
|
134
|
+
type: Number,
|
|
135
|
+
required: true,
|
|
136
|
+
},
|
|
115
137
|
},
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
138
|
+
],
|
|
139
|
+
PE: [
|
|
140
|
+
{
|
|
141
|
+
min: {
|
|
142
|
+
type: Number,
|
|
143
|
+
required: true,
|
|
144
|
+
},
|
|
145
|
+
max: {
|
|
146
|
+
type: Number,
|
|
147
|
+
required: true,
|
|
148
|
+
},
|
|
149
|
+
fee: {
|
|
150
|
+
type: Number,
|
|
151
|
+
required: true,
|
|
152
|
+
},
|
|
119
153
|
},
|
|
120
|
-
|
|
121
|
-
|
|
154
|
+
],
|
|
155
|
+
CO: [
|
|
156
|
+
{
|
|
157
|
+
min: {
|
|
158
|
+
type: Number,
|
|
159
|
+
required: true,
|
|
160
|
+
},
|
|
161
|
+
max: {
|
|
162
|
+
type: Number,
|
|
163
|
+
required: true,
|
|
164
|
+
},
|
|
165
|
+
fee: {
|
|
166
|
+
type: Number,
|
|
167
|
+
required: true,
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
],
|
|
171
|
+
BR: [
|
|
172
|
+
{
|
|
173
|
+
min: {
|
|
174
|
+
type: Number,
|
|
175
|
+
required: true,
|
|
176
|
+
},
|
|
177
|
+
max: {
|
|
178
|
+
type: Number,
|
|
179
|
+
required: true,
|
|
180
|
+
},
|
|
181
|
+
fee: {
|
|
182
|
+
type: Number,
|
|
183
|
+
required: true,
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
},
|
|
122
188
|
authorizedPhoneNumbers: [
|
|
123
189
|
{
|
|
124
190
|
type: String,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1174",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
27
27
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
28
28
|
"@google-cloud/storage": "^6.9.5",
|
|
29
|
-
"@riocrypto/common": "^1.0.
|
|
29
|
+
"@riocrypto/common": "^1.0.1054",
|
|
30
30
|
"@types/express": "^4.17.13",
|
|
31
31
|
"axios": "^0.27.2",
|
|
32
32
|
"ccxt": "^3.0.30",
|