@riocrypto/common 1.0.609 → 1.0.614

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.
@@ -3,9 +3,6 @@ import { Admin } from "../types/admin";
3
3
  import { Auth } from "../types/auth";
4
4
  import { AuthUpdate } from "../types/auth-update";
5
5
  import { BankPayout } from "../types/bank-payout";
6
- import { BusinessUser } from "../types/business-user";
7
- import { BusinessUserInput } from "../types/business-user-input";
8
- import { BusinessUserUpdate } from "../types/business-user-update";
9
6
  import { CheckedAddress } from "../types/checked-address";
10
7
  import { Country } from "../types/country";
11
8
  import { Fiat } from "../types/fiat";
@@ -21,17 +18,16 @@ import { UserInput } from "../types/user-input";
21
18
  import { UserUpdate } from "../types/user-update";
22
19
  import { BankPayment } from "../types/bank-payment";
23
20
  import { BankAccount } from "../types/bank-account";
21
+ import { UserType } from "../types/user-type";
24
22
  export declare class RioClient {
25
23
  private axios;
26
24
  constructor(axios: AxiosStatic | AxiosInstance);
27
25
  getOrders(): Promise<Order[]>;
28
- getUsers(): Promise<User[]>;
29
- getBusinessUsers(brokerId?: string): Promise<BusinessUser[]>;
26
+ getUsers(type?: UserType): Promise<User[]>;
30
27
  signinAdmin(email: string, password: string): Promise<any>;
31
28
  updateUser(update: UserUpdate, userId?: string): Promise<User>;
32
- uploadBusinessCOI(id: string, formData: FormData): Promise<BusinessUser>;
33
- uploadBusinessKYCReport(id: string, formData: FormData): Promise<BusinessUser>;
34
- updateBusinessUser(update: BusinessUserUpdate, businessUserId?: string): Promise<BusinessUser>;
29
+ uploadBusinessCOI(id: string, formData: FormData): Promise<User>;
30
+ uploadBusinessKYCReport(id: string, formData: FormData): Promise<User>;
35
31
  updateAdmin(update: {
36
32
  email?: string;
37
33
  password?: string;
@@ -47,11 +43,9 @@ export declare class RioClient {
47
43
  confirmBankPayment(orderId: string, amountFiat?: number): Promise<any>;
48
44
  confirmBankPayout(orderId: string): Promise<any>;
49
45
  getUser(): Promise<User>;
50
- getBusinessUser(): Promise<BusinessUser>;
51
46
  createUser(user: UserInput): Promise<void>;
52
47
  getBankPayment(orderId: string): Promise<BankPayment>;
53
48
  verifyBankPayment(orderId: string): Promise<any>;
54
- createBusinessUser(businessUser: BusinessUserInput): Promise<BusinessUser>;
55
49
  sendPhoneAuthCode(phoneNumber: string): Promise<void>;
56
50
  getAuth(phoneNumber?: string): Promise<{
57
51
  auth: Auth;
@@ -20,15 +20,13 @@ class RioClient {
20
20
  return data;
21
21
  });
22
22
  }
23
- getUsers() {
23
+ getUsers(type) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
- const { data } = yield this.axios.get(`/api/users`);
26
- return data;
27
- });
28
- }
29
- getBusinessUsers(brokerId) {
30
- return __awaiter(this, void 0, void 0, function* () {
31
- const { data } = yield this.axios.get(`/api/business/users${brokerId ? `?brokerId=${brokerId}` : ""}`);
25
+ const { data } = yield this.axios.get(`/api/users`, {
26
+ params: {
27
+ type,
28
+ },
29
+ });
32
30
  return data;
33
31
  });
34
32
  }
@@ -49,19 +47,13 @@ class RioClient {
49
47
  }
50
48
  uploadBusinessCOI(id, formData) {
51
49
  return __awaiter(this, void 0, void 0, function* () {
52
- const { data } = yield this.axios.post(`/api/business/users/${id}/coi`, formData);
50
+ const { data } = yield this.axios.post(`/api/users/${id}/coi`, formData);
53
51
  return data;
54
52
  });
55
53
  }
56
54
  uploadBusinessKYCReport(id, formData) {
57
55
  return __awaiter(this, void 0, void 0, function* () {
58
- const { data } = yield this.axios.post(`/api/business/users/${id}/kyc-report`, formData);
59
- return data;
60
- });
61
- }
62
- updateBusinessUser(update, businessUserId) {
63
- return __awaiter(this, void 0, void 0, function* () {
64
- const { data } = yield this.axios.patch(`/api/business/users/${businessUserId || ""}`, update);
56
+ const { data } = yield this.axios.post(`/api/users/${id}/kyc-report`, formData);
65
57
  return data;
66
58
  });
67
59
  }
@@ -122,12 +114,6 @@ class RioClient {
122
114
  return data;
123
115
  });
124
116
  }
