@riocrypto/common-server 1.0.622 → 1.0.624
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/common/src/types/business-user.d.ts +30 -0
- package/build/common/src/types/business-user.js +2 -0
- package/build/common/src/types/country.d.ts +57 -0
- package/build/common/src/types/country.js +61 -0
- package/build/common/src/types/kyc-status.d.ts +7 -0
- package/build/common/src/types/kyc-status.js +11 -0
- package/build/common/src/types/language.d.ts +6 -0
- package/build/common/src/types/language.js +10 -0
- package/build/common/src/types/platform-fee-range.d.ts +5 -0
- package/build/common/src/types/platform-fee-range.js +2 -0
- package/build/common/src/types/us-state.d.ts +61 -0
- package/build/common/src/types/us-state.js +65 -0
- package/build/common/src/types/user-attribute.d.ts +10 -0
- package/build/common/src/types/user-attribute.js +14 -0
- package/build/common/src/types/user-type.d.ts +4 -0
- package/build/common/src/types/user-type.js +8 -0
- package/build/common/src/types/user.d.ts +30 -0
- package/build/common/src/types/user.js +2 -0
- package/build/common-server/src/helpers/get-platform-fee.d.ts +8 -0
- package/build/common-server/src/helpers/get-platform-fee.js +107 -0
- package/build/{models → common-server/src/models}/order.js +3 -9
- package/package.json +2 -2
- /package/build/{clients → common-server/src/clients}/bitstamp-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/bitstamp-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/ccxt-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/ccxt-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/currency-api-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/currency-api-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/etherscan-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/etherscan-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/fireblocks-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/fireblocks-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/gcloud-storage-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/gcloud-storage-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/gueno-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/gueno-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/kapstar-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/kapstar-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/kushki-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/kushki-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/rio-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/rio-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/secret-manager-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/secret-manager-client.js +0 -0
- /package/build/{clients → common-server/src/clients}/slack-client.d.ts +0 -0
- /package/build/{clients → common-server/src/clients}/slack-client.js +0 -0
- /package/build/{helpers → common-server/src/helpers}/get-user-helper.d.ts +0 -0
- /package/build/{helpers → common-server/src/helpers}/get-user-helper.js +0 -0
- /package/build/{index.d.ts → common-server/src/index.d.ts} +0 -0
- /package/build/{index.js → common-server/src/index.js} +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/authorize.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/authorize.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/current-admin-auth.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/current-admin-auth.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/current-auth.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/current-auth.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/error-handler.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/error-handler.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/get-order.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/get-order.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/get-partner.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/get-partner.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/get-user.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/get-user.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/require-admin-api-key.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/require-admin-api-key.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/require-auth.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/require-auth.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/require-priveleges.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/require-priveleges.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/validate-auth.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/validate-auth.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/validate-kyc.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/validate-kyc.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/validate-order.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/validate-order.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/validate-request.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/validate-request.js +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/verify-admin-api-key.d.ts +0 -0
- /package/build/{middlewares → common-server/src/middlewares}/verify-admin-api-key.js +0 -0
- /package/build/{models → common-server/src/models}/admin-auth.d.ts +0 -0
- /package/build/{models → common-server/src/models}/admin-auth.js +0 -0
- /package/build/{models → common-server/src/models}/auth.d.ts +0 -0
- /package/build/{models → common-server/src/models}/auth.js +0 -0
- /package/build/{models → common-server/src/models}/bank-payment.d.ts +0 -0
- /package/build/{models → common-server/src/models}/bank-payment.js +0 -0
- /package/build/{models → common-server/src/models}/bank-payout.d.ts +0 -0
- /package/build/{models → common-server/src/models}/bank-payout.js +0 -0
- /package/build/{models → common-server/src/models}/business-user.d.ts +0 -0
- /package/build/{models → common-server/src/models}/business-user.js +0 -0
- /package/build/{models → common-server/src/models}/ccxt-order.d.ts +0 -0
- /package/build/{models → common-server/src/models}/ccxt-order.js +0 -0
- /package/build/{models → common-server/src/models}/checked-address.d.ts +0 -0
- /package/build/{models → common-server/src/models}/checked-address.js +0 -0
- /package/build/{models → common-server/src/models}/kushki-payment.d.ts +0 -0
- /package/build/{models → common-server/src/models}/kushki-payment.js +0 -0
- /package/build/{models → common-server/src/models}/kyc.d.ts +0 -0
- /package/build/{models → common-server/src/models}/kyc.js +0 -0
- /package/build/{models → common-server/src/models}/order.d.ts +0 -0
- /package/build/{models → common-server/src/models}/partner-auth.d.ts +0 -0
- /package/build/{models → common-server/src/models}/partner-auth.js +0 -0
- /package/build/{models → common-server/src/models}/partner.d.ts +0 -0
- /package/build/{models → common-server/src/models}/partner.js +0 -0
- /package/build/{models → common-server/src/models}/rio-settings.d.ts +0 -0
- /package/build/{models → common-server/src/models}/rio-settings.js +0 -0
- /package/build/{models → common-server/src/models}/user.d.ts +0 -0
- /package/build/{models → common-server/src/models}/user.js +0 -0
- /package/build/{services → common-server/src/services}/apiKey.d.ts +0 -0
- /package/build/{services → common-server/src/services}/apiKey.js +0 -0
- /package/build/{services → common-server/src/services}/password.d.ts +0 -0
- /package/build/{services → common-server/src/services}/password.js +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Country } from "./country";
|
|
2
|
+
import { KYCStatus } from "./kyc-status";
|
|
3
|
+
import { Language } from "./language";
|
|
4
|
+
import { PlatformFeeRange } from "./platform-fee-range";
|
|
5
|
+
import { USState } from "./us-state";
|
|
6
|
+
import { UserAttribute } from "./user-attribute";
|
|
7
|
+
import { UserType } from "./user-type";
|
|
8
|
+
export interface BusinessUser {
|
|
9
|
+
id: string;
|
|
10
|
+
authId?: string;
|
|
11
|
+
type: UserType;
|
|
12
|
+
companyName: string;
|
|
13
|
+
legalRepresentative: string;
|
|
14
|
+
phoneNumber: string;
|
|
15
|
+
email: string;
|
|
16
|
+
street1: string;
|
|
17
|
+
street2?: string;
|
|
18
|
+
city: string;
|
|
19
|
+
state: USState | string;
|
|
20
|
+
postalCode: string;
|
|
21
|
+
country: Country;
|
|
22
|
+
kycStatus: KYCStatus;
|
|
23
|
+
cpf?: string;
|
|
24
|
+
language?: Language;
|
|
25
|
+
COIFile?: string;
|
|
26
|
+
KYCReportFile?: string;
|
|
27
|
+
attributes?: UserAttribute[];
|
|
28
|
+
brokerId?: string;
|
|
29
|
+
platformFeeRanges?: PlatformFeeRange[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare enum Country {
|
|
2
|
+
Algeria = "DZ",
|
|
3
|
+
Argentina = "AR",
|
|
4
|
+
Australia = "AU",
|
|
5
|
+
Austria = "AT",
|
|
6
|
+
Belgium = "BE",
|
|
7
|
+
Bolivia = "BO",
|
|
8
|
+
Brazil = "BR",
|
|
9
|
+
Canada = "CA",
|
|
10
|
+
Chile = "CL",
|
|
11
|
+
Colombia = "CO",
|
|
12
|
+
CostaRica = "CR",
|
|
13
|
+
Cyprus = "CY",
|
|
14
|
+
CzechRepublic = "CZ",
|
|
15
|
+
Denmark = "DK",
|
|
16
|
+
DominicanRepublic = "DO",
|
|
17
|
+
Estonia = "EE",
|
|
18
|
+
Fiji = "FJ",
|
|
19
|
+
France = "FR",
|
|
20
|
+
Germany = "DE",
|
|
21
|
+
Greece = "GR",
|
|
22
|
+
HongKong = "HK",
|
|
23
|
+
Iceland = "IS",
|
|
24
|
+
India = "IN",
|
|
25
|
+
Indonesia = "ID",
|
|
26
|
+
Ireland = "IE",
|
|
27
|
+
Israel = "IL",
|
|
28
|
+
Italy = "IT",
|
|
29
|
+
Japan = "JP",
|
|
30
|
+
Korea = "KR",
|
|
31
|
+
Latvia = "LV",
|
|
32
|
+
Lithuania = "LT",
|
|
33
|
+
Luxembourg = "LU",
|
|
34
|
+
Malaysia = "MY",
|
|
35
|
+
Mexico = "MX",
|
|
36
|
+
Nepal = "NP",
|
|
37
|
+
Netherlands = "NL",
|
|
38
|
+
NewZealand = "NZ",
|
|
39
|
+
Norway = "NO",
|
|
40
|
+
Paraguay = "PY",
|
|
41
|
+
Peru = "PE",
|
|
42
|
+
Philippines = "PH",
|
|
43
|
+
Poland = "PL",
|
|
44
|
+
Portugal = "PT",
|
|
45
|
+
Singapore = "SG",
|
|
46
|
+
Slovakia = "SK",
|
|
47
|
+
Slovenia = "SI",
|
|
48
|
+
SouthAfrica = "ZA",
|
|
49
|
+
Spain = "ES",
|
|
50
|
+
Sweden = "SE",
|
|
51
|
+
Switzerland = "CH",
|
|
52
|
+
Tanzania = "TZ",
|
|
53
|
+
Thailand = "TH",
|
|
54
|
+
Turkey = "TR",
|
|
55
|
+
UnitedKingdom = "GB",
|
|
56
|
+
Vietnam = "VN"
|
|
57
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Country = void 0;
|
|
4
|
+
var Country;
|
|
5
|
+
(function (Country) {
|
|
6
|
+
Country["Algeria"] = "DZ";
|
|
7
|
+
Country["Argentina"] = "AR";
|
|
8
|
+
Country["Australia"] = "AU";
|
|
9
|
+
Country["Austria"] = "AT";
|
|
10
|
+
Country["Belgium"] = "BE";
|
|
11
|
+
Country["Bolivia"] = "BO";
|
|
12
|
+
Country["Brazil"] = "BR";
|
|
13
|
+
Country["Canada"] = "CA";
|
|
14
|
+
Country["Chile"] = "CL";
|
|
15
|
+
Country["Colombia"] = "CO";
|
|
16
|
+
Country["CostaRica"] = "CR";
|
|
17
|
+
Country["Cyprus"] = "CY";
|
|
18
|
+
Country["CzechRepublic"] = "CZ";
|
|
19
|
+
Country["Denmark"] = "DK";
|
|
20
|
+
Country["DominicanRepublic"] = "DO";
|
|
21
|
+
Country["Estonia"] = "EE";
|
|
22
|
+
Country["Fiji"] = "FJ";
|
|
23
|
+
Country["France"] = "FR";
|
|
24
|
+
Country["Germany"] = "DE";
|
|
25
|
+
Country["Greece"] = "GR";
|
|
26
|
+
Country["HongKong"] = "HK";
|
|
27
|
+
Country["Iceland"] = "IS";
|
|
28
|
+
Country["India"] = "IN";
|
|
29
|
+
Country["Indonesia"] = "ID";
|
|
30
|
+
Country["Ireland"] = "IE";
|
|
31
|
+
Country["Israel"] = "IL";
|
|
32
|
+
Country["Italy"] = "IT";
|
|
33
|
+
Country["Japan"] = "JP";
|
|
34
|
+
Country["Korea"] = "KR";
|
|
35
|
+
Country["Latvia"] = "LV";
|
|
36
|
+
Country["Lithuania"] = "LT";
|
|
37
|
+
Country["Luxembourg"] = "LU";
|
|
38
|
+
Country["Malaysia"] = "MY";
|
|
39
|
+
Country["Mexico"] = "MX";
|
|
40
|
+
Country["Nepal"] = "NP";
|
|
41
|
+
Country["Netherlands"] = "NL";
|
|
42
|
+
Country["NewZealand"] = "NZ";
|
|
43
|
+
Country["Norway"] = "NO";
|
|
44
|
+
Country["Paraguay"] = "PY";
|
|
45
|
+
Country["Peru"] = "PE";
|
|
46
|
+
Country["Philippines"] = "PH";
|
|
47
|
+
Country["Poland"] = "PL";
|
|
48
|
+
Country["Portugal"] = "PT";
|
|
49
|
+
Country["Singapore"] = "SG";
|
|
50
|
+
Country["Slovakia"] = "SK";
|
|
51
|
+
Country["Slovenia"] = "SI";
|
|
52
|
+
Country["SouthAfrica"] = "ZA";
|
|
53
|
+
Country["Spain"] = "ES";
|
|
54
|
+
Country["Sweden"] = "SE";
|
|
55
|
+
Country["Switzerland"] = "CH";
|
|
56
|
+
Country["Tanzania"] = "TZ";
|
|
57
|
+
Country["Thailand"] = "TH";
|
|
58
|
+
Country["Turkey"] = "TR";
|
|
59
|
+
Country["UnitedKingdom"] = "GB";
|
|
60
|
+
Country["Vietnam"] = "VN";
|
|
61
|
+
})(Country = exports.Country || (exports.Country = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KYCStatus = void 0;
|
|
4
|
+
var KYCStatus;
|
|
5
|
+
(function (KYCStatus) {
|
|
6
|
+
KYCStatus["Passed"] = "passed";
|
|
7
|
+
KYCStatus["Failed"] = "failed";
|
|
8
|
+
KYCStatus["Review"] = "review";
|
|
9
|
+
KYCStatus["businessApproved"] = "businessApproved";
|
|
10
|
+
KYCStatus["None"] = "none";
|
|
11
|
+
})(KYCStatus = exports.KYCStatus || (exports.KYCStatus = {}));
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Language = void 0;
|
|
4
|
+
var Language;
|
|
5
|
+
(function (Language) {
|
|
6
|
+
Language["EN"] = "en";
|
|
7
|
+
Language["ES"] = "es";
|
|
8
|
+
Language["FR"] = "fr";
|
|
9
|
+
Language["PT"] = "pt";
|
|
10
|
+
})(Language = exports.Language || (exports.Language = {}));
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export declare enum USState {
|
|
2
|
+
"AL" = "AL",
|
|
3
|
+
"AK" = "AK",
|
|
4
|
+
"AS" = "AS",
|
|
5
|
+
"AZ" = "AZ",
|
|
6
|
+
"AR" = "AR",
|
|
7
|
+
"CA" = "CA",
|
|
8
|
+
"CO" = "CO",
|
|
9
|
+
"CT" = "CT",
|
|
10
|
+
"DE" = "DE",
|
|
11
|
+
"DC" = "DC",
|
|
12
|
+
"FM" = "FM",
|
|
13
|
+
"FL" = "FL",
|
|
14
|
+
"GA" = "GA",
|
|
15
|
+
"GU" = "GU",
|
|
16
|
+
"HI" = "HI",
|
|
17
|
+
"ID" = "ID",
|
|
18
|
+
"IL" = "IL",
|
|
19
|
+
"IN" = "IN",
|
|
20
|
+
"IA" = "IA",
|
|
21
|
+
"KS" = "KS",
|
|
22
|
+
"KY" = "KY",
|
|
23
|
+
"LA" = "LA",
|
|
24
|
+
"ME" = "ME",
|
|
25
|
+
"MH" = "MH",
|
|
26
|
+
"MD" = "MD",
|
|
27
|
+
"MA" = "MA",
|
|
28
|
+
"MI" = "MI",
|
|
29
|
+
"MN" = "MN",
|
|
30
|
+
"MS" = "MS",
|
|
31
|
+
"MO" = "MO",
|
|
32
|
+
"MT" = "MT",
|
|
33
|
+
"NE" = "NE",
|
|
34
|
+
"NV" = "NV",
|
|
35
|
+
"NH" = "NH",
|
|
36
|
+
"NJ" = "NJ",
|
|
37
|
+
"NM" = "NM",
|
|
38
|
+
"NY" = "NY",
|
|
39
|
+
"NC" = "NC",
|
|
40
|
+
"ND" = "ND",
|
|
41
|
+
"MP" = "MP",
|
|
42
|
+
"OH" = "OH",
|
|
43
|
+
"OK" = "OK",
|
|
44
|
+
"OR" = "OR",
|
|
45
|
+
"PW" = "PW",
|
|
46
|
+
"PA" = "PA",
|
|
47
|
+
"PR" = "PR",
|
|
48
|
+
"RI" = "RI",
|
|
49
|
+
"SC" = "SC",
|
|
50
|
+
"SD" = "SD",
|
|
51
|
+
"TN" = "TN",
|
|
52
|
+
"TX" = "TX",
|
|
53
|
+
"UT" = "UT",
|
|
54
|
+
"VT" = "VT",
|
|
55
|
+
"VI" = "VI",
|
|
56
|
+
"VA" = "VA",
|
|
57
|
+
"WA" = "WA",
|
|
58
|
+
"WV" = "WV",
|
|
59
|
+
"WI" = "WI",
|
|
60
|
+
"WY" = "WY"
|
|
61
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USState = void 0;
|
|
4
|
+
var USState;
|
|
5
|
+
(function (USState) {
|
|
6
|
+
USState["AL"] = "AL";
|
|
7
|
+
USState["AK"] = "AK";
|
|
8
|
+
USState["AS"] = "AS";
|
|
9
|
+
USState["AZ"] = "AZ";
|
|
10
|
+
USState["AR"] = "AR";
|
|
11
|
+
USState["CA"] = "CA";
|
|
12
|
+
USState["CO"] = "CO";
|
|
13
|
+
USState["CT"] = "CT";
|
|
14
|
+
USState["DE"] = "DE";
|
|
15
|
+
USState["DC"] = "DC";
|
|
16
|
+
USState["FM"] = "FM";
|
|
17
|
+
USState["FL"] = "FL";
|
|
18
|
+
USState["GA"] = "GA";
|
|
19
|
+
USState["GU"] = "GU";
|
|
20
|
+
USState["HI"] = "HI";
|
|
21
|
+
USState["ID"] = "ID";
|
|
22
|
+
USState["IL"] = "IL";
|
|
23
|
+
USState["IN"] = "IN";
|
|
24
|
+
USState["IA"] = "IA";
|
|
25
|
+
USState["KS"] = "KS";
|
|
26
|
+
USState["KY"] = "KY";
|
|
27
|
+
USState["LA"] = "LA";
|
|
28
|
+
USState["ME"] = "ME";
|
|
29
|
+
USState["MH"] = "MH";
|
|
30
|
+
USState["MD"] = "MD";
|
|
31
|
+
USState["MA"] = "MA";
|
|
32
|
+
USState["MI"] = "MI";
|
|
33
|
+
USState["MN"] = "MN";
|
|
34
|
+
USState["MS"] = "MS";
|
|
35
|
+
USState["MO"] = "MO";
|
|
36
|
+
USState["MT"] = "MT";
|
|
37
|
+
USState["NE"] = "NE";
|
|
38
|
+
USState["NV"] = "NV";
|
|
39
|
+
USState["NH"] = "NH";
|
|
40
|
+
USState["NJ"] = "NJ";
|
|
41
|
+
USState["NM"] = "NM";
|
|
42
|
+
USState["NY"] = "NY";
|
|
43
|
+
USState["NC"] = "NC";
|
|
44
|
+
USState["ND"] = "ND";
|
|
45
|
+
USState["MP"] = "MP";
|
|
46
|
+
USState["OH"] = "OH";
|
|
47
|
+
USState["OK"] = "OK";
|
|
48
|
+
USState["OR"] = "OR";
|
|
49
|
+
USState["PW"] = "PW";
|
|
50
|
+
USState["PA"] = "PA";
|
|
51
|
+
USState["PR"] = "PR";
|
|
52
|
+
USState["RI"] = "RI";
|
|
53
|
+
USState["SC"] = "SC";
|
|
54
|
+
USState["SD"] = "SD";
|
|
55
|
+
USState["TN"] = "TN";
|
|
56
|
+
USState["TX"] = "TX";
|
|
57
|
+
USState["UT"] = "UT";
|
|
58
|
+
USState["VT"] = "VT";
|
|
59
|
+
USState["VI"] = "VI";
|
|
60
|
+
USState["VA"] = "VA";
|
|
61
|
+
USState["WA"] = "WA";
|
|
62
|
+
USState["WV"] = "WV";
|
|
63
|
+
USState["WI"] = "WI";
|
|
64
|
+
USState["WY"] = "WY";
|
|
65
|
+
})(USState = exports.USState || (exports.USState = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserAttribute = void 0;
|
|
4
|
+
var UserAttribute;
|
|
5
|
+
(function (UserAttribute) {
|
|
6
|
+
UserAttribute["deleted"] = "deleted";
|
|
7
|
+
UserAttribute["disabled"] = "disabled";
|
|
8
|
+
UserAttribute["banned"] = "banned";
|
|
9
|
+
UserAttribute["beta"] = "beta";
|
|
10
|
+
UserAttribute["alpha"] = "alpha";
|
|
11
|
+
UserAttribute["gamma"] = "gamma";
|
|
12
|
+
UserAttribute["broker"] = "broker";
|
|
13
|
+
UserAttribute["brokerCustomer"] = "brokerCustomer";
|
|
14
|
+
})(UserAttribute = exports.UserAttribute || (exports.UserAttribute = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserType = void 0;
|
|
4
|
+
var UserType;
|
|
5
|
+
(function (UserType) {
|
|
6
|
+
UserType["Business"] = "business";
|
|
7
|
+
UserType["Individual"] = "individual";
|
|
8
|
+
})(UserType = exports.UserType || (exports.UserType = {}));
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Country } from "./country";
|
|
2
|
+
import { KYCStatus } from "./kyc-status";
|
|
3
|
+
import { Language } from "./language";
|
|
4
|
+
import { PlatformFeeRange } from "./platform-fee-range";
|
|
5
|
+
import { USState } from "./us-state";
|
|
6
|
+
import { UserAttribute } from "./user-attribute";
|
|
7
|
+
import { UserType } from "./user-type";
|
|
8
|
+
export interface User {
|
|
9
|
+
authId: string;
|
|
10
|
+
id: string;
|
|
11
|
+
type: UserType;
|
|
12
|
+
firstName: string;
|
|
13
|
+
lastName: string;
|
|
14
|
+
phoneNumber: string;
|
|
15
|
+
birthday: Date;
|
|
16
|
+
email: string;
|
|
17
|
+
street1: string;
|
|
18
|
+
street2?: string;
|
|
19
|
+
city: string;
|
|
20
|
+
state: USState | string;
|
|
21
|
+
postalCode: string;
|
|
22
|
+
country: Country;
|
|
23
|
+
kycStatus: KYCStatus;
|
|
24
|
+
cpf?: string;
|
|
25
|
+
language?: Language;
|
|
26
|
+
partnerId?: string;
|
|
27
|
+
attributes?: UserAttribute[];
|
|
28
|
+
brokerId?: string;
|
|
29
|
+
platformFeeRanges?: PlatformFeeRange[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BusinessUser } from "../../../common/src/types/business-user";
|
|
2
|
+
import { User } from "../../../common/src/types/user";
|
|
3
|
+
import { Order } from "@riocrypto/common";
|
|
4
|
+
export declare const getPlatformFee: (amountFiat: number, order: Order, user: User | BusinessUser) => Promise<{
|
|
5
|
+
platformFeeFiat: number;
|
|
6
|
+
plafformFeeFiatTax: number;
|
|
7
|
+
partnerFeeFiat: number;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.getPlatformFee = void 0;
|
|
16
|
+
const rio_settings_1 = require("../models/rio-settings");
|
|
17
|
+
const mongoose_1 = __importDefault(require("mongoose"));
|
|
18
|
+
const common_1 = require("@riocrypto/common");
|
|
19
|
+
const kapstar_client_1 = require("../clients/kapstar-client");
|
|
20
|
+
const currency_api_client_1 = require("../clients/currency-api-client");
|
|
21
|
+
const partner_1 = require("../models/partner");
|
|
22
|
+
const business_user_1 = require("../models/business-user");
|
|
23
|
+
const getPlatformFee = (amountFiat, order, user) => __awaiter(void 0, void 0, void 0, function* () {
|
|
24
|
+
let platformFeeFiat = 0;
|
|
25
|
+
let plafformFeeFiatTax = 0;
|
|
26
|
+
let partnerFeeFiat = 0;
|
|
27
|
+
let amountUSD;
|
|
28
|
+
let conversionRateToUSD = 0;
|
|
29
|
+
const RioSettings = yield (0, rio_settings_1.buildRioSettings)(mongoose_1.default);
|
|
30
|
+
const rioSettings = yield RioSettings.findOne();
|
|
31
|
+
if (!rioSettings) {
|
|
32
|
+
throw new common_1.RioSettingsNotFoundError();
|
|
33
|
+
}
|
|
34
|
+
if (order.processor === common_1.Processor.Kapstar) {
|
|
35
|
+
const kapstarClient = yield (0, kapstar_client_1.buildKapstarClient)();
|
|
36
|
+
conversionRateToUSD = yield kapstarClient.getBRLExchangeRateUSD();
|
|
37
|
+
}
|
|
38
|
+
else if (order.fiat !== common_1.Fiat.USD) {
|
|
39
|
+
const currencyAPIClient = yield (0, currency_api_client_1.buildCurrencyAPIClient)();
|
|
40
|
+
conversionRateToUSD = yield currencyAPIClient.convert(order.fiat, common_1.Fiat.USD);
|
|
41
|
+
}
|
|
42
|
+
else if (order.fiat === common_1.Fiat.USD) {
|
|
43
|
+
conversionRateToUSD = 1;
|
|
44
|
+
}
|
|
45
|
+
amountUSD = amountFiat * conversionRateToUSD;
|
|
46
|
+
if (!amountUSD) {
|
|
47
|
+
throw new Error("Could not convert amount to USD");
|
|
48
|
+
}
|
|
49
|
+
if (order.partnerId) {
|
|
50
|
+
const Partner = (0, partner_1.buildPartner)(mongoose_1.default);
|
|
51
|
+
const partner = yield Partner.findById(order.partnerId);
|
|
52
|
+
if (!partner) {
|
|
53
|
+
throw new common_1.PartnerNotFoundError();
|
|
54
|
+
}
|
|
55
|
+
platformFeeFiat = amountFiat * partner.platformFee;
|
|
56
|
+
partnerFeeFiat = amountFiat * partner.partnerFee;
|
|
57
|
+
}
|
|
58
|
+
else if (user === null || user === void 0 ? void 0 : user.platformFeeRanges) {
|
|
59
|
+
for (const range of user.platformFeeRanges) {
|
|
60
|
+
if (range.min <= Number(amountUSD) && range.max >= Number(amountUSD)) {
|
|
61
|
+
platformFeeFiat = amountFiat * range.fee;
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
if (platformFeeFiat === undefined) {
|
|
67
|
+
platformFeeFiat = amountFiat * rioSettings.platformFee;
|
|
68
|
+
}
|
|
69
|
+
partnerFeeFiat = 0;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
platformFeeFiat = amountFiat * rioSettings.platformFee;
|
|
73
|
+
partnerFeeFiat = 0;
|
|
74
|
+
}
|
|
75
|
+
if (order.brokerCustomerId) {
|
|
76
|
+
const BusinessUser = (0, business_user_1.buildBusinessUser)(mongoose_1.default);
|
|
77
|
+
const brokerCustomer = yield BusinessUser.findById(order.brokerCustomerId);
|
|
78
|
+
if (!brokerCustomer) {
|
|
79
|
+
throw new Error("Business user not found");
|
|
80
|
+
}
|
|
81
|
+
if (brokerCustomer === null || brokerCustomer === void 0 ? void 0 : brokerCustomer.platformFeeRanges) {
|
|
82
|
+
for (const range of brokerCustomer.platformFeeRanges) {
|
|
83
|
+
if (range.min <= Number(amountUSD) && range.max >= Number(amountUSD)) {
|
|
84
|
+
platformFeeFiat = amountFiat * range.fee;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if ((order.fiat === common_1.Fiat.MXN && order.processor === common_1.Processor.SPEI) ||
|
|
91
|
+
(order.fiat === common_1.Fiat.USD && order.processor === common_1.Processor.SPID)) {
|
|
92
|
+
if (user.country === common_1.Country.Mexico) {
|
|
93
|
+
plafformFeeFiatTax = platformFeeFiat * 0.16;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (order.fiat === common_1.Fiat.PEN && order.processor === common_1.Processor.Interbank) {
|
|
97
|
+
if (user.country === common_1.Country.Peru) {
|
|
98
|
+
plafformFeeFiatTax = platformFeeFiat * 0.18;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
platformFeeFiat,
|
|
103
|
+
plafformFeeFiatTax,
|
|
104
|
+
partnerFeeFiat,
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
exports.getPlatformFee = getPlatformFee;
|
|
@@ -71,15 +71,6 @@ const buildOrder = (mongoose) => {
|
|
|
71
71
|
type: String,
|
|
72
72
|
},
|
|
73
73
|
fees: {
|
|
74
|
-
processingFeeCrypto: {
|
|
75
|
-
type: Number,
|
|
76
|
-
},
|
|
77
|
-
transferFeeCrypto: {
|
|
78
|
-
type: Number,
|
|
79
|
-
},
|
|
80
|
-
platformFeeCrypto: {
|
|
81
|
-
type: Number,
|
|
82
|
-
},
|
|
83
74
|
processingFeeFiat: {
|
|
84
75
|
type: Number,
|
|
85
76
|
},
|
|
@@ -92,6 +83,9 @@ const buildOrder = (mongoose) => {
|
|
|
92
83
|
partnerFeeFiat: {
|
|
93
84
|
type: Number,
|
|
94
85
|
},
|
|
86
|
+
platformFeeFiatTax: {
|
|
87
|
+
type: Number,
|
|
88
|
+
},
|
|
95
89
|
},
|
|
96
90
|
price: {
|
|
97
91
|
type: Number,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.624",
|
|
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.586",
|
|
28
28
|
"@types/express": "^4.17.13",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"ccxt": "^3.0.30",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|