washday-sdk 0.0.127 → 0.0.129
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/discounts/put.js +14 -0
- package/dist/api/index.js +5 -1
- package/dist/api/order/put.js +42 -0
- package/dist/utils/index.js +1 -1
- package/package.json +1 -1
- package/src/api/discounts/put.ts +16 -1
- package/src/api/index.ts +5 -1
- package/src/api/order/put.ts +47 -0
- package/src/interfaces/Api.ts +5 -1
- package/src/utils/index.ts +4 -1
|
@@ -38,3 +38,17 @@ export const deleteAutomaticDiscountById = function (storeId, discountId) {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
};
|
|
41
|
+
export const updateAutomaticDiscountById = function (storeId, discountId, data) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
const config = {
|
|
45
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
46
|
+
};
|
|
47
|
+
return yield axiosInstance.put(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, data, config);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error('Error fetching updateById:', error);
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
};
|
package/dist/api/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } fr
|
|
|
8
8
|
import { getCountries } from "./countries/get";
|
|
9
9
|
import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
|
|
10
10
|
import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
|
|
11
|
-
import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
|
|
11
|
+
import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById } from "./discounts/put";
|
|
12
12
|
import { deleteStoreStaffById } from "./staff/delete";
|
|
13
13
|
import { getStoreStaff, getStoreStaffById } from "./staff/get";
|
|
14
14
|
import { createStoreStaff } from "./staff/post";
|
|
@@ -100,6 +100,9 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
100
100
|
getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
|
|
101
101
|
setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
|
|
102
102
|
getRequestedOrdersSummary: ordersEndpoints.getModule.getRequestedOrdersSummary,
|
|
103
|
+
bulkCancel: ordersEndpoints.putModule.bulkCancel,
|
|
104
|
+
bulkClean: ordersEndpoints.putModule.bulkClean,
|
|
105
|
+
bulkCollect: ordersEndpoints.putModule.bulkCollect
|
|
103
106
|
});
|
|
104
107
|
this.customers = bindMethods(this, {
|
|
105
108
|
getCustomers: customersEndpoints.getModule.getList,
|
|
@@ -210,6 +213,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
210
213
|
getAutomaticDiscountById: getAutomaticDiscountById,
|
|
211
214
|
createAutomaticDiscount: createAutomaticDiscount,
|
|
212
215
|
deleteAutomaticDiscountById: deleteAutomaticDiscountById,
|
|
216
|
+
updateAutomaticDiscountById: updateAutomaticDiscountById,
|
|
213
217
|
});
|
|
214
218
|
this.csv = bindMethods(this, {
|
|
215
219
|
exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
|
package/dist/api/order/put.js
CHANGED
|
@@ -151,3 +151,45 @@ export const setOrderAcceptedBySequence = function (sequence, storeId) {
|
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
153
|
};
|
|
154
|
+
export const bulkCancel = function (storeId, body) {
|
|
155
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
try {
|
|
157
|
+
const config = {
|
|
158
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
159
|
+
};
|
|
160
|
+
return yield axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkCancel`, body, config);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
console.error('Error fetching bulkCancel:', error);
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
export const bulkClean = function (storeId, body) {
|
|
169
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
170
|
+
try {
|
|
171
|
+
const config = {
|
|
172
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
173
|
+
};
|
|
174
|
+
return yield axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean`, body, config);
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
console.error('Error fetching bulkClean:', error);
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
};
|
|
182
|
+
export const bulkCollect = function (storeId, body) {
|
|
183
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
184
|
+
try {
|
|
185
|
+
const config = {
|
|
186
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
187
|
+
};
|
|
188
|
+
return yield axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkCollect`, body, config);
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
console.error('Error fetching bulkCollect:', error);
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
};
|
package/dist/utils/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { applyDiscountToProducts, calculateOrderTotal } from './orders';
|
package/package.json
CHANGED
package/src/api/discounts/put.ts
CHANGED
|
@@ -27,4 +27,19 @@ export const deleteAutomaticDiscountById = async function (this: WashdayClientIn
|
|
|
27
27
|
console.error('Error fetching deleteAutomaticDiscountById:', error);
|
|
28
28
|
throw error;
|
|
29
29
|
}
|
|
30
|
-
};
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
export const updateAutomaticDiscountById = async function (this: WashdayClientInstance, storeId: string, discountId: string, data: {
|
|
34
|
+
products: string[];
|
|
35
|
+
}): Promise<any> {
|
|
36
|
+
try {
|
|
37
|
+
const config = {
|
|
38
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
39
|
+
};
|
|
40
|
+
return await axiosInstance.put(`${GET_SET_AUTOMATIC_DISCOUNTS}/${storeId}/${discountId}`, data, config);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
console.error('Error fetching updateById:', error);
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
};
|
package/src/api/index.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } fr
|
|
|
9
9
|
import { getCountries } from "./countries/get";
|
|
10
10
|
import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from './discounts/get';
|
|
11
11
|
import { createAutomaticDiscount, createDiscountCode } from "./discounts/post";
|
|
12
|
-
import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "./discounts/put";
|
|
12
|
+
import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById } from "./discounts/put";
|
|
13
13
|
import { deleteStoreStaffById } from "./staff/delete";
|
|
14
14
|
import { getStoreStaff, getStoreStaffById } from "./staff/get";
|
|
15
15
|
import { createStoreStaff } from "./staff/post";
|
|
@@ -106,6 +106,9 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
106
106
|
getByIdCustomersApp: ordersEndpoints.getModule.getByIdCustomersApp,
|
|
107
107
|
setOrderAcceptedBySequence: ordersEndpoints.putModule.setOrderAcceptedBySequence,
|
|
108
108
|
getRequestedOrdersSummary: ordersEndpoints.getModule.getRequestedOrdersSummary,
|
|
109
|
+
bulkCancel: ordersEndpoints.putModule.bulkCancel,
|
|
110
|
+
bulkClean: ordersEndpoints.putModule.bulkClean,
|
|
111
|
+
bulkCollect: ordersEndpoints.putModule.bulkCollect
|
|
109
112
|
});
|
|
110
113
|
this.customers = bindMethods(this, {
|
|
111
114
|
getCustomers: customersEndpoints.getModule.getList,
|
|
@@ -216,6 +219,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
216
219
|
getAutomaticDiscountById: getAutomaticDiscountById,
|
|
217
220
|
createAutomaticDiscount: createAutomaticDiscount,
|
|
218
221
|
deleteAutomaticDiscountById: deleteAutomaticDiscountById,
|
|
222
|
+
updateAutomaticDiscountById: updateAutomaticDiscountById,
|
|
219
223
|
});
|
|
220
224
|
this.csv = bindMethods(this, {
|
|
221
225
|
exportCustomersList: csvExportEndpoints.getModule.exportCustomersList,
|
package/src/api/order/put.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AxiosResponse } from "axios";
|
|
1
2
|
import { WashdayClientInstance } from "../../interfaces/Api";
|
|
2
3
|
import axiosInstance from "../axiosInstance";
|
|
3
4
|
const GET_SET_ORDER = 'api/v2/order';
|
|
@@ -161,4 +162,50 @@ export const setOrderAcceptedBySequence = async function (this: WashdayClientIns
|
|
|
161
162
|
console.error('Error fetching setOrderAcceptedBySequence:', error);
|
|
162
163
|
throw error;
|
|
163
164
|
}
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const bulkCancel = async function (this: WashdayClientInstance, storeId: string, body: {
|
|
168
|
+
ordersIds: string[]
|
|
169
|
+
cancelledDateTime: string
|
|
170
|
+
}): Promise<AxiosResponse<any, any>> {
|
|
171
|
+
try {
|
|
172
|
+
const config = {
|
|
173
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
174
|
+
};
|
|
175
|
+
return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkCancel`, body, config);
|
|
176
|
+
} catch (error) {
|
|
177
|
+
console.error('Error fetching bulkCancel:', error);
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export const bulkClean = async function (this: WashdayClientInstance, storeId: string, body: {
|
|
183
|
+
ordersIds: string[]
|
|
184
|
+
cleanedDateTime: string
|
|
185
|
+
readyDateTime: string
|
|
186
|
+
}): Promise<AxiosResponse<any, any>> {
|
|
187
|
+
try {
|
|
188
|
+
const config = {
|
|
189
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
190
|
+
};
|
|
191
|
+
return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkClean`, body, config);
|
|
192
|
+
} catch (error) {
|
|
193
|
+
console.error('Error fetching bulkClean:', error);
|
|
194
|
+
throw error;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export const bulkCollect = async function (this: WashdayClientInstance, storeId: string, body: {
|
|
199
|
+
ordersIds: string[]
|
|
200
|
+
collectedDateTime: string
|
|
201
|
+
}): Promise<AxiosResponse<any, any>> {
|
|
202
|
+
try {
|
|
203
|
+
const config = {
|
|
204
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
205
|
+
};
|
|
206
|
+
return await axiosInstance.put(`${GET_SET_ORDER}/${storeId}/bulkCollect`, body, config);
|
|
207
|
+
} catch (error) {
|
|
208
|
+
console.error('Error fetching bulkCollect:', error);
|
|
209
|
+
throw error;
|
|
210
|
+
}
|
|
164
211
|
};
|
package/src/interfaces/Api.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { updateCompanyById, updateCompanyLogoById, updateCompanyTaxInfoById } fr
|
|
|
8
8
|
import { getCountries } from "../api/countries/get";
|
|
9
9
|
import { getAutomaticDiscountById, getAutomaticDiscounts, getAvailableAutomaticDiscounts, getDiscountCodeById, getDiscountCodes, verifyDiscountCode, verifyDiscountCodeCustomersApp } from '../api/discounts/get';
|
|
10
10
|
import { createAutomaticDiscount, createDiscountCode } from "../api/discounts/post";
|
|
11
|
-
import { deleteAutomaticDiscountById, deleteDiscountCodeById } from "../api/discounts/put";
|
|
11
|
+
import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById } from "../api/discounts/put";
|
|
12
12
|
import { deleteStoreStaffById } from "../api/staff/delete";
|
|
13
13
|
import { getStoreStaff, getStoreStaffById } from "../api/staff/get";
|
|
14
14
|
import { createStoreStaff } from "../api/staff/post";
|
|
@@ -92,6 +92,9 @@ export interface WashdayClientInstance {
|
|
|
92
92
|
getByIdCustomersApp: typeof ordersEndpoints.getModule.getByIdCustomersApp;
|
|
93
93
|
setOrderAcceptedBySequence: typeof ordersEndpoints.putModule.setOrderAcceptedBySequence,
|
|
94
94
|
getRequestedOrdersSummary: typeof ordersEndpoints.getModule.getRequestedOrdersSummary;
|
|
95
|
+
bulkCancel: typeof ordersEndpoints.putModule.bulkCancel,
|
|
96
|
+
bulkClean: typeof ordersEndpoints.putModule.bulkClean,
|
|
97
|
+
bulkCollect: typeof ordersEndpoints.putModule.bulkCollect
|
|
95
98
|
};
|
|
96
99
|
customers: {
|
|
97
100
|
getCustomers: typeof customersEndpoints.getModule.getList;
|
|
@@ -202,6 +205,7 @@ export interface WashdayClientInstance {
|
|
|
202
205
|
getAutomaticDiscountById: typeof getAutomaticDiscountById;
|
|
203
206
|
createAutomaticDiscount: typeof createAutomaticDiscount;
|
|
204
207
|
deleteAutomaticDiscountById: typeof deleteAutomaticDiscountById;
|
|
208
|
+
updateAutomaticDiscountById: typeof updateAutomaticDiscountById;
|
|
205
209
|
};
|
|
206
210
|
csv: {
|
|
207
211
|
exportCustomersList: typeof csvExportEndpoints.getModule.exportCustomersList;
|
package/src/utils/index.ts
CHANGED