washday-sdk 1.5.1 → 1.5.3

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
@@ -336,7 +336,9 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD') {
336
336
  getMPUsersStores: integrationsEndpoints.getModule.getMPUsersStores,
337
337
  importAllMPTerminals: integrationsEndpoints.postModule.importAllMPTerminals,
338
338
  createMPAttempt: integrationsEndpoints.postModule.createMPAttempt,
339
- cancelMPAttempt: integrationsEndpoints.postModule.cancelMPAttempt
339
+ cancelMPAttempt: integrationsEndpoints.postModule.cancelMPAttempt,
340
+ getMPAttemptStatus: integrationsEndpoints.getModule.getMPAttemptStatus,
341
+ updateMPTerminalOperationMode: integrationsEndpoints.postModule.updateMPTerminalOperationMode,
340
342
  });
341
343
  };
342
344
  export default WashdayClient;
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  const BASE_ROUTER = 'api/integrations';
11
11
  const BASE_ROUTER_MP = 'api/mercadopago';
12
+ const BASE_ROUTER_MP_ATTEMPTS = 'api/payments/mp/attempts';
12
13
  export const getMPConnectionStatus = function () {
13
14
  return __awaiter(this, void 0, void 0, function* () {
14
15
  try {
@@ -61,3 +62,16 @@ export const getMPUsersStores = function (_a) {
61
62
  }
62
63
  });
63
64
  };
65
+ export const getMPAttemptStatus = function (_a) {
66
+ return __awaiter(this, arguments, void 0, function* ({ attemptId }) {
67
+ try {
68
+ const config = {
69
+ headers: { Authorization: `Bearer ${this.apiToken}` }
70
+ };
71
+ return yield this.axiosInstance.get(`${BASE_ROUTER_MP_ATTEMPTS}/${attemptId}/status`, config);
72
+ }
73
+ catch (error) {
74
+ throw error;
75
+ }
76
+ });
77
+ };
@@ -68,6 +68,19 @@ export const importAllMPTerminals = function (data) {
68
68
  }
69
69
  });
70
70
  };
71
+ export const updateMPTerminalOperationMode = function (data) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ try {
74
+ const config = {
75
+ headers: { Authorization: `Bearer ${this.apiToken}` }
76
+ };
77
+ return yield this.axiosInstance.post(`${BASE_ROUTER}/mp/terminals/updateOperationMode`, data, config);
78
+ }
79
+ catch (error) {
80
+ throw error;
81
+ }
82
+ });
83
+ };
71
84
  export const createMPAttempt = function (data) {
72
85
  return __awaiter(this, void 0, void 0, function* () {
73
86
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
package/src/api/index.ts CHANGED
@@ -343,7 +343,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
343
343
  getMPUsersStores: integrationsEndpoints.getModule.getMPUsersStores,
344
344
  importAllMPTerminals: integrationsEndpoints.postModule.importAllMPTerminals,
345
345
  createMPAttempt: integrationsEndpoints.postModule.createMPAttempt,
346
- cancelMPAttempt: integrationsEndpoints.postModule.cancelMPAttempt
346
+ cancelMPAttempt: integrationsEndpoints.postModule.cancelMPAttempt,
347
+ getMPAttemptStatus: integrationsEndpoints.getModule.getMPAttemptStatus,
348
+ updateMPTerminalOperationMode: integrationsEndpoints.postModule.updateMPTerminalOperationMode,
347
349
  });
348
350
  } as any;
349
351
 
@@ -2,6 +2,7 @@ import { WashdayClientInstance } from "../../interfaces/Api";
2
2
 
3
3
  const BASE_ROUTER = 'api/integrations';
4
4
  const BASE_ROUTER_MP = 'api/mercadopago';
5
+ const BASE_ROUTER_MP_ATTEMPTS = 'api/payments/mp/attempts';
5
6
 
6
7
  export const getMPConnectionStatus = async function (this: WashdayClientInstance): Promise<any> {
7
8
  try {
@@ -62,4 +63,20 @@ export const getMPUsersStores = async function (this: WashdayClientInstance, {
62
63
  catch (error) {
63
64
  throw error;
64
65
  }
66
+ };
67
+
68
+ export const getMPAttemptStatus = async function (this: WashdayClientInstance, {
69
+ attemptId
70
+ }: {
71
+ attemptId: string;
72
+ }): Promise<any> {
73
+ try {
74
+ const config = {
75
+ headers: { Authorization: `Bearer ${this.apiToken}` }
76
+ };
77
+ return await this.axiosInstance.get(`${BASE_ROUTER_MP_ATTEMPTS}/${attemptId}/status`, config);
78
+ }
79
+ catch (error) {
80
+ throw error;
81
+ }
65
82
  };
@@ -67,6 +67,22 @@ export const importAllMPTerminals = async function (this: WashdayClientInstance,
67
67
  }
68
68
  };
69
69
 
70
+ export const updateMPTerminalOperationMode = async function (this: WashdayClientInstance, data: {
71
+ storeId: string;
72
+ mp_terminal_id: string;
73
+ operatingMode: string;
74
+ }): Promise<any> {
75
+ try {
76
+ const config = {
77
+ headers: { Authorization: `Bearer ${this.apiToken}` }
78
+ };
79
+ return await this.axiosInstance.post(`${BASE_ROUTER}/mp/terminals/updateOperationMode`, data, config);
80
+ }
81
+ catch (error) {
82
+ throw error;
83
+ }
84
+ };
85
+
70
86
  export const createMPAttempt = async function (this: WashdayClientInstance, data: {
71
87
  orderId: string;
72
88
  amount: number;
@@ -326,6 +326,8 @@ export interface WashdayClientInstance {
326
326
  importAllMPTerminals: typeof integrationsEndpoints.postModule.importAllMPTerminals;
327
327
  createMPAttempt: typeof integrationsEndpoints.postModule.createMPAttempt;
328
328
  cancelMPAttempt: typeof integrationsEndpoints.postModule.cancelMPAttempt;
329
+ getMPAttemptStatus: typeof integrationsEndpoints.getModule.getMPAttemptStatus;
330
+ updateMPTerminalOperationMode: typeof integrationsEndpoints.postModule.updateMPTerminalOperationMode;
329
331
  }
330
332
  };
331
333
  }