washday-sdk 1.4.0 → 1.4.2
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/dist/api/index.js +8 -6
- package/dist/api/integrations/get.js +15 -1
- package/dist/api/integrations/post.js +14 -0
- package/package.json +1 -1
- package/src/api/index.ts +8 -6
- package/src/api/integrations/get.ts +19 -1
- package/src/api/integrations/post.ts +15 -0
- package/src/interfaces/Api.ts +3 -1
package/dist/api/index.js
CHANGED
|
@@ -327,12 +327,14 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD') {
|
|
|
327
327
|
this.integrations = bindMethods(this, {
|
|
328
328
|
getMPConnectionStatus: integrationsEndpoints.getModule.getMPConnectionStatus,
|
|
329
329
|
startMPOAuthFlow: integrationsEndpoints.postModule.startMPOAuthFlow,
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
330
|
+
});
|
|
331
|
+
this.integrations.mercadoPago = bindMethods(this, {
|
|
332
|
+
getDiscoverMPTerminals: integrationsEndpoints.getModule.getDiscoverMPTerminals,
|
|
333
|
+
importMPTerminal: integrationsEndpoints.postModule.importMPTerminal,
|
|
334
|
+
getStoredMPTerminals: integrationsEndpoints.getModule.getStoredMPTerminals,
|
|
335
|
+
disconnectMP: integrationsEndpoints.postModule.disconnectMP,
|
|
336
|
+
getMPUsersStores: integrationsEndpoints.getModule.getMPUsersStores,
|
|
337
|
+
importAllMPTerminals: integrationsEndpoints.postModule.importAllMPTerminals
|
|
336
338
|
});
|
|
337
339
|
};
|
|
338
340
|
export default WashdayClient;
|
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
const BASE_ROUTER = 'api/integrations';
|
|
11
|
+
const BASE_ROUTER_MP = 'api/mercadopago';
|
|
11
12
|
export const getMPConnectionStatus = function () {
|
|
12
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
14
|
try {
|
|
@@ -34,7 +35,7 @@ export const getDiscoverMPTerminals = function (_a) {
|
|
|
34
35
|
}
|
|
35
36
|
});
|
|
36
37
|
};
|
|
37
|
-
export const
|
|
38
|
+
export const getStoredMPTerminals = function (_a) {
|
|
38
39
|
return __awaiter(this, arguments, void 0, function* ({ storeId }) {
|
|
39
40
|
try {
|
|
40
41
|
const config = {
|
|
@@ -47,3 +48,16 @@ export const getMPTerminals = function (_a) {
|
|
|
47
48
|
}
|
|
48
49
|
});
|
|
49
50
|
};
|
|
51
|
+
export const getMPUsersStores = function (_a) {
|
|
52
|
+
return __awaiter(this, arguments, void 0, function* ({ user_id }) {
|
|
53
|
+
try {
|
|
54
|
+
const config = {
|
|
55
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
56
|
+
};
|
|
57
|
+
return yield this.axiosInstance.get(`${BASE_ROUTER_MP}/users/stores?user_id=${user_id}`, config);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
@@ -53,3 +53,17 @@ export const importMPTerminal = function (data) {
|
|
|
53
53
|
}
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
|
+
export const importAllMPTerminals = function (data) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
try {
|
|
59
|
+
const config = {
|
|
60
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
61
|
+
};
|
|
62
|
+
console.log('from washday-sdk importAllMPTerminals body', data);
|
|
63
|
+
return yield this.axiosInstance.post(`${BASE_ROUTER}/mp/terminals/importAll`, data, config);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -334,12 +334,14 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
334
334
|
this.integrations = bindMethods(this, {
|
|
335
335
|
getMPConnectionStatus: integrationsEndpoints.getModule.getMPConnectionStatus,
|
|
336
336
|
startMPOAuthFlow: integrationsEndpoints.postModule.startMPOAuthFlow,
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
337
|
+
});
|
|
338
|
+
this.integrations.mercadoPago = bindMethods(this, {
|
|
339
|
+
getDiscoverMPTerminals: integrationsEndpoints.getModule.getDiscoverMPTerminals,
|
|
340
|
+
importMPTerminal: integrationsEndpoints.postModule.importMPTerminal,
|
|
341
|
+
getStoredMPTerminals: integrationsEndpoints.getModule.getStoredMPTerminals,
|
|
342
|
+
disconnectMP: integrationsEndpoints.postModule.disconnectMP,
|
|
343
|
+
getMPUsersStores: integrationsEndpoints.getModule.getMPUsersStores,
|
|
344
|
+
importAllMPTerminals: integrationsEndpoints.postModule.importAllMPTerminals
|
|
343
345
|
});
|
|
344
346
|
} as any;
|
|
345
347
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
|
|
3
3
|
const BASE_ROUTER = 'api/integrations';
|
|
4
|
+
const BASE_ROUTER_MP = 'api/mercadopago';
|
|
4
5
|
|
|
5
6
|
export const getMPConnectionStatus = async function (this: WashdayClientInstance): Promise<any> {
|
|
6
7
|
try {
|
|
@@ -30,7 +31,7 @@ export const getDiscoverMPTerminals = async function (this: WashdayClientInstanc
|
|
|
30
31
|
}
|
|
31
32
|
};
|
|
32
33
|
|
|
33
|
-
export const
|
|
34
|
+
export const getStoredMPTerminals = async function (this: WashdayClientInstance, {
|
|
34
35
|
storeId
|
|
35
36
|
}: {
|
|
36
37
|
storeId: string;
|
|
@@ -45,3 +46,20 @@ export const getMPTerminals = async function (this: WashdayClientInstance, {
|
|
|
45
46
|
throw error;
|
|
46
47
|
}
|
|
47
48
|
};
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
export const getMPUsersStores = async function (this: WashdayClientInstance, {
|
|
52
|
+
user_id
|
|
53
|
+
}: {
|
|
54
|
+
user_id: string;
|
|
55
|
+
}): Promise<any> {
|
|
56
|
+
try {
|
|
57
|
+
const config = {
|
|
58
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
59
|
+
};
|
|
60
|
+
return await this.axiosInstance.get(`${BASE_ROUTER_MP}/users/stores?user_id=${user_id}`, config);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
@@ -50,4 +50,19 @@ export const importMPTerminal = async function (this: WashdayClientInstance, dat
|
|
|
50
50
|
catch (error) {
|
|
51
51
|
throw error;
|
|
52
52
|
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const importAllMPTerminals = async function (this: WashdayClientInstance, data: {
|
|
56
|
+
storeId: string;
|
|
57
|
+
}): Promise<any> {
|
|
58
|
+
try {
|
|
59
|
+
const config = {
|
|
60
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
61
|
+
};
|
|
62
|
+
console.log('from washday-sdk importAllMPTerminals body', data);
|
|
63
|
+
return await this.axiosInstance.post(`${BASE_ROUTER}/mp/terminals/importAll`, data, config);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
53
68
|
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -320,8 +320,10 @@ export interface WashdayClientInstance {
|
|
|
320
320
|
mercadoPago: {
|
|
321
321
|
getDiscoverMPTerminals: typeof integrationsEndpoints.getModule.getDiscoverMPTerminals;
|
|
322
322
|
importMPTerminal: typeof integrationsEndpoints.postModule.importMPTerminal;
|
|
323
|
-
|
|
323
|
+
getStoredMPTerminals: typeof integrationsEndpoints.getModule.getStoredMPTerminals;
|
|
324
324
|
disconnectMP: typeof integrationsEndpoints.postModule.disconnectMP;
|
|
325
|
+
getMPUsersStores: typeof integrationsEndpoints.getModule.getMPUsersStores;
|
|
326
|
+
importAllMPTerminals: typeof integrationsEndpoints.postModule.importAllMPTerminals;
|
|
325
327
|
}
|
|
326
328
|
};
|
|
327
329
|
}
|