125
- getBusinessUser() {
126
- return __awaiter(this, void 0, void 0, function* () {
127
- const { data } = yield this.axios.get("/api/business/users");
128
- return data;
129
- });
130
- }
131
117
  createUser(user) {
132
118
  return __awaiter(this, void 0, void 0, function* () {
133
119
  yield this.axios.post("/api/users", user);
@@ -146,12 +132,6 @@ class RioClient {
146
132
  });
147
133
  });
148
134
  }
149
- createBusinessUser(businessUser) {
150
- return __awaiter(this, void 0, void 0, function* () {
151
- const response = yield this.axios.post("/api/business/users", businessUser);
152
- return response.data;
153
- });
154
- }
155
135
  sendPhoneAuthCode(phoneNumber) {
156
136
  return __awaiter(this, void 0, void 0, function* () {
157
137
  yield this.axios.post("/api/auth/phone/send", {
@@ -1,3 +1,3 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { BusinessUser } from "../types/business-user";
3
- export declare const getUserFromClientHelper: (client: AxiosInstance, includeDeleted?: boolean) => Promise<BusinessUser | null>;
2
+ import { User } from "../types/user";
3
+ export declare const getUserFromClientHelper: (client: AxiosInstance, includeDeleted?: boolean) => Promise<User | null>;
@@ -14,21 +14,13 @@ const rio_client_1 = require("../clients/rio-client");
14
14
  const user_attribute_1 = require("../types/user-attribute");
15
15
  const getUserFromClientHelper = (client, includeDeleted) => __awaiter(void 0, void 0, void 0, function* () {
16
16
  var _a;
17
- let individualUser;
18
- let businessUser;
17
+ let user;
19
18
  try {
20
- individualUser = yield new rio_client_1.RioClient(client).getUser();
19
+ user = yield new rio_client_1.RioClient(client).getUser();
21
20
  }
22
21
  catch (error) {
23
- individualUser = null;
22
+ user = null;
24
23
  }
25
- try {
26
- businessUser = yield new rio_client_1.RioClient(client).getBusinessUser();
27
- }
28
- catch (error) {
29
- businessUser = null;
30
- }
31
- const user = individualUser || businessUser;
32
24
  if (includeDeleted) {
33
25
  return user;
34
26
  }
package/build/index.d.ts CHANGED
@@ -117,9 +117,6 @@ export * from "./types/rio-env";
117
117
  export * from "./types/bank-payout";
118
118
  export * from "./types/checked-address";
119
119
  export * from "./types/address-check-result";
120
- export * from "./types/business-user";
121
- export * from "./types/business-user-input";
122
- export * from "./types/business-user-update";
123
120
  export * from "./types/user-type";
124
121
  export * from "./types/platform-fee-range";
125
122
  export * from "./types/api-key";
package/build/index.js CHANGED
@@ -133,9 +133,6 @@ __exportStar(require("./types/rio-env"), exports);
133
133
  __exportStar(require("./types/bank-payout"), exports);
134
134
  __exportStar(require("./types/checked-address"), exports);
135
135
  __exportStar(require("./types/address-check-result"), exports);
136
- __exportStar(require("./types/business-user"), exports);
137
- __exportStar(require("./types/business-user-input"), exports);
138
- __exportStar(require("./types/business-user-update"), exports);
139
136
  __exportStar(require("./types/user-type"), exports);
140
137
  __exportStar(require("./types/platform-fee-range"), exports);
141
138
  __exportStar(require("./types/api-key"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.609",
3
+ "version": "1.0.614",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -1,27 +0,0 @@
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
- export interface BusinessUserInput {
8
- authIds?: string[];
9
- companyName: string;
10
- legalRepresentative: string;
11
- phoneNumber?: string;
12
- email: string;
13
- street1: string;
14
- street2?: string;
15
- city: string;
16
- state: USState | string;
17
- postalCode: string;
18
- country: Country;
19
- language: Language;
20
- cpf?: string;
21
- kycStatus?: KYCStatus;
22
- COIFile?: string;
23
- KYCReportFile?: string;
24
- attributes?: UserAttribute[];
25
- brokerId?: string;
26
- platformFeeRanges?: PlatformFeeRange[];
27
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,26 +0,0 @@
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 { UserAttribute } from "./user-attribute";
6
- export interface BusinessUserUpdate {
7
- authIds?: string[];
8
- companyName?: string;
9
- legalRepresentative?: string;
10
- phoneNumber?: string;
11
- email?: string;
12
- street1?: string;
13
- street2?: string;
14
- city?: string;
15
- state?: string;
16
- postalCode?: string;
17
- cpf?: string;
18
- country?: Country;
19
- kycStatus?: KYCStatus;
20
- language?: Language;
21
- COIFile?: string;
22
- KYCReportFile?: string;
23
- attributes?: UserAttribute[];
24
- brokerId?: string;
25
- platformFeeRanges?: PlatformFeeRange[];
26
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,30 +0,0 @@
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
- authIds?: 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
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });