@riocrypto/common-server 1.0.654 → 1.0.656
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-and-partner-fees.d.ts +1 -0
- package/build/helpers/get-platform-and-partner-fees.js +5 -0
- package/build/models/business-user.d.ts +3 -1
- package/build/models/business-user.js +19 -0
- package/build/models/user.d.ts +3 -1
- package/build/models/user.js +19 -0
- package/package.json +2 -2
|
@@ -20,6 +20,7 @@ const getPlatformAndPartnerFees = (mongoose, amountFiat, fiat, processor, countr
|
|
|
20
20
|
let platformFeeFiat;
|
|
21
21
|
let platformFeeFiatTax = 0;
|
|
22
22
|
let partnerFeeFiat = 0;
|
|
23
|
+
let feesComped = false;
|
|
23
24
|
let amountUSD;
|
|
24
25
|
let conversionRateToUSD = 0;
|
|
25
26
|
const RioSettings = (0, rio_settings_1.buildRioSettings)(mongoose);
|
|
@@ -48,6 +49,9 @@ const getPlatformAndPartnerFees = (mongoose, amountFiat, fiat, processor, countr
|
|
|
48
49
|
if (!partner) {
|
|
49
50
|
throw new common_1.PartnerNotFoundError();
|
|
50
51
|
}
|
|
52
|
+
if (partner.feesComped) {
|
|
53
|
+
feesComped = true;
|
|
54
|
+
}
|
|
51
55
|
platformFeeFiat = amountFiat * partner.platformFee;
|
|
52
56
|
partnerFeeFiat = amountFiat * partner.partnerFee;
|
|
53
57
|
}
|
|
@@ -98,6 +102,7 @@ const getPlatformAndPartnerFees = (mongoose, amountFiat, fiat, processor, countr
|
|
|
98
102
|
platformFeeFiat,
|
|
99
103
|
platformFeeFiatTax,
|
|
100
104
|
partnerFeeFiat,
|
|
105
|
+
feesComped,
|
|
101
106
|
};
|
|
102
107
|
});
|
|
103
108
|
exports.getPlatformAndPartnerFees = getPlatformAndPartnerFees;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Country, KYCStatus, Language, PlatformFeeRange, USState, UserAttribute, UserType } from "@riocrypto/common";
|
|
1
|
+
import { BankAccount, Country, KYCStatus, Language, PlatformFeeRange, USState, UserAttribute, UserType } from "@riocrypto/common";
|
|
2
2
|
import { Mongoose, Model, Document } from "mongoose";
|
|
3
3
|
interface BusinessUserAttrs {
|
|
4
4
|
authIds?: string[];
|
|
@@ -22,6 +22,7 @@ interface BusinessUserAttrs {
|
|
|
22
22
|
brokerId?: string;
|
|
23
23
|
platformFeeRanges?: PlatformFeeRange[];
|
|
24
24
|
partnerId?: string;
|
|
25
|
+
bankAccounts?: BankAccount[];
|
|
25
26
|
}
|
|
26
27
|
interface BusinessUserModel extends Model<BusinessUserDoc> {
|
|
27
28
|
build(attrs: BusinessUserAttrs): BusinessUserDoc;
|
|
@@ -48,6 +49,7 @@ interface BusinessUserDoc extends Document {
|
|
|
48
49
|
brokerId?: string;
|
|
49
50
|
platformFeeRanges?: PlatformFeeRange[];
|
|
50
51
|
partnerId?: string;
|
|
52
|
+
bankAccounts?: BankAccount[];
|
|
51
53
|
}
|
|
52
54
|
declare const buildBusinessUser: (mongoose: Mongoose) => BusinessUserModel;
|
|
53
55
|
export { buildBusinessUser, BusinessUserDoc };
|
|
@@ -98,6 +98,25 @@ const buildBusinessUser = (mongoose) => {
|
|
|
98
98
|
},
|
|
99
99
|
},
|
|
100
100
|
],
|
|
101
|
+
bankAccounts: [
|
|
102
|
+
{
|
|
103
|
+
country: {
|
|
104
|
+
type: String,
|
|
105
|
+
required: true,
|
|
106
|
+
},
|
|
107
|
+
fiat: {
|
|
108
|
+
type: String,
|
|
109
|
+
required: true,
|
|
110
|
+
},
|
|
111
|
+
accountNumber: {
|
|
112
|
+
type: String,
|
|
113
|
+
required: true,
|
|
114
|
+
},
|
|
115
|
+
swiftCode: {
|
|
116
|
+
type: String,
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
],
|
|
101
120
|
}, {
|
|
102
121
|
toJSON: {
|
|
103
122
|
transform(doc, ret) {
|
package/build/models/user.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Country, KYCStatus, Language, USState, UserAttribute, UserType } from "@riocrypto/common";
|
|
1
|
+
import { BankAccount, Country, KYCStatus, Language, USState, UserAttribute, UserType } from "@riocrypto/common";
|
|
2
2
|
import { Mongoose, Model, Document } from "mongoose";
|
|
3
3
|
interface UserAttrs {
|
|
4
4
|
authId: string;
|
|
@@ -19,6 +19,7 @@ interface UserAttrs {
|
|
|
19
19
|
language?: Language;
|
|
20
20
|
attributes?: UserAttribute[];
|
|
21
21
|
partnerId?: string;
|
|
22
|
+
bankAccounts?: BankAccount[];
|
|
22
23
|
}
|
|
23
24
|
interface UserModel extends Model<UserDoc> {
|
|
24
25
|
build(attrs: UserAttrs): UserDoc;
|
|
@@ -43,6 +44,7 @@ interface UserDoc extends Document {
|
|
|
43
44
|
language?: Language;
|
|
44
45
|
attributes?: UserAttribute[];
|
|
45
46
|
partnerId?: string;
|
|
47
|
+
bankAccounts?: BankAccount[];
|
|
46
48
|
}
|
|
47
49
|
declare const buildUser: (mongoose: Mongoose) => UserModel;
|
|
48
50
|
export { buildUser, UserDoc };
|
package/build/models/user.js
CHANGED
|
@@ -76,6 +76,25 @@ const buildUser = (mongoose) => {
|
|
|
76
76
|
partnerId: {
|
|
77
77
|
type: String,
|
|
78
78
|
},
|
|
79
|
+
bankAccounts: [
|
|
80
|
+
{
|
|
81
|
+
country: {
|
|
82
|
+
type: String,
|
|
83
|
+
required: true,
|
|
84
|
+
},
|
|
85
|
+
fiat: {
|
|
86
|
+
type: String,
|
|
87
|
+
required: true,
|
|
88
|
+
},
|
|
89
|
+
accountNumber: {
|
|
90
|
+
type: String,
|
|
91
|
+
required: true,
|
|
92
|
+
},
|
|
93
|
+
swiftCode: {
|
|
94
|
+
type: String,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
],
|
|
79
98
|
}, {
|
|
80
99
|
toJSON: {
|
|
81
100
|
transform(doc, ret) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.656",
|
|
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.598",
|
|
28
28
|
"@types/express": "^4.17.13",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"ccxt": "^3.0.30",
|