washday-sdk 0.0.129 → 0.0.131
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 +2 -1
- package/package.json +1 -1
- package/src/api/discounts/put.ts +17 -0
- package/src/api/index.ts +2 -1
- package/src/interfaces/Api.ts +2 -1
|
@@ -52,3 +52,17 @@ export const updateAutomaticDiscountById = function (storeId, discountId, data)
|
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
};
|
|
55
|
+
export const updateDiscountCodeById = function (storeId, discountId, data) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
try {
|
|
58
|
+
const config = {
|
|
59
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
60
|
+
};
|
|
61
|
+
return yield axiosInstance.put(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, data, config);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
console.error('Error fetching updateDiscountCodeById:', error);
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
};
|
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, updateAutomaticDiscountById } from "./discounts/put";
|
|
11
|
+
import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById, updateDiscountCodeById } 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";
|
|
@@ -206,6 +206,7 @@ const WashdayClient = function WashdayClient(apiToken) {
|
|
|
206
206
|
verifyDiscountCodeCustomersApp: verifyDiscountCodeCustomersApp,
|
|
207
207
|
createDiscountCode: createDiscountCode,
|
|
208
208
|
deleteDiscountCodeById: deleteDiscountCodeById,
|
|
209
|
+
updateDiscountCodeById: updateDiscountCodeById,
|
|
209
210
|
});
|
|
210
211
|
this.automaticDiscount = bindMethods(this, {
|
|
211
212
|
getAutomaticDiscounts: getAutomaticDiscounts,
|
package/package.json
CHANGED
package/src/api/discounts/put.ts
CHANGED
|
@@ -43,3 +43,20 @@ export const updateAutomaticDiscountById = async function (this: WashdayClientIn
|
|
|
43
43
|
throw error;
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
+
|
|
47
|
+
export const updateDiscountCodeById = async function (this: WashdayClientInstance, storeId: string, discountId: string, data: {
|
|
48
|
+
products?: string[];
|
|
49
|
+
buyAndGetConditions?: any;
|
|
50
|
+
freeProductSetting?: any;
|
|
51
|
+
}): Promise<any> {
|
|
52
|
+
try {
|
|
53
|
+
const config = {
|
|
54
|
+
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
55
|
+
};
|
|
56
|
+
return await axiosInstance.put(`${GET_SET_DISCOUNT_CODES}/${storeId}/${discountId}`, data, config);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error('Error fetching updateDiscountCodeById:', error);
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
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, updateAutomaticDiscountById } from "./discounts/put";
|
|
12
|
+
import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById, updateDiscountCodeById } 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";
|
|
@@ -212,6 +212,7 @@ const WashdayClient: WashdayClientConstructor = function WashdayClient(this: Was
|
|
|
212
212
|
verifyDiscountCodeCustomersApp: verifyDiscountCodeCustomersApp,
|
|
213
213
|
createDiscountCode: createDiscountCode,
|
|
214
214
|
deleteDiscountCodeById: deleteDiscountCodeById,
|
|
215
|
+
updateDiscountCodeById: updateDiscountCodeById,
|
|
215
216
|
});
|
|
216
217
|
this.automaticDiscount = bindMethods(this, {
|
|
217
218
|
getAutomaticDiscounts: getAutomaticDiscounts,
|
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, updateAutomaticDiscountById } from "../api/discounts/put";
|
|
11
|
+
import { deleteAutomaticDiscountById, deleteDiscountCodeById, updateAutomaticDiscountById, updateDiscountCodeById } 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";
|
|
@@ -198,6 +198,7 @@ export interface WashdayClientInstance {
|
|
|
198
198
|
verifyDiscountCodeCustomersApp: typeof verifyDiscountCodeCustomersApp;
|
|
199
199
|
createDiscountCode: typeof createDiscountCode;
|
|
200
200
|
deleteDiscountCodeById: typeof deleteDiscountCodeById;
|
|
201
|
+
updateDiscountCodeById: typeof updateDiscountCodeById;
|
|
201
202
|
};
|
|
202
203
|
automaticDiscount: {
|
|
203
204
|
getAutomaticDiscounts: typeof getAutomaticDiscounts;
|