washday-sdk 1.4.2 → 1.5.1
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 +3 -1
- package/dist/api/integrations/post.js +27 -0
- package/package.json +1 -1
- package/src/api/index.ts +3 -1
- package/src/api/integrations/post.ts +34 -1
- package/src/interfaces/Api.ts +2 -0
package/dist/api/index.js
CHANGED
|
@@ -334,7 +334,9 @@ const WashdayClient = function WashdayClient(apiToken, env = 'PROD') {
|
|
|
334
334
|
getStoredMPTerminals: integrationsEndpoints.getModule.getStoredMPTerminals,
|
|
335
335
|
disconnectMP: integrationsEndpoints.postModule.disconnectMP,
|
|
336
336
|
getMPUsersStores: integrationsEndpoints.getModule.getMPUsersStores,
|
|
337
|
-
importAllMPTerminals: integrationsEndpoints.postModule.importAllMPTerminals
|
|
337
|
+
importAllMPTerminals: integrationsEndpoints.postModule.importAllMPTerminals,
|
|
338
|
+
createMPAttempt: integrationsEndpoints.postModule.createMPAttempt,
|
|
339
|
+
cancelMPAttempt: integrationsEndpoints.postModule.cancelMPAttempt
|
|
338
340
|
});
|
|
339
341
|
};
|
|
340
342
|
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_ATTEMPTS = 'api/payments/mp/attempts';
|
|
11
12
|
export const startMPOAuthFlow = function (data) {
|
|
12
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13
14
|
try {
|
|
@@ -67,3 +68,29 @@ export const importAllMPTerminals = function (data) {
|
|
|
67
68
|
}
|
|
68
69
|
});
|
|
69
70
|
};
|
|
71
|
+
export const createMPAttempt = 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_ATTEMPTS}`, data, config);
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
export const cancelMPAttempt = function (data) {
|
|
85
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
try {
|
|
87
|
+
const config = {
|
|
88
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
89
|
+
};
|
|
90
|
+
return yield this.axiosInstance.post(`${BASE_ROUTER_MP_ATTEMPTS}/${data.attemptId}/cancel`, data, config);
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
throw error;
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
};
|
package/package.json
CHANGED
package/src/api/index.ts
CHANGED
|
@@ -341,7 +341,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
341
341
|
getStoredMPTerminals: integrationsEndpoints.getModule.getStoredMPTerminals,
|
|
342
342
|
disconnectMP: integrationsEndpoints.postModule.disconnectMP,
|
|
343
343
|
getMPUsersStores: integrationsEndpoints.getModule.getMPUsersStores,
|
|
344
|
-
importAllMPTerminals: integrationsEndpoints.postModule.importAllMPTerminals
|
|
344
|
+
importAllMPTerminals: integrationsEndpoints.postModule.importAllMPTerminals,
|
|
345
|
+
createMPAttempt: integrationsEndpoints.postModule.createMPAttempt,
|
|
346
|
+
cancelMPAttempt: integrationsEndpoints.postModule.cancelMPAttempt
|
|
345
347
|
});
|
|
346
348
|
} as any;
|
|
347
349
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
2
|
|
|
3
3
|
const BASE_ROUTER = 'api/integrations';
|
|
4
|
-
|
|
4
|
+
const BASE_ROUTER_MP_ATTEMPTS = 'api/payments/mp/attempts';
|
|
5
5
|
|
|
6
6
|
export const startMPOAuthFlow = async function (this: WashdayClientInstance, data: {
|
|
7
7
|
redirectUri: string;
|
|
@@ -65,4 +65,37 @@ export const importAllMPTerminals = async function (this: WashdayClientInstance,
|
|
|
65
65
|
catch (error) {
|
|
66
66
|
throw error;
|
|
67
67
|
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const createMPAttempt = async function (this: WashdayClientInstance, data: {
|
|
71
|
+
orderId: string;
|
|
72
|
+
amount: number;
|
|
73
|
+
currency: string;
|
|
74
|
+
storeId: string;
|
|
75
|
+
terminalId: string;
|
|
76
|
+
cashierBoxId: string;
|
|
77
|
+
}): Promise<any> {
|
|
78
|
+
try {
|
|
79
|
+
const config = {
|
|
80
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
81
|
+
};
|
|
82
|
+
return await this.axiosInstance.post(`${BASE_ROUTER_MP_ATTEMPTS}`, data, config);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
throw error;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export const cancelMPAttempt = async function (this: WashdayClientInstance, data: {
|
|
90
|
+
attemptId: string;
|
|
91
|
+
}): Promise<any> {
|
|
92
|
+
try {
|
|
93
|
+
const config = {
|
|
94
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
95
|
+
};
|
|
96
|
+
return await this.axiosInstance.post(`${BASE_ROUTER_MP_ATTEMPTS}/${data.attemptId}/cancel`, data, config);
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
68
101
|
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -324,6 +324,8 @@ export interface WashdayClientInstance {
|
|
|
324
324
|
disconnectMP: typeof integrationsEndpoints.postModule.disconnectMP;
|
|
325
325
|
getMPUsersStores: typeof integrationsEndpoints.getModule.getMPUsersStores;
|
|
326
326
|
importAllMPTerminals: typeof integrationsEndpoints.postModule.importAllMPTerminals;
|
|
327
|
+
createMPAttempt: typeof integrationsEndpoints.postModule.createMPAttempt;
|
|
328
|
+
cancelMPAttempt: typeof integrationsEndpoints.postModule.cancelMPAttempt;
|
|
327
329
|
}
|
|
328
330
|
};
|
|
329
331
|
}
|