washday-sdk 1.3.0 → 1.4.0

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 CHANGED
@@ -327,7 +327,12 @@ 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
- disconnectMP: integrationsEndpoints.postModule.disconnectMP,
330
+ mercadoPago: {
331
+ getDiscoverMPTerminals: integrationsEndpoints.getModule.getDiscoverMPTerminals,
332
+ importMPTerminal: integrationsEndpoints.postModule.importMPTerminal,
333
+ getMPTerminals: integrationsEndpoints.getModule.getMPTerminals,
334
+ disconnectMP: integrationsEndpoints.postModule.disconnectMP
335
+ }
331
336
  });
332
337
  };
333
338
  export default WashdayClient;
@@ -21,3 +21,29 @@ export const getMPConnectionStatus = function () {
21
21
  }
22
22
  });
23
23
  };
24
+ export const getDiscoverMPTerminals = function (_a) {
25
+ return __awaiter(this, arguments, void 0, function* ({ mp_store_id }) {
26
+ try {
27
+ const config = {
28
+ headers: { Authorization: `Bearer ${this.apiToken}` }
29
+ };
30
+ return yield this.axiosInstance.get(`${BASE_ROUTER}/mp/terminals/discover?mp_store_id=${mp_store_id}`, config);
31
+ }
32
+ catch (error) {
33
+ throw error;
34
+ }
35
+ });
36
+ };
37
+ export const getMPTerminals = function (_a) {
38
+ return __awaiter(this, arguments, void 0, function* ({ storeId }) {
39
+ try {
40
+ const config = {
41
+ headers: { Authorization: `Bearer ${this.apiToken}` }
42
+ };
43
+ return yield this.axiosInstance.get(`${BASE_ROUTER}/mp/terminals?storeId=${storeId}`, config);
44
+ }
45
+ catch (error) {
46
+ throw error;
47
+ }
48
+ });
49
+ };
@@ -34,3 +34,22 @@ export const disconnectMP = function () {
34
34
  }
35
35
  });
36
36
  };
37
+ export const importMPTerminal = function (data) {
38
+ return __awaiter(this, void 0, void 0, function* () {
39
+ try {
40
+ if (!data.storeId) {
41
+ throw new Error('storeId is required');
42
+ }
43
+ if (!data.mp_pos_id) {
44
+ throw new Error('mp_pos_id is required');
45
+ }
46
+ const config = {
47
+ headers: { Authorization: `Bearer ${this.apiToken}` }
48
+ };
49
+ return yield this.axiosInstance.post(`${BASE_ROUTER}/mp/terminals/import`, data, config);
50
+ }
51
+ catch (error) {
52
+ throw error;
53
+ }
54
+ });
55
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -334,7 +334,12 @@ 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
- disconnectMP: integrationsEndpoints.postModule.disconnectMP,
337
+ mercadoPago: {
338
+ getDiscoverMPTerminals: integrationsEndpoints.getModule.getDiscoverMPTerminals,
339
+ importMPTerminal: integrationsEndpoints.postModule.importMPTerminal,
340
+ getMPTerminals: integrationsEndpoints.getModule.getMPTerminals,
341
+ disconnectMP: integrationsEndpoints.postModule.disconnectMP
342
+ }
338
343
  });
339
344
  } as any;
340
345
 
@@ -13,3 +13,35 @@ export const getMPConnectionStatus = async function (this: WashdayClientInstance
13
13
  throw error;
14
14
  }
15
15
  };
16
+
17
+ export const getDiscoverMPTerminals = async function (this: WashdayClientInstance, {
18
+ mp_store_id
19
+ }: {
20
+ mp_store_id: string;
21
+ }): Promise<any> {
22
+ try {
23
+ const config = {
24
+ headers: { Authorization: `Bearer ${this.apiToken}` }
25
+ };
26
+ return await this.axiosInstance.get(`${BASE_ROUTER}/mp/terminals/discover?mp_store_id=${mp_store_id}`, config);
27
+ }
28
+ catch (error) {
29
+ throw error;
30
+ }
31
+ };
32
+
33
+ export const getMPTerminals = async function (this: WashdayClientInstance, {
34
+ storeId
35
+ }: {
36
+ storeId: string;
37
+ }): Promise<any> {
38
+ try {
39
+ const config = {
40
+ headers: { Authorization: `Bearer ${this.apiToken}` }
41
+ };
42
+ return await this.axiosInstance.get(`${BASE_ROUTER}/mp/terminals?storeId=${storeId}`, config);
43
+ }
44
+ catch (error) {
45
+ throw error;
46
+ }
47
+ };
@@ -27,4 +27,27 @@ export const disconnectMP = async function (this: WashdayClientInstance): Promis
27
27
  catch (error) {
28
28
  throw error;
29
29
  }
30
+ };
31
+
32
+ export const importMPTerminal = async function (this: WashdayClientInstance, data: {
33
+ storeId: string;
34
+ mp_pos_id: string;
35
+ label?: string;
36
+ mp_store_id?: string;
37
+ }): Promise<any> {
38
+ try {
39
+ if (!data.storeId) {
40
+ throw new Error('storeId is required');
41
+ }
42
+ if (!data.mp_pos_id) {
43
+ throw new Error('mp_pos_id is required');
44
+ }
45
+ const config = {
46
+ headers: { Authorization: `Bearer ${this.apiToken}` }
47
+ };
48
+ return await this.axiosInstance.post(`${BASE_ROUTER}/mp/terminals/import`, data, config);
49
+ }
50
+ catch (error) {
51
+ throw error;
52
+ }
30
53
  };
@@ -317,6 +317,11 @@ export interface WashdayClientInstance {
317
317
  integrations: {
318
318
  getMPConnectionStatus: typeof integrationsEndpoints.getModule.getMPConnectionStatus;
319
319
  startMPOAuthFlow: typeof integrationsEndpoints.postModule.startMPOAuthFlow;
320
- disconnectMP: typeof integrationsEndpoints.postModule.disconnectMP;
320
+ mercadoPago: {
321
+ getDiscoverMPTerminals: typeof integrationsEndpoints.getModule.getDiscoverMPTerminals;
322
+ importMPTerminal: typeof integrationsEndpoints.postModule.importMPTerminal;
323
+ getMPTerminals: typeof integrationsEndpoints.getModule.getMPTerminals;
324
+ disconnectMP: typeof integrationsEndpoints.postModule.disconnectMP;
325
+ }
321
326
  };
322
327
  }