@morambacrypto/connect 0.0.12 → 0.0.13
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.
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { HttpClient } from "../client/HttpClient";
|
|
2
|
-
import { CreateCompanyPayload, CreateCompanyResponse } from "../types/company.types";
|
|
2
|
+
import { CreateCompanyPayload, CreateCompanyResponse, UpdateCompanyEmailPayload, UpdateCompanyEmailResponse, GetCompaniesQuery, GetCompaniesResponse, UpdateCompanyPaymentPayload, UpdateCompanyPaymentResponse } from "../types/company.types";
|
|
3
3
|
export declare class CompanyAPI {
|
|
4
4
|
private http;
|
|
5
5
|
private partnerId;
|
|
6
6
|
private apiKey;
|
|
7
7
|
constructor(http: HttpClient, partnerId: string, apiKey: string);
|
|
8
8
|
createCompany(payload: CreateCompanyPayload, jwtToken: string): Promise<CreateCompanyResponse>;
|
|
9
|
+
updateCompanyEmail(payload: UpdateCompanyEmailPayload, jwtToken: string): Promise<UpdateCompanyEmailResponse>;
|
|
10
|
+
getCompaniesByPartner(jwtToken: string, query?: GetCompaniesQuery): Promise<GetCompaniesResponse>;
|
|
11
|
+
updateCompanyPaymentMethod(payload: UpdateCompanyPaymentPayload, jwtToken: string): Promise<UpdateCompanyPaymentResponse>;
|
|
9
12
|
}
|
package/dist/apis/company.api.js
CHANGED
|
@@ -14,4 +14,36 @@ export class CompanyAPI {
|
|
|
14
14
|
Authorization: `Bearer ${jwtToken}`,
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
+
updateCompanyEmail(payload, jwtToken) {
|
|
18
|
+
const fullBody = {
|
|
19
|
+
...payload,
|
|
20
|
+
partner_id: this.partnerId,
|
|
21
|
+
api_key: this.apiKey,
|
|
22
|
+
};
|
|
23
|
+
return this.http.patch("/api/v1/morambacypto/update/company/email", fullBody, {
|
|
24
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
getCompaniesByPartner(jwtToken, query = {}) {
|
|
28
|
+
const params = new URLSearchParams();
|
|
29
|
+
if (query.limit)
|
|
30
|
+
params.append("limit", String(query.limit));
|
|
31
|
+
if (query.direction)
|
|
32
|
+
params.append("direction", query.direction);
|
|
33
|
+
if (query.cursor)
|
|
34
|
+
params.append("cursor", query.cursor);
|
|
35
|
+
return this.http.get(`/api/v1/morambacypto/companies/partner/${this.partnerId}?${params.toString()}`, {
|
|
36
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
updateCompanyPaymentMethod(payload, jwtToken) {
|
|
40
|
+
const fullBody = {
|
|
41
|
+
...payload,
|
|
42
|
+
partner_id: this.partnerId,
|
|
43
|
+
api_key: this.apiKey,
|
|
44
|
+
};
|
|
45
|
+
return this.http.patch("/api/v1/morambacypto/update/company/payment", fullBody, {
|
|
46
|
+
Authorization: `Bearer ${jwtToken}`,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
17
49
|
}
|
|
@@ -8,5 +8,6 @@ export declare class HttpClient {
|
|
|
8
8
|
get axiosInstance(): AxiosInstance;
|
|
9
9
|
private setupRetryInterceptor;
|
|
10
10
|
post<T = any>(url: string, data: any, extraHeaders?: Record<string, string>): Promise<T>;
|
|
11
|
-
|
|
11
|
+
patch<T = any>(url: string, data: any, extraHeaders?: Record<string, string>): Promise<T>;
|
|
12
|
+
get<T = any>(url: string, extraHeaders?: Record<string, string>): Promise<T>;
|
|
12
13
|
}
|
|
@@ -39,7 +39,14 @@ export class HttpClient {
|
|
|
39
39
|
.post(url, data, { headers: extraHeaders })
|
|
40
40
|
.then((res) => res.data);
|
|
41
41
|
}
|
|
42
|
-
|
|
43
|
-
return this.client
|
|
42
|
+
patch(url, data, extraHeaders = {}) {
|
|
43
|
+
return this.client
|
|
44
|
+
.patch(url, data, { headers: extraHeaders })
|
|
45
|
+
.then((res) => res.data);
|
|
46
|
+
}
|
|
47
|
+
get(url, extraHeaders = {}) {
|
|
48
|
+
return this.client
|
|
49
|
+
.get(url, { headers: extraHeaders })
|
|
50
|
+
.then((res) => res.data);
|
|
44
51
|
}
|
|
45
52
|
}
|
|
@@ -21,3 +21,57 @@ export interface CreateCompanyResponse {
|
|
|
21
21
|
message: string;
|
|
22
22
|
data: CompanyData | null;
|
|
23
23
|
}
|
|
24
|
+
export interface UpdateCompanyEmailPayload {
|
|
25
|
+
company_id: string;
|
|
26
|
+
email: string;
|
|
27
|
+
}
|
|
28
|
+
export interface UpdateCompanyEmailResponse {
|
|
29
|
+
success: boolean;
|
|
30
|
+
message: string;
|
|
31
|
+
data: CompanyData | null;
|
|
32
|
+
}
|
|
33
|
+
export interface GetCompaniesQuery {
|
|
34
|
+
limit?: number;
|
|
35
|
+
direction?: "forward" | "backward";
|
|
36
|
+
cursor?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface CompanyListItem {
|
|
39
|
+
id: string;
|
|
40
|
+
name: string;
|
|
41
|
+
email: string;
|
|
42
|
+
partner_id: string;
|
|
43
|
+
network: string;
|
|
44
|
+
token: string;
|
|
45
|
+
address: string;
|
|
46
|
+
created_at: string;
|
|
47
|
+
updated_at: string;
|
|
48
|
+
}
|
|
49
|
+
export interface PaginationData {
|
|
50
|
+
has_next: boolean;
|
|
51
|
+
has_previous: boolean;
|
|
52
|
+
next_cursor: string;
|
|
53
|
+
previous_cursor: string;
|
|
54
|
+
limit: number;
|
|
55
|
+
total_returned: number;
|
|
56
|
+
}
|
|
57
|
+
export interface GetCompaniesResponse {
|
|
58
|
+
success: boolean;
|
|
59
|
+
message: string;
|
|
60
|
+
data: {
|
|
61
|
+
companies: CompanyListItem[];
|
|
62
|
+
pagination: PaginationData;
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export interface UpdateCompanyPaymentPayload {
|
|
66
|
+
company_id: string;
|
|
67
|
+
payment_method: {
|
|
68
|
+
network: string;
|
|
69
|
+
token: string;
|
|
70
|
+
address: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
export interface UpdateCompanyPaymentResponse {
|
|
74
|
+
success: boolean;
|
|
75
|
+
message: string;
|
|
76
|
+
data: CompanyData | null;
|
|
77
|
+
}
